Model-Based Design of control systems: Simulate and test before committing to hardware

Simulation and testing with Model-Based Design has become a best practice as motor control systems continue to increase in complexity.

Builders of complex equipment are driven to provide better performance while meeting tight deadlines and keeping costs down. One way to improve performance and lower costs is by improving motors and motor control systems. However, the demand for better performance and accuracy of motor control systems is growing rapidly and reaching the point where traditional design and verification methodologies are falling short. By using Model-Based Design, engineers can find errors earlier in the design process and create higher-performing motor control systems.

In a traditional workflow, engineers frequently could not test and validate their control system designs until late in the development cycle, when motors, sensors, actuators, and other system hardware finally became available. This approach was sufficient when expected system behavior was predictable. Problems that arose could often be resolved by augmenting and tuning the control system during final system integration.

For today’s complex machine systems, however, the tradional workflow has drawbacks. When late design problems surface, they generally require difficult and time-consuming changes that result in costly system hardware modification. Additionally, the growing requirements and complexity of control system designs make it difficult to test all possible operating conditions. Therefore, new verification methods are needed.

Leading system designers recognize these challenges and are adopting Model-Based Design. This approach enables engineers to simulate the physical plant and test control system logic and algorithms at the early stages of the development process, when errors that are found are easier and less expensive to fix. Visit to learn more.

Model-Based Design allows designers to:

  • Quickly evaluate a variety of control strategies and optimize system behavior
  • Catch errors early, before motors and other machine hardware are available
  • Use simulation to test the full operating envelope
  • Reuse models for real-time testing

Comparing traditional design workflows to Model-Based Design

Figure 1 illustrates the traditional workflow where specifications and requirements are provided in print or document form. Subsystems, including mechanical, electronic, controls, and software are independently designed, usually with many design tools directly from the documentation. For this process, system verification comes late in the design cycle, typically during final integration and buildup. Only at this point can engineers fully observe the interaction between a system’s physical components and the control system design.

Figure 1: In the traditional design workflow, verification occurs at the end of the design process, when changes are difficult and expensive.

This approach might be acceptable for simple machines, where expected component or subsystem behavior is easily predicted. However, as system designers add features and push for optimal performance, subsystem interaction becomes more complex. This increases the challenges of motor control system design and therefore increases the likelihood of error. Risk is further compounded because performance requirements, implementation details, and test conditions for each component – mechanical, hydraulic, controls, and software – are established independently. These differences make it easy to introduce conflicting requirements, misinterpret requirements during design, or perform incomplete or extraneous testing.

If an error is not discovered early in the design process, the complex interaction between subsystems can make it difficult to trace the problem back to its root cause, and fixing this problem can be just as tricky. Errors related to incomplete, incorrect, or conflicting requirements might even necessitate a fundamental design change.

An executable specification for reducing errors

Model-Based Design mitigates these challenges by enabling simulation and up-front verification. In this case, verification is no longer treated as a final step. Instead, verification becomes a continuous process that begins with design simulation followed by real-time testing (see Figure 2).

Figure 2: Model-Based Design features continuous verification and validation that begins in the design phase and carries through to real-time testing.

Model-Based Design enables systems engineers to create a mathematical model of both the control system and the physical plant or machine, including mechanical, electrical, hydraulic, and other physical components. When the model is linked to the design requirements, it becomes an executable specification, reducing requirements ambiguity and minimizing the risk of design errors.

Model-Based Design also provides a unified design and verification platform. Engineers have an intuitive, graphical view of the system serving as a common environment for designers from different disciplines. Tools for Model-Based Design also facilitate the reuse of existing designs and engineering data by providing hooks into CAE tools, such as Computer-Aided Design (CAD) and Finite Element Analysis (FEA), and circuit emulation tools such as Simulation Program with Integrated Circuit Emphasis (SPICE).

The availability of an executable specification helps controls engineers understand the interactions among the controllers, motors, and machine, which leads to insight for improvements in the control system strategy. Instead of designing against an inherently vague paper specification, designers can experiment with the model, run behavioral simulations, and quickly implement design changes – all helpful for understanding the system’s achieved accuracy and performance. This facilitates early identification of the control design that yields improved performance while meeting motor limitations and machine constraints.

Simulation and early verification

Control system designers using a traditional workflow cannot verify their designs until motors and machine hardware are available, usually late in the design process. In contrast, Model-Based Design enables designers to start verification and testing with models of these components, saving design time, reducing costs, and improving overall system quality, accuracy, and performance.

Simulation and early verification allow designers to catch errors near the beginning of the development process, when they are easier and cheaper to fix. Simulation helps designers spot problems that would require hardware changes – a particularly valuable capability because hardware changes are much more expensive than software fixes. Also, errors are much easier to troubleshoot in simulation than in the field. When a simulation error arises, an algorithm designer can inspect each component’s state and history, with the ability to drop in a scope and visualize the data at any point, run the simulation repeatedly under identical operating conditions to replicate the problem, and then implement changes to the model that resolve the problem. In the field, design change flexibility is greatly reduced.

Testing against a model also enables more thorough verification. Complex machine systems, which might feature multiple motors and motor control systems, often have large operating envelopes with numerous control modes and logic states. Testing the full operating envelope with real motors and system hardware can be impractical or even dangerous. It is far more effective to achieve full test coverage in simulation where there are no concerns about equipment damage or safety hazards.

Real-time testing

With Model-Based Design, the same models used in simulation can be used to take verification a step further by performing real-time testing. Real-time testing is the process of running, proving, and testing integrated hardware/software system designs under normal modes of operation. Two of the most common real-time testing strategies are rapid control prototyping and hardware-in-the-loop simulation.

In rapid control prototyping, an executable application is generated from the control system model and tested on a real-time computational platform while connecting to the physical motors and machine hardware. Because there is a direct connection between the design (model) and implementation (executable application), it is easy to improve control design deficiencies identified during real-time testing. Engineers can even run through the same tests that were conducted in desktop simulation.

Rapid control prototyping can also help highlight approximation errors or inaccuracies of the plant (motor and machine) models used during simulation, thus allowing for improvements in system simulation. Once the control design has been verified through real-time testing, engineers can reuse the model through code generation to implement the design in embedded or production control hardware.

In hardware-in-the-loop simulation, a production controller is tested against a real-time simulation of the plant (motors and machine). This capability is useful in cases where access to the actual system is limited or unavailable – for example, motors attached to large industrial machines such as printing presses or packaging equipment.

Hardware-in-the-loop simulation is also invaluable when it is dangerous to test the plant’s full operational envelope. Consider the risks of trying out a complex motor control algorithm in an industrial environment. If something goes wrong, a system failure can damage equipment and endanger people nearby. Testing the production controller against a real-time simulation of the motors and machine is far better. Just as important, hardware-in-the-loop simulation can be used to fully exercise system diagnostics – for example, emergency condition detection and shutdown procedures – which might be difficult or impossible to test on the motor and/or machine itself.

Model-Based Design benefits in control systems

Model-Based Design has become an important workflow for a broad range of motor control applications including industrial automation and machinery, office equipment, consumer goods, instruments, medical devices, and process industries.

From simulation and early verification to real-time testing, Model-Based Design results in shorter, less costly design cycles and helps designers create more robust, higher-performing control systems for motor control applications. As control systems become increasingly complex, verifying designs before committing to hardware will not only be a best practice, it will be imperative.

Doug Jones is a marketing manager at MathWorks.

Brian McKay is a marketing manager at MathWorks.


Follow: Twitter Blog Facebook Linkedin YouTube