Model-Based Design Changes the Machine Builder Industry

The machine building industry has certainly changed: Extensive and sophisticated control programs contain the core know‐how and make today’s machines more flexible and productive. Although software and data is important for machine builders, control programs are usually first “tried out” on real machines without prior validation. To meet delivery dates, control code running on machines is sent off largely untested. But this can lead to errors and downtime in the field, along with costly updates.

Testing Software with MBD

Virtual commissioning is being used more and more to detect errors when developing machines. To do so, a digital model or “twin” gets linked to the application running on the industrial controller. The plant’s behavior is simulated to test the controller quicker and safer.

Model-Based Design (MBD), however, goes beyond virtual commissioning. With it, the control application that will later run in operation is also modeled and tested in simulations with the machine model. This lets machine manufacturers such as ENGEL and Tetra Pak extensively test software before the machine is available and the control cabinet fully wired. With MBD manufacturers can simulate the behavior of the mechanical and electrical systems interacting with the control software later running on a PLC. Errors previously only detected by extensive tests on the machine or in the lab can be found earlier in the development process. Even test scenarios that can’t be carried out at all due to danger to humans and machines can be safely observed in simulations. Using MBD lowers costs for physical prototypes, minimizes risks of delivery delays and helps prevent cost‐intensive downtime in the field.

A closed-loop system consisting of a robot arm and its control logic can be modeled in Simscape and Stateflow.

Push-Button Control Software

Functions verified by MBD are not manually programmed but instead get transferred to the industrial controller—a PLC or industrial PC—at the push of a button.

Automatically generating code for programs running on PLCs has obvious advantages. Functions tested in simulation are translated into source code (C, C++ or IEC 61131‐3) that can be compiled to an industrial controller. This approach avoids errors often introduced when programmers manually write code for complex control algorithms. And it let developers concentrate on their core competency such as developing a sequence control or a closed-loop control algorithm, rather than dealing with PLC languages’ special features.

Generating code from a model makes it possible to support several languages, such as C, C++, structured text and ladder diagram. It also lets algorithms be ported from one control platform to another as the need arises.

The generated code for the industrial controller traces back to the original Simulink model.The generated code for the industrial controller traces back to the original Simulink model.

The model is always the starting point for generating. The automated workflow shortens the development time so engineers can spend more time on designing more advanced machine functions. With this approach, programming control systems is further abstracted. In the early days, programs were implemented in machine language or assembler. Today, industrial-control development environments support high‐level languages like  the aforementioned C and C++, as well as languages summarized in the IEC 61131‐3 standard.

Generating PLC code from simulation models adds a further level of abstraction that makes the complexity of extensive machine applications manageable. Models in Simulink and other products are executable specifications that can validate functions quickly through simulation and creating control programs by automatically generating code.

Through MBE, a further abstraction of the programming of machine software helps make its increasing complexity manageable.Through MBE, a further abstraction of the programming of machine software helps make its increasing complexity manageable.

The automotive and aerospace industries successfully use MBE and code generation from Simulink models in their workflows. Its importance in building machines is growing, as evidenced by the number of automation suppliers supporting code generation for their industrial controllers and PCs.

To automatically generate code when using MATLAB and Simulink, applications are first designed and tested. They are then automatically converted into source code that can be understood by the controller—IEC 61131-3, C or C++, depending on the target platform—and integrated into the respective controller IDE.

This approach combines the advantages of both systems. Functions for sequential controls, control algorithms and real‐time data processing are developed in MATLAB and Simulink, while the connection to the control hardware and the creation of the machine visualization take place in the programming IDE. Algorithms for artificial intelligence, such as machine learning models for predictive maintenance, can be developed and trained in MATLAB and then transferred to the industrial controller using code generation.

Several control manufacturers support automatically generating PLC code (IEC 61131 or C/C++) from MATLAB and Simulink.Several control manufacturers support automatically generating PLC code (IEC 61131 or C/C++) from MATLAB and Simulink.

As demand for product quality, machine efficiency and flexible production tactics increases, machine builders need to develop and test machine software more efficiently. Alternative control application designs can be quickly tested using simulation and then automatically transferred to an industrial controller as reusable software modules. Leading machine builders such as Metso and Trumpf have recognized this advantage and been successfully using MBD and automatic generation of control code for years.

Philipp Wallner is industry manager at MathWorks.

Source link