Chapter 5 Generated Code Architecture
AutoCode Reference 5-42 ni.com
representative of a sequence of equations. These equations are sensitive
(that is, potentially numerically unstable) to the integration algorithm and
order in which the equations are computed. Introducing multiple
continuous subsystems or procedures introduces arbitrary boundaries
within the equation sorting that can affect the stability of the total system.
Another reason for having only a single continuous subsystem is to
minimize the complexity of the integration algorithm.
Explicit PhasesAs in a discrete subsystem, a continuous subsystem also has an Init, Output,
and State phases. However, after comparing the code generated for the
different subsystem types, you will see that there are explicit guards
protecting each phase within the continuous subsystem. This is required
because each of the phases might be called more than one time for a
particular time point and independently from each other.
IntegratorA continuous subsystem does not have a period rate to be executed. Rather,
we use a continuous sampling rate (CSI) to indicate the frequency of the
computation of the continuous subsystem. In a real-time environment, you
must make sure the CSI is large enough to account for computation delay.
The scheduler uses the CSI to pass control over to an integrator. The
integrator is responsible to call the continuous subsystem for each state
computation of the integration algorithm.
LimitationsThe following is a summary of limitations of the generated code for a
continuous subsystem.
• Only fixed-step integrators are supported.
• There is a slight mismatch between SystemBuild Simulation results
and AutoCode simulation results. AutoCode does not interpolate the
inputs between the explicit time in the time-vector (t) and the time
(t+h), where h is the integration interval. AutoCode integrators keep
the inputs constant at those points.
• States and derivatives within a continuous subsystem are always
RT_FLOAT data type, which is usually defined within the Stand-Alone
Library as double-precision.