User`s guide

12 Execution Modes
Even a h ighly clocke d CPU is not likely to lead to an ov erflow of a 64 bit
counter (2^64 * 1e-9 (1 GHz CPU) = 584 years). The Pentium counter comes
with the following features:
Accurate measurements Because the counter counts up with the CPU
clock rate (~1 GH z nowadays), the accuracy of time me asurem ents even
in the microsecond range is very high, therefore leading to very small
absolute real-time errors.
No overflow Because the counter is 64 bits w ide , in p ractical use overflo w
does not occur, which m akes a CPU time expensive overflow handler
unnecessary.
No latency The counter resides on the CPU. Reading the counter value
can be d one within one CPU cycle, introducing almost no latency.
The p olling execution scheme does not depen d on any inte rrupt source to
notify the code to continue calculating the next model step. While this frees
the CPU, it means that any code that is part of the exclusively running
polling loop is executed in real time, even components, which have so far been
executed in background tasks. Because these background tasks are usually
non-real-time tasks and can use a lot of CPU time, do not execute them. This
isthemaindisadvantageofpollingmode. Tobeefficient,onlythetarget
application’s relevant parts should be executed. In the case of the xPC Target
software, this is the code that represents the Simulink model itself.
Therefore, host-target communication and target display updating are
disabled. Because polling mode reduces the features of the xPC Target product
to a minimum , you should choose it only a s the l ast possible alternative to
reach the required base sample time for a giv en model. Th ere fore, ensure the
following before you consider polling mode:
The model is optimal concerning execution speed First, you should
run t he m odel th r ou gh the Sim ulink profiler to find any possible speed
optimizations using alternative blocks. If the model contains continuous
states, the discretization of these states will reduce m odel complexity
significantly, because a costly fixed-step integration algorithm can be
avoided. If continuous states cannot be discretized, you should use the
integration alg orithm with the lowest order that still p roduces correct
numerical results.
12-6