Guy on Simulink

Simulink & Model-Based Design

Normal Mode Simulation in Real Time

In R2012a, Real-Time Windows Target offers two modes for executing Simulink models in real time: The classic External Mode and the new Normal Mode.

External Mode vs. Normal Mode

In external mode, Simulink Coder is used to dynamically link generated algorithm code with generated hardware driver code. The resulting executable runs in Windows kernel mode and communicates with Simulink via External Mode.

In normal mode, the algorithm runs in Simulink and the I/O drivers run in a separate Windows kernel mode process that maintains the real-time clock.

The following diagram illustrates the difference between these two modes:

Comparison between external and Normal Mode

Advantages of Normal Mode

As you can guess based on the above diagram, normal mode offers lower performance when compared to external mode. On the other hand, normal mode offers interesting advantages:

You can also use Normal Mode on Windows 64-bit, where External Mode is only supported in Windows 32-bit as of R2012a.

How does that work?

Most blocks in the Real-Time Windows Target library have at least 2 parameters: Sample Time and Maximum missed ticks.

Dialog of the Real Time Synchronization block

Since, in normal mode, only the I/O drivers are synchronized with the real-time clock, it is possible for the simulation to miss clock ticks. When this happens, the Maximum missed ticks parameter determines how your model should behave. Set it to a value of zero if you want your model to error out at the first missed tick. Use a larger value if your application can deal with a few missed ticks. Note that, if the model misses a few ticks, it will resynchronize with the real-time clock as soon as possible.

Now it's your turn

Do you think Real-Time Windows Target normal mode will be useful for you? Leave a comment here.

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.