Chapter 5
Generated Code Architecture
©
National Instruments Corporation
5-9
This sample and hold mechanism guarantees deterministic behavior for all
possible connectivities and is implemented using a technique called double
buffering. Double buffering involves swapping of pointers.
Static Data Within Subsystems
The implementation of blocks within a subsystem might require persistent
data. This data can be characterized as look-up tables, parameter
information, as well as data needed to manage the scheduling of the
subsystem. The use of static data prevents subsystems from being safely
used as reentrant code.
iinfo
The
iinfo
is an array that contains flags that indicate the phase and error
condition of the subsystem. These are used by the scheduler. The phase
might be an initialization, output update, or state computation (INIT,
OUTPUT, and STATES, respectively). Error status is checked for during
the execution of the subsystem and, if a run-time error was detected, a flag
is set.
R_P and I_P
R_P
and
I_P
are static arrays used to store floating point (real) and integer
parameter data, hence their names. Many blocks require static data in the
form of look-up tables, hard-coded parameter data, and initial conditions.
This type of block-specific data from all blocks within the subsystem are
placed within the arrays, depending on the data type of the data. Notice that
fixed-point data is stored in separate arrays to maintain the proper data type
and eliminate data type conversion. It is important to realize that
R_P
and
I_P
data can change during the execution of a subsystem and that to
support a restarting capability on some hardware targets, the initial data is
preserved in a second
R_P
and
I_P
array that is only used for initialization.
You can disable the restart capability, which potentially can greatly reduce
the footprint of the object code.
State Data
Another category of data is specifically data related to the state of a block.
State data is differentiated because the semantics of state data are taken
from Control-System theory. Many of the standard blocks rely on the
semantics of state data to properly implement the block’s algorithm. State
data is managed within the subsystem and involves swapping pointers
representing the current and next states.