High-fidelity plant modelling for real-time simulation

Ceanet Pty Ltd
http://www.ceanet.com.au
By Mike Dickens & Terry Denery*
Tuesday, 13 September, 2005


For the past 10 to 15 years, software and hardware systems have been introduced and enhanced to provide hardware-in-the-loop simulation capabilities for the design of advanced electronics control systems.

One of the more difficult problems has been to construct high-fidelity plant models that accurately represent the dynamics and behaviour of the actual physical plant, which may not yet have been constructed or which may be difficult to access in its final environment. Several products have offered three-dimensional graphical design capabilities for prototyping such plants, but these tools have been limited to prototyping of interactions and have not been effective in a real-time testing environment. Model-based design has proved to be a useful framework for some applications, especially for designing control system models, but plant models were sometimes limited to a series of mathematical equations that could be challenging to develop accurately.

Options for developing plant models

One approach is to model the physical system in a mechanical modelling tool and then interface it with the control design environment. But interfaces and data transfer can be difficult, inconvenient or inefficient. There are also issues with co-simulation performance and file handling.

Creating custom plant models is another method. This requires writing custom code to implement the plant model, which can take time and is often difficult to debug.

Another option is to model the entire plant within the control design environment. This requires the user to derive dynamic equations and create equivalent block diagrams. This can be very difficult, especially as the number of degrees of freedom and their corresponding equations of motion grow. It should also be stated that deriving equations of motion is anything but trivial for all but the simplest of models.

For example, Figure 1 shows a simple mechanical system: a double pendulum. To create a model of the pendulum, it is first necessary to derive the differential equation that governs its motion. This equation is shown in Figure 2. Using this equation, it is possible to convert it into the block diagram model within the Simulink interactive graphical environment in Figure 3 that can be used in developing a control system. This is a mathematical model rather than a physical model and is an example of how time consuming it would be to model complex mechanical systems.

New approach for developing accurate plant models

Recent advances in modelling software now provide a simulation environment supporting the construction of high-fidelity, non-linear plant models. These new capabilities support the modelling of rigid-body mechanical plants using a graphical representation of bodies, joints, coordinate systems and constraints, as shown in Figure 4. This is a physical model, each mechanical component (ie, a joint) has a corresponding block in the diagram.

The physical model and the SimMechanics block diagram representation have a direct correspondence. Each includes a ground block, two body blocks (Arm 1 and Arm 2) and two revolute joints (Joint 1 and Joint 2). Sensor blocks, actuator blocks and display blocks can be used to link the physical model to dynamic signals and modelling capabilities within a single design environment.

The SimMechanics software creates the motion equations automatically and lets the engineer work with common properties, such as mass and inertial properties of bodies, kinematics constraints, forces and torques and measurement of the resulting motions and forces. The resulting models can be fully simulated and then automatically converted into efficient C code for hardware-in-the-loop simulation to support embedded controller testing.

A more complex plant model example

This more practical example relates to the development of a guidance and control system for a helicopter. Although this helicopter model is simplified, it contains enough realistic features to present a challenging design problem. There is a main rotor above the cabin that rotates about a vertical shaft. The tail rotor is mounted on a boom that extends to the rear and rotates in a vertical plane. The helicopter can be modelled as three rigid components: a two-blade main rotor, a tail rotor and the helicopter body. Standard helicopter control actuators will be used to adjust lift, pitch, roll and yaw.

Rather than attempting to specify its equations of motion, the engineer can model the helicopter using the approach discussed in the previous section. In Figure 5, the blocks model the physical components of the helicopter and the mechanical joints between them, as well as actuators and sensors for controlling and monitoring operation.

The blocks represent the fixed Earth coordinate system, the three rigid bodies constituting the helicopter model, the joints connecting the two rotors to the body, subsystems (lower-level diagrams) that drive both the rotors at constant angular rates and other blocks that allow forces and moments to be applied to the helicopter body, main rotor and tail rotor.

Using the helicopter model, the required control systems can be designed and simulated. After the controllers are designed, the next step is the thorough testing of the software in a realistic environment. Code is generated directly from the controller model and run on a rapid prototyping system or prototype embedded system. This controller prototype can be used to operate the helicopter in its intended environment. In many cases this is not feasible, however, because a prototype physical plant does not yet exist at the time the code is ready for testing. This can lead to integration and project delays.

Hardware-in-the-loop testing of plant models

Hardware-in-the-loop (HIL) simulation provides an alternative testing capability. This approach combines the system's control software executing on embedded hardware (or an equivalent rapid prototyping system) with real-time simulation of the plant and its operational environment. The HIL simulation uses the same I/O interfaces to connect the embedded processor to the simulated plant that would be used to interface to the actual physical plant.

Figure 6 illustrates the application of Model-Based Design, with the controller model connected to the plant model for testing using simulation. Simulated inputs and display of results test the operation of the models. Automatic code generation is used to convert the controller model to C code that runs on a real-time rapid prototyping system or on the production embedded system. The same code generation process converts the plant model to run on the real-time HIL system described here.

The plant model used in the HIL simulation must be of sufficient fidelity to enable realistic testing of the embedded software under all significant modes of operation to accurately determine the system's behaviour. The modelling approach described provides that fidelity.

Complex rigid-body mechanical plants can be accurately described and simulated using graphical models. These models can then automatically be converted into efficient C code for hardware-in-the-loop simulation. The ability to model and simulate mechanical plants and then generate real-time code for testing provides an important new capability for improving embedded controller design.

* Mike Dickens and Terry Denery are technical marketing managers for The MathWorks. You can email them about this article at de-feedback@helmers.com

Related Articles

Collaborative robots: the smarter way forward

Robots that can work side by side with humans are changing the way manufacturing is done.

AOG bringing the best of the best to Perth in 2015

With more than 620 companies queuing up to participate in this year's annual Australasian Oil...

Understanding data storage technologies

With the growing amounts of data being stored by industrial organisations today, understanding...


  • All content Copyright © 2024 Westwick-Farrow Pty Ltd