Real-Time Workshop    

Executing Models in Real Time

A real-time program differs from a Simulink simulation in that the program must execute the model code synchronously with real time. Every calculation results in some computational delay. This means the sample intervals cannot be shortened or lengthened (as they can be in Simulink), which leads to less efficient execution.

Figure 8-5: Unused Time in Sample Interval

Sample interval t1 cannot be compressed to increase execution speed because by definition, sample times are clocked in real time.

Real-Time Workshop application programs are designed to circumvent this potential inefficiency by using a multitasking scheme. This technique defines tasks with different priorities to execute parts of the model code that have different sample rates.

See Multitasking and Pseudomultitasking for a description of how this works. It is important to understand that section before proceeding here.


  Building the Program for Singletasking Execution Singletasking vs. Multitasking Operation