This new Simulink block allows the execution of Simulink models in real time. The blockset is actually composed by only one block, that has been realized using an S-function written in C++ language.
This blockset is based on the simple concept that, to make the Simulink run with a real-time temporisation, the cycle time (the time that Simulink needs to calculate a simulation step, that is function of the hardware and the OS in which Simulink is running) should be lower then the desired simulation step. If this assumption is not valid, no real-time simulation is possible, whichever is the applied scheduling method.
Obviously, this statement is not completely valid, for example if we suppose to work with a real-time OS, in which the scheduling can be fully controlled. Anyway, the Windows OS is not in this case, because it's a multitasking environment with a partial controllable scheduling approach. The only controllable feature of Windows is the possibility of assigning a greater priority to the running process. In this blockset, a block allows the selection of the preferred priority to assign to Simulink.
This blockset simply hold the execution of the Simulink simulation attached to the time flow, in the sense that, if the cycle time is lower then the simulation step, this block wait for the time needed to fill the simulation step, leaving the remaining CPU time to all the Windows Process that need it. This concept is very simple but effective.
Respect to the other products, the RT blockset doesn't use a separate OS or runs a RT kernel to provide an RT simulation. Another feature that may let you prefer this blockset is the lack of limitation that this block impose to the use of Win32 instruction in your C/C++ S-functions. This blockset may virtually cooperate with any Win32 or DirectX instruction. Personally, I tested the RTW version of this block (that will be soon available) even on WinNT Embedded, with interesting results.
The OS where this solution was first developed is Windows NT 4.0, then this blockset is based on the Win32 library timing functions and process control functions. The actual released blockset has been realized only for the Windows platform and has been tested on a Win2000 and WinME OS with different speed processors.
This blockset can be compiled also with Real Time Workshop, offering a greater protection respect to all other process than a Simulink model that runs inside Windows NT can guarantee.
To see more about this blockset and download the previous version for Matlab 5.3, 6.0 and 6.5, visit the following web page:
http://digilander.iol.it/LeoDaga, click on the "RT Blockset" link on the right of the page.
This page contains also much more informations about the use of the RT block.
The library is already on a tested stage, but debugging information from new users will be appreciated.
In the image, the behavior of the simulation during a delaying OS operation.
Leonardo Daga (2023). Real-Time Blockset 7.1 for Simulink (https://www.mathworks.com/matlabcentral/fileexchange/3175-real-time-blockset-7-1-for-simulink), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Now available even for Matlab 7.1 RTW External mode