State Model Simplifies Complex Machines

Developers can more quickly deliver industrial machines to the market while gaining wider customer acceptance by using standard tags and state machine design.

By Mike Wagner

Packaging machines, like much industrial equipment, are becoming more and more complex. They have gone from a line shaft to some servos to integrated servo machines. As machines get more complex, customers have come to expect more from the control system. Usually, they want consistent machine behavior, well-structured code and standard production and efficiency data. To meet those demands, machine builders must now begin programming their machines in a structured way.

One innovative and effective technique for programming a machine in a structured way is to use state machine design along with standard data tags. This technique allows machine builders to bring together three main elements to use during programming. These elements include a state model that clearly defines the behavior of a machine, code that is structured around the state model, and the standard tags for identifying needed data.

Because of its structured nature, this technique provides a faster way to program a machine. Developers can quickly draft a functional specification for the machine and convert it to a project layout. The layout can then be used as a guide that shows where to put the different pieces of code. The structure also helps to separate the normal operation from exceptions; keeping code simple and focused. One section of the code takes care of normal machine operation, while another section takes care of exceptions such as faults and running out of materials.

Figure 1: A state model provides a high-level visual description of machine behavior that makes it easy for developers and customers to identify and modify operational code. (Image courtesy of OMAC PackML Group, www.arcweb.com/OMC.)

Standard Tags Support Data Exchange

The benefit of the standard tags is that they can be created based on pre-defined data structures. The structured nature means that the data is already set up the way it needs to be for developers to control the machine and it is already set up the way customers need it to be in order to run the machine. This latter capability is critically important as customers want to measure how well their machines are doing. If they have efficiency data that fits easily into their plant management, chances are they’ll be more inclined to buy more machines.

To get the highest possible performance from the machine, developers must also measure machine performance. By understanding the machine’s performance shortfalls, the appropriate steps can then be taken to significantly improve them. This measurement capability comes from the data tags, but by putting the tags into the customers own data type, developers can also ensure that the correct data is available for the customer’s needs and easily accessible from the machine.

Efficiency measurement is just one way that structured data with standard tags can help the machine builder’s customer. It also helps cut the cost of integrating the machine into the plant. The clear structure and consistent tags allow the machine to be easily plugged into a plant and to begin exchanging data with other machines right away. Machines up and down the line can connect with each other using the same tag names. All the machines connect with higher-level systems in the same way.

Using the state-machine programming model also supports customers. The state model lays out the general functions of a machine, making it easier for customers to maintain the machine’s code on their own. For the developer, the state model serves as a map for their code. With the clear structure the map provides, both developer and customer know exactly where to look for a specific piece of code. A state model also allows developers or customers to configure all plant machines to behave the same. They can make the human-machine interface (HMI) show machine conditions across the plant in a consistent format. As a result, when an HMI says that any given machine is ready, running or holding, the operators know exactly what that means.

Figure 2: An alternative way of expressing machine behavior, the transition matrix can serve as a planning tool for developing a state model.

Understanding the State Model

A state model divides the operating cycle of a machine into a series of states. Each state is a picture of the current operation of the machine, defined as the actions, or conditions, of the machine at a given time. The use of a state model may sound like a big change for machine builders, but it’s simply a different way of looking at the same control problem. With a state model, developers define the behavior of a machine and put it into a brief functional specification. In this way, the developer can show what happens and when it happens.

While developing the state model, you will need to know both the actions the machine takes in each state and the conditions that drive the machine from one state to another. States themselves can be of several forms. Transient states perform a task and wait for a result before changing state. Quiescent states maintain a machine at a defined set of conditions indefinitely. No Command states automatically move on to a new state once a task is completed, and Final states represent a safe condition, i.e., no moving parts. The change conditions may be the push of a button, a status change within the machine, or it may be automatic after a delay or a completed action.

To develop the state model for a machine, start with the “stopped state”. Decide what happens when you turn on power to the machine. The machine may, for example, set up communications or heat up the glue. Next, decide how the machine gets ready to run (starting state). This usually happens after the Start or Init button has been pressed. Will it clear all registers, enable all axes, home all axes, or signal initialization complete? Continue with the rest of the states and define the steps of each state along with the conditions that will cause the machine to change state. The developer should now have a clear and concise description of the machine’s high-level behavior, similar to the diagram in Figure 1. It can also be represented as a state transition matrix like that shown in Figure 2.

In some cases, the definition of states and tags has already been developed by industry groups to ensure commonality across an industry. For packaging machines the Packaging Machinery Language team (PackML) working group - a subcommittee of the Open Modular Architecture Controls (OMAC) user group - defined the data that makes up Pack Tags, a set of standard data types. With this data, developers and users can calculate the machine efficiency and performance measures they require. In addition, the PackML committee has defined a standard state model for this type of machine.

The standard state model is not code; it is only a framework. To use the state model, the software needs code for a state machine. Companies such as Rockwell Automation have adopted the standard models and tags and created programming tools like Power Programming to support development of state machines using the standards. The Rockwell Automation Power Programming tool provides the developer with the base code for the state machine. Think of it as application layer firmware that is visible. Developers then add:

  • Machine conditions such as pushbuttons and limit switches
  • Detailed actions for each state
  • Code to carry out each action for each device on the machine

Power Programming also provides the developer with both standard data tags (PackTags 2.0) and a set of user-defined data types (UDT) for a machine. A UDT makes a custom memory record with the data. It packs multiple fields (members) of data into a single contiguous group with an ordered layout. Power Programming gives the developer UDTs both for machine control and machine efficiency.

In terms of machine control, the UDTs carry all the commands, status and parameters that are required for a machine. The developer needs only to make a few tags using the UDTs and the data for the machine is accessible. With regard to machine efficiency, the UDTs provide the developer with all the Pack Tags necessary for calculating machine efficiency. The Pack Tags give the developer access to raw efficiency data used to calculate performance measures and provide the machine with a standard vocabulary to use with other machines in the line and the plant-wide systems.

While Power Programming is a specific tool for developing software targeted at Rockwell Automation controller hardware, the state model and standard tag techniques it supports are applicable to any industrial machine. The technique can simplify machine control software design, support the use of a common data framework to facilitate machine communication, and provide both developer and customer with a clear picture of machine operation for making improvements and modifications. As industrial machines continue to become more complex with more features, these techniques will make their software design more manageable and effective.

Mike Wagner is the Chief Business Development Manager for the Global OEM Team, Rockwell Automation. Wagner has been in the automation industry since 1984, graduating from the University of Minnesota in 1987 with a Bachelor of Science in Mechanical Engineering. He joined Rockwell Automation in 1994 and has worked primarily in the Motion division with a variety of roles and responsibilities. Wagner currently sits on two industry committees, OMAC and ISA S88, and is currently working on the Make2pac workgroup.