Hardware in the Loop (HIL)

Fernando Carbonero, EcosimPro/PROOSIS

Hardware In the Loop

The Hardware In the Loop concept (hereinafter, HIL), refers to the including of physical devices (hardware) into the simulation process. A typical example would be the simulation of a plant using software that would be controlled by a real physical controller, i.e., the same one that would perform this duty in the actual plant. This allows, for example, validating a control system without putting the plant or the lives of its workers at risk.

The concept may or may not be associated with the concept of Real-time (RT). We can imagine many processes in which a momentary loss of control would not affect the result. For example, the control of the temperature in a blast furnace has such a high time constant that any loss of the control process for a few seconds would have a negligible effect. However, loss of control during the take-off of an aircraft for even the shortest period of time could be catastrophic.

Moreover, in the case of the blast furnace, we would probably wish to speed up the simulation with respect to real time, to be able to study in just a few minutes the behaviour of several process hours; indeed, waiting several hours to perform different tests of the controller would not make much sense.

diagrama_ni

An EcosimPro / PROOSIS model in Simulink

A new Simulink S-Function that allows connecting a PROOSIS model has been implemented in the new version of PROOSIS 3.4.14, and will soon be implemented in EcosimPro. This functionality is on top of the connections to MATLAB that already exist in the program, although it has special characteristics.

One of the goals is to be able to use the PROOSIS model totally independent of the MATLAB one. To do this, we start with an encapsulated model in a DECK. This, in and of itself, offers a number of advantages:

• All the files needed to run the model are grouped in the DECK.

• The model input files are encrypted, thus preserving their security. Furthermore, they can be packaged inside the compiled model, thus making it easier to export them to Real-time environments where file readings are not allowed.

• The input and output variables selected will be the only ones visible in S-Function, and therefore, the MATLAB user will be get a simple model.

• Variables that have not been declared as input or output are hidden from the MATLAB user, thus making it possible to hide confidential or sensitive information.

The S-Function can perform the calculations continuously or discretely. Discrete calculation would be used in Real-time. Communication is established each time the integrator has to evaluate the residual function. This is important when variable step or multi-step integrators (like RK4) are used, as it increases the accuracy of the results.

The entire S-Function preparation process is done comfortably and quickly using dialogs. The final result includes a basic Simulink schematic that can be worked with immediately or that will facilitate the work of the MATLAB modeller.

HIL_esquema_simulink

Real Time Devices of National Instruments

A Real-time model has to be run on a specific hardware. This hardware is prepared to ensure the correct connection and synchronization of the model with the real plant, if there is one, monitoring that all maximum time limits are met (the model could be too heavy in processing time to be run on the hardware, and thus would be invalid from the real-time perspective).

A large number of real-time devices are available on the market. Each has its own requirements from the point of view of model programming. The first platform to which the mathematical kernel of the PROOSIS model has been adapted is that of National Instruments. Specifically, this implementation would work with the hardware that works with the Phar Lap operating system.

Thanks to National Instruments’ Veristand application, the PROOSIS model can be pre-evaluated in an all-software environment before it is transferred to the physical device.

Other platforms will be included in the future.

Conclusion

A new functionality has been created for the integration of a PROOSIS model into a Simulink model by way of a new S-Function. This achieves enhanced data integration and reliability with respect to previous connections.

The S-function has been designed to facilitate the use of the resulting Simulink model in a real-time environment.

It is now possible to carry PROOSIS models to Real Time Devices of National Instruments with the Phar Lap operating system.

Diagrama_HIL