User`s guide

Run-time Architecture Overview
8-9
The program creates VxWorks tasks to run on the real-time system: one
communicates with Simulink, the others execute the model. StethoScope
creates its own tasks to collect data.
Host Processes
There are two processes running on the host side that communicate with the
real-time program:
Simulink running in external mode. Whenever you change a parameter in
the block diagram, Simulink calls the external link MEX-file to download
any new parameter values to the VxWorks target.
The StethoScope user interface module. This program communicates with
the StethoScope real-time module running on the VxWorks target to retrieve
model data and plot time histories.
VxWorks Tasks
There are two modes in which the real-time program can be run—singletasking
and multitasking. The code for both modes is located in:
matlabroot/rtw/c/tornado/rt_main.c
The Real-Time Workshop compiles and links rt_main.c with the model code
during the build process.
Singletasking. By default, the model is run as one task, tSingleRate.Thismay
actually provide the best performance (highest base sample rate) depending on
the model. See Chapter 7, “Models with Multiple Sample Rates,” for more
information on singletasking vs. multitasking.
tSingleRate Runs at the base rate of the model and executes all necessary
code for the slower sample rates. Execution of the
tSingleRate task is
normally blocked by a call to the VxWorks
semTake routine. When a clock
interrupt occurs, the interrupt service routine calls the
semGive routine,
which causes the
semTake call to return. Once enabled, the tSingleRate task
executes the model code for one time step. The loop then waits at the top by
again calling
semTake. For more information about the semTake and semGive
routines, refer to the VxWorks Reference Manual. By default, it runs at a
relatively high priority (30), which allows it to execute without interruption
from background system activity.