Chapter 5 Generated Code Architecture
AutoCode Reference 5-8 ni.com
Discrete Subsystem Interface LayerThis layer comes in two variations to allow for both an optimized and
general solution. The external interface to a discrete subsystem is
represented by two structures, one representing the subsystem external
inputs and the other the subsystem external outputs. These structures are
generically referred to as the U-structure for the inputs and Y-structure for
the outputs. Within the subsystem, pointers to the U and Y structures are
defined as formal parameters to the subsystem procedure with the names U
and Y, respectively.
Single-Rate SystemA single-rate system, (that is, a system that contains only one subsystem
and no disconnected signals) is optimized to eliminate extra copies of the
external input/output data from the System interface. Therefore, a
single-rate model uses the System external inputs as the subsystem’s
external inputs, and the subsystem’s external outputs as the System’s
external outputs.
Multi-Rate SystemA multi-rate system represents the general case for external input and
output data. In a multi-rate system, a particular subsystem output might be
used by other subsystems or might be an external system output or some
combination. AutoCode minimizes the connections between subsystems
and the system external output. To accomplish this, AutoCode must
rearrange the ordering of members within the U and Y structures, as
opposed to the order being maintained in the single-rate case.
Sample and HoldA property of a multi-rate model is the concept of sample and hold. This
refers to the capturing (holding) of the input data of a subsystem until it
completes. For example, in Figure5-1, assume subsystem 1 executes at
ar ate of 0.1 (10Hz) while subsyst em 2 executes at 0.2 (5 Hz). Each
subsystem depends on the other for 1 input. Given that subsystem 1
executes twice as fast as subsystem 2, the output of subsystem 1, used by
subsystem 2, changes during subsystem 2’s execution. This means that
ift here were no sample and hold, subsystem 2 could potentially compute
values using different values at different times during the execution of the
subsystem. This non-determinacy can produce unexpected results.