Model, Simulate, Execute Simulation in Discrete Control

KEY WORDS PC-based control Machine control Software for control Flowchart programming Simulation Imagine a product design, completed in software, and rendered in 3-D graphics. This rendering allows designers to strip away layers to view and work on components underneath. Next, manufacturing engineers can design the machines, fixtures, and processes required to produce components and completed ...

By Gary A. Mintchell, CONTROL ENGINEERING November 2, 2018


PC-based control

Machine control

Software for control

Flowchart programming


Imagine a product design, completed in software, and rendered in 3-D graphics. This rendering allows designers to strip away layers to view and work on components underneath. Next, manufacturing engineers can design the machines, fixtures, and processes required to produce components and completed assembly. Control is designed in the same software, executed in real-time simulation, and de-bugged. All this happens before the first steel is cut.

At the recently closed “Spirit of Ford” exhibit in Dearborn, Mich., on the grounds of Henry Ford Museum and Greenfield Village, Ford demonstrated a hologram, 50% scale, of a Prodigy P2000 fuel cell powered vehicle. This hologram was rendered at the design stage by Ford designers and Zebra Imaging. Exhibit visitors could see a rotating image of the vehicle, view from all sides, as well as view cutaways.

Take this technology and add live, active interfaces to machines and controls, and it’s almost control design nirvana.

Here’s the next step. Those who either work directly for large, international manufacturers, or those who build machines for them, already know about assembling large, interdisciplinary, international teams for new product line projects. If all these data reside in digital form on PCs, and if the PCs are connected to the Internet with proper enabling software, then large-scale collaboration is possible without the pain of temporary relocation.

Simulation remains the foundation technology for this not-so-distant future way of project development. Simulation works not just for manufacturing machinery control design, but products also exist to enable embedded control design. The principles are the same, and it’s not make-believe.

Yes, Virginia, there are real products available today that enable design, simulation, and debug of various types of control. Siemens Energy & Automation (Alpharetta, Ga.) enables machine control simulation in IEC 61131 languages. Entivity’s (Ann Arbor, Mich.) Think & Do is based in flow chart development and simulation. Rockwell Automation (Milwaukee, Wis.) and AutoSimulations (Bountiful, Utah) have products for packaging and material handling lines. Predator Software’s (Portland, Ore.) Virtual CNC allows machining simulation. The Mathworks (Natick, Mass.) integrated suite of products provides tools from modeling through simulation to code generation.

First build a model

Usually control design follows mechanical design. Control engineers must know what the process or mechanisms are that must be controlled. A list of machine states and sequences must be defined. Desired timing is determined. Manufacturing operations are detailed. CAD/CAM software has become so advanced that much, if not all, of these details can be designed and saved in an electronic format readable by other applications.

This software is now powerful enough that a machine, process, assembly line, packaging line, or whatever system that must be controlled can be designed and operated on a PC or workstation. If the system is similar to an existing line, so much the better. Engineers can accumulate data about system performance and build a database. Continually refined data built into a mathematical model make a powerful tool for designing and simulating real-time control.

One of the biggest headaches for a machine builder is commissioning. Debug and commissioning can eat up all the profits of the project, especially with a “special” machine that is not a replicated product. By simulating the machine and the code at a PC, most problems can be identified and eliminated before spending many hours around the machine on the floor. This is a great place to find some out-of-order sequences or out-of-whack timers. Simulation tools save time and money for machine builders and end-users.

Testing control code before the control designer has access to real machine I/O systems is an ideal first use for simulation. Think & Do’s editor contains a simulation flowchart. It monitors outputs from standard flowcharts and controls their inputs. In other words, a simulation flowchart can write inputs to the standard flowchart to simulate real machine action. Running a standard flowchart with simulation, the software responds just as though connected to real I/O devices. Both logic and HMI screens can be debugged in this manner.

Emulation vs. simulation

AutoMod from AutoSimulations allows modeling of either existing or conceptual systems. The software provides a set of material handling templates developed with real-world experience. Templates include:

Conveyors—accumulating, non-accumulating, roller, and belt systems;

Power and free;


Path-based movement; and

Bridge crane.

With AutoMod, users can create accurate and representative models of material handling equipment and process flows. Emulation uses the material handling model, either discrete or continuous, to act in place of actual hardware. The goal is to provide the same responses to a control system as real hardware would.

The emulation model can be maintained for the life of the automation system. Proposed changes can be tested on the model before implementation. It is also useful for employee training.

Emulation enables testing of scenarios without limit , a situation unlikely to happen in actual systems. An actual hardware PLC or a soft logic system on a PC can control these models. Communications can be achieved through sockets, NetDDE, DCOM, or OPC. Models can communicate through sockets to open and close socket connections, send and read data messages (including strings and C structures), and send and read synchronization messages.

AutoSimulations’ AutoMod uses control logic for simulation in the model. For the emulation model, some or all this logic is replaced with instructions from the actual control system. In many cases, simulation is useful for system development, while emulation is useful for debug.

Simulate machining

What if the manufacturing process is cutting chips rather than moving boxes? Predator Virtual CNC and Virtual Machine integrate CNC verification and machine simulation within a single Microsoft Windows-based application.

Predator works like a machine tool. It requires CNC programs, offsets, stock material, tooling, and fixturing details. A 3D virtual machining environment is displayed with VCR buttons to control the simulation. Unlike the real thing, however, Predator safely detects machine crashes, broken tooling, programming errors, and other problems.

The process begins with a CAD/CAM system machine design. Machine base and moving parts are imported into Predator Virtual Machine and kinematics are defined. An included machine-type library, such as vertical and horizontal machining centers, simplifies these definitions. CNC specifics are configured down to the G and M code level.

After machine-design is simulated and finalized, HTML-based documentation is automatically created for shop-floor personnel, reducing setup and prove-out time and expense.

Products exist now to assist control engineers to more quickly design and commission machine and product line control systems. It is a safe bet that more, and ever-improved, products will be available in the near future. In these days of fewer engineers left in a plant yet expected to accomplish more, tools like these will help you be a hero.

For more suppliers, go to; for more information, circle the following numbers or visit freeinfo:

AutoSimulations …217

Entivity …218

Predator Software …219

Rockwell Automation …220

Siemens E&A …221

The Mathworks …222

Virtual manufacturing cell to PLC program

A fast product launch and a fast production start are decisive factors for product success. That’s why risks in functionality and availability of production lines need to be minimized.

Production cells are designed and then simulated to verify productivity. This simulation requires very precise definition of the manufacturing cell process.

Even today, however, control engineers still build control programs based on information received mainly on paper as impulse diagrams, 2D drawings, and spreadsheet tables. Unfortunately, there is no digital transfer of all that information already defined for simulation in a form adequate for the control engineer.

Furthermore, verification of control programs can only be made on the shop floor during the commissioning phase, where every error and lost day increases costs tremendously.

Complex production cells, such as a body shop in an automotive manufacturing plant, are usually designed with Computer Aided Production Engineering (CAPE) tools.

With Siemens’ eM-Workplace, production and process engineers design the production cell manufacturing process, create offline robot programs, and validate and optimize the whole process in a 3D simulated environment. This process requires a very precise description of the production sequence. But this relevant information is still given on paper to the control design department.

Bridge the gap

To bridge this gap, Siemens has developed eM-PLC. This application uses the virtual 3D-manufacturing cell, translates information into valid PLC program, and allows a “virtual commissioning.”

This allows both mechanical and control design engineers to work in parallel and share information in a true collaborative environment.

eM-PLC automatically generates PLC code in Simatic Step-7 containing a list of tags, sequential function chart, and ladder containing calls of function blocks from the programmer’s library.

Users need to standardize programs by creating a library of function blocks defining behavior of a component, for instance a particular type of valve. In the program, the block name and parameters are extracted from Step-7 and linked to the corresponding mechanical component.

Sequence of operation is often accomplished in a “gun” chart. This chart has almost a one-to-one correlation with a standard sequential function chart. By translating this sequence, automatic code can be generated.

The application allows control designers to develop and test programs more quickly than allowed today. This is a considerable saving of time and expense accomplishing the company’s goal of getting products out more quickly.

Model-based design and simulation for embedded control

There is something for all the embedded control designers out there. Part of The Mathworks’ stable of products are Simulink, Stateflow, and Real-Time Workshop. These applications taken together form an interactive, graphical modeling environment, allowing users to model, analyze, and accurately simulate models of complex, large-scale systems. Users can convert the models to instrumented code for rapid prototyping and then high-performance code for use in target embedded processors.

Director of marketing, Mike Dickens, says, “People need to develop a controller as well as describe how it interacts with what is to be controlled. By simulating a model of the physical plant and the control, [users] can see the interactions. These must be dynamic situations.”

The first thing to do is to develop a realistic model. According to Mr. Dickens, the way to develop a model is to instrument the plant or physical process; acquire data; watch the physics of the plant change over time, (how things vary, how the control system varies over time); then take all the data and build a mathematical model. The MathWorks provides MatLab as a tool for that. Once built, models may be reused from design to design.

Next step is to move the mathematical model into Simulink, where simulated variables can be applied to the model to see what happens. There is no written software or prototypes at this level, but even so, engineers can determine whether or not a design will work. No guarantees exist that all possible conditions will be built in, so it is essential to step back and think about the situation creatively to dream different possible conditions on which to test the model.

Say the development environment is for the control of the pilot ejection button in a jet fighter. Perhaps the engineer has thought about ramifications of pushing the button and ejecting the pilot up and out of harm’s way. But, what if the pilot is flying the plane upside down and pushes the ejection button? What should be done in that case?

In other words, control design engineers must spend time thinking the process through and understand it thoroughly.

After simulating and continually refining the model, the time comes for adding control and generating code. The MathWorks provides tools to generate C control code, which is written in a standardized manner building upon experience. This leads to code consistent across the company’s design team. This subtle benefit led one American manufacturer to declare that it would not “write” code again. Users don’t want to start writing each new control code from scratch, and hope it’s the same as previous code.

Tools speed simulation

Within Simulink reside a function block library, system-functions (s-functions), and masks.

More than 200 built-in blocks are grouped into libraries according to functions. Both functionality and user interface of the block may be customized. Some blocks are sources, sinks, discrete, continuous, nonlinear, math, etc.

S-function is a custom code module that users can create in C, Ada, Fortran, or MatLab. This provides a method for incorporating existing code into new models.

Masks allow users to create a custom user interface. For instance, a short-time Fast Fourier Transform (FFT) block can be masked by a DSP blockset. Parameters are controlled by a dialog, but the block diagram for the detailed subsystem is hidden at the larger view.

Simulink provides immediate access to MatLab’s 2D and 3D graphics and animation capabilities.

Packaging line simulation to control

‘Discrete event simulation systems have been around for a long time,” says Vivek Bapat, Rockwell Automation product marketing manager. “Simon was our simulation language for manufacturing systems. We served mostly discrete manufacturing. Our new product, Arena, handles simulation for both process and discrete manufacturing. We have customers in food processing, pharmaceuticals, and automotive, among others.”

Arena builds a model of the process, rather than a machine on the shop floor. A new version, Arena Real Time, enables plugging into a live system, reading control information, then running simulations based on real information. The company was recently purchased by Rockwell Automation and is beginning integration with Rockwell Automation products.

Arena’s strength is in change management. Simulation is a friend of change. It answers questions like, “How can the process change?” or “How do you know it will work?”

High-speed packaging lines are fundamental to several manufacturing industries. These lines have some common characteristics. First, they are usually capital-intensive. A typical line contains several large and expensive interconnected machines. They also include conveyors and flow and speed control systems, employ numerous people, and consume immense amounts of packaging materials.

Second, most packaging lines operate at very high speeds to produce the large volumes of goods required. This makes the costs of even small line downtimes and other inefficiencies to be greatly magnified over time.

Optimizing line designs and operations can be critical to improving a company’s productivity, customer service, and bottom line.

Typical problems with these lines include:

A single machine or component may be a bottleneck;

An investment which increases productivity of one machine or section does not improve overall performance; and

An investment may replace an existing machine with a newer, higher capacity model, which produces little more than the old one.

The first challenge is to perform an accurate systems-level analysis. The second is to manage product changeovers. Each significant change requires a series of run-up activities to check each station for proper operation. The resulting costs are often influenced directly by the quality of line design. The third challenge is to minimize variability of the line.

Computer simulation of the entire process enables a model of the entire system, allowing predictions of system performance. By making the simulation dynamic, effects of variability can be identified and any negative impact reduced. Scenario analysis allows the designer to create imaginary lines and ask endless “what-if” questions. High-risk scenarios can be tried out and evaluated before significant dollars are invested.

When this simulation is integrated with control design, then start up occurs more quickly and with less pain.