Plant modelling: a first step to early verification of control systems

Today’s control system engineers face competing design demands: increase embedded system performance and functionality, without sacrificing quality or breaking the budget. It is difficult to meet these challenges using traditional design and verification approaches.

Without simulation it is impossible to verify a control design until late in the development process when hardware prototypes become available. This is not an insurmountable problem for simpler designs with predictable system behavior, because there are fewer sources of error in simpler control algorithms–and those errors can often be resolved by tuning the controller on the hardware prototype.

Today’s multidomain designs combine mechanical, electrical, hydraulic, control, and embedded software components. For these systems, it is no longer practical to delay verification until late in the development process. As system complexity grows, the potential for errors and suboptimal designs increase. These problems are easiest to address when they are identified early in the development process. When design problems are discovered late, they are often expensive to correct and require time-consuming hardware fixes. In some cases the hardware simply cannot be changed late in the development process, resulting in a product that fails to meet its original specifications.

Traditional verification methods are also inadequate for testing all corner cases in a design. For some control applications, it is impractical or unsafe to test the full operating envelope of the system on hardware. 

Using models as a solution

To address the problems inherent in the traditional design flow, many engineering companies are using system simulation to verify their designs early in the development process. As a key component of Model-Based Design, system simulation enables engineers to test control algorithms before manufacturing costly hardware or creating production control software.

Model-Based Design is based on the use of models, which are reused throughout the development process. An accurate plant model of the hardware is used to design a control system. Engineers then connect the same plant model to the control algorithm to conduct closed-loop simulations of the system. Simulating the system enables engineers to catch design errors, validate requirements, see how different components work together, and verify  control system performance throughout the entire operating envelope. More importantly, all of this is done early in the development process. Additionally, if problems are found in production hardware, simulation can be used to troubleshoot the design without tying up the hardware.

The plant model can also be used for real-time testing of the control algorithm. This is done by automatically generating code from the plant model and running this code on a real-time computer to simulate the real-time behavior of the actual plant hardware. Engineers can conduct hardware-in-the-loop (HIL) testing by connecting this computer to the production controller and testing the closed loop system in real-time (see Figure 1). 

Figure 1. Using the plant model for real-time testing of control algorithm (hardware-in-the-loop testing)

Simulation reduces, but does not eliminate, the need for testing on hardware prototypes. When hardware prototypes become available, control system designers can concentrate on those few issues that couldn’t be verified in desktop simulation and HIL testing. Simulation shortens the development process and reduces the number of required prototypes, saving time and money. 

Of course, code generation is not restricted to the plant model.  Engineers can use Model-Based Design to further accelerate the development process by  automatically generating code for the production control software as well.

Facilitating plant modelling

There are several methods that engineers can use to create plant models. 

When an engineer is troubleshooting a problem with an existing design and has access to the input-output test data from the machine, system identification is often the easiest way to create a plant model. With system identification, engineers create a model that fits the test data. For example, to troubleshoot a controller for a DC motor with an amplifier, an engineer could develop a model of an amplifier by collecting input and output voltage signals from the amplifier, and fitting a state-space model to the data. This approach enables rapid development of highly accurate plant models, without requiring knowledge of governing equations. It’s important to keep in mind, however, that system identification requires access to plant hardware.

Figure 2. Measured and simulated output of an amplifier model developed using system identification. The black line shows the measured voltage output, the green line shows the simulated model response.

When working on a new design, plant hardware is often unavailable. In these cases, the preferred way to create a plant model is via a first principles approach, which requires an understanding of the underlying physics of the system. Engineers typically start with a relatively simple and easy-to-create model. For example, in designing a robot that uses a DC motor to actuate its joints, an engineer might start by modeling the actuator as a first- or second-order transfer function. This simplified model could be used for initial design iterations. 

As the design matures, higher fidelity models of components will be required. When the equations describing the dynamics of the machine are known explicitly, engineers can implement these equations directly in the plant model. However, when the governing equations are not known explicitly or are too difficult or time-consuming to derive, a physical modeling  approach can be used to construct plant models by mapping the component topography and physical connections of the system using blocks representing the mechanical, hydraulic, and electrical components and their connections. Physical modeling enables engineers to quickly create complex, multidomain plant models without deriving the underlying first principles equations.  For example, to create a high-fidelity model of a DC motor, engineers can construct a block diagram using blocks that represent electrical and mechanical elements of the motor, including resistance, inductance, and inertia. They can also reuse existing intellectual property,  such as CAD assemblies, to automatically create dynamic plant models. Elements from different physical domains can be combined and connected in one environment, enabling designers to model and simulate complex multidomain systems.

Figure 3. A model of a DC motor developed using physical modeling. Blocks highlighted in blue represent electrical components; blocks highlighted in green mechanical components

The first-principles approach provides insight into the system’s underlying behavior and facilitates design optimisation by enabling parametric studies. First principles models contain parameters corresponding to physical properties of the plant, such as mass, electrical resistance, and flow area. Engineers can increase the fidelity of the plant model by tuning these  parameters using test data. With this hybrid approach, the model is still based on the underlying physics of the plant, but parameter values can be calibrated with actual test data to improve model accuracy. 

The first-principles approach does have some drawbacks. It may be more time consuming than the data-driven system identification approach. Also, certain systems, such as complex chemical processes, are difficult to model using first principles. 

A complete plant model may contain models of multiple components, which can be modeled by applying any of the aforementioned methods or by using look-up tables or even neural networks.  These component models may be reused across multiple projects. A model of a DC motor, for example, can be reused in a new project by simply changing the characteristics of the motor to reflect the new design.

The ability to combine different modeling techniques in one environment makes it easier to achieve the required level of detail and fidelity when creating plant models.

Summary and conclusion

Simulation allows designers to:

  • Catch errors early, before hardware prototypes are available 
  • Minimise testing on expensive or scarce hardware prototypes 
  • Evaluate a variety of control strategies and optimise system behavior 
  • Test the full operating envelope and verify control system response to possible system failures 
  • Perform real-time testing, reusing plant models developed for desktop simulation 
     

Developing a plant model is an important first step toward early verification using simulation. Model-Based Design tools support the rapid development of accurate plant models using a number of different techniques. Simulation with these models enables engineers to reduce verification time, improve the performance of their designs, and deliver better products on time and within budget.

[Arkadiy Turevskiy is technical marketing manager, MathWorks.]