Real-time systems

What is Real-time system? 

Physical systems are continuous but controllers are digital or discrete. Imagine we want to control an internal combustion engine of a vehicle. In the engine control unit (ECU) the data is read from all the sensors (via DAC) with a specific sampling time. Control algorithm must finish its execution within the sample time. Therefore, each “step” of the control program must be started exactly one sample time or step size apart, and have to be finished the computation of each step within the sample time, i.e. before the next step starts, to send the processed data (via ADC) to actuators.





Figure 1: This diagram shows how a Digital control system for an engine management system is implemented using real-time system.






Figure 2: This diagram shows how Real-time control timing works, i.e. the execution of the program (initiated at time nT) must be finished before the start of the next program be initiated at time (n+1)T


Figure 3: dSPACE real-time simulator for emulation, test and optimisation of a control/plant model developed in Matlab/Simulink

Real-time simulation is the de facto engineering process for the development, test and validation of control systems in a variety of applications including but not limited to control and simulation of power electronic circuits, motor control, engine control, vehicle control, and robotics. There are two important steps in real-time implementation, Hardware-in-the-loop (HIL) simulation, and rapid control prototyping (RCP).


RCP is the design of control system when you simulate a model of the controller connected to an actual physical system (or plant). The image above illustrates the development process of a control system using RCP (read more in dSPACE website).
In Hardware-in-the-loop (HIL) testing, the process is the opposite where the control hardware (embedded implementation) connected to the simulated model of the physical plant. The image above shows the HIL test of a multi-cell battery pack using dSPACE system. Very useful material about real-time simulation, digital signal processing (DSP), HIL and RCP can be found in Mathworks website


Figure 4: this diagram shows how a battery management system can be tested using HIL in dSPACE.