Chapter 2
C Language Reference
©
National Instruments Corporation
2-13
Implementing Handwritten UCBs
Arguments are passed for each call to the UCB in the following order:
INFO, T, U, NU, X, XDOT, NX, Y, NY, R_P, and I_P
Pointers to all of the arrays (
U
,
X
,
XD
,
Y
,
R_P
,
I_P
) and scalers corresponding
to array sizes (
NU
,
NX
,
NY
) are passed to each call to the UCB. The sizes of
R_P
and
I_P
arrays must be entered into the UCB dialog to ensure that
proper storage is allocated by the caller. Also, the initial conditions for
states have to be specified in the dialog. Table 2-5 lists the type and purpose
of UCB arguments used in the fixed calling method.
Table 2-5.
UCB Calling Arguments and Data Types for the Fixed Interface
Argument
Data Type
Description
INFO
struct STATUS_RECORD*
A pointer to
STATUS_RECORD
structure
representing operation requests and status.
T
RT_DURATION
Elapsed time.
U[ ]
RT_FLOAT
An array (of size
NU
) of inputs to the UCB.
NU
RT_INTEGER
The number of inputs to the UCB.
X[ ]
RT_FLOAT
An array (of size
NX
) of state variables of
the UCB.
XDOT[ ]
RT_FLOAT
An array (also of size
NX
). Includes the next
discrete states of
X
for the discrete subsystems,
and the derivative of
X
for the continuous
subsystems.
NX
RT_INTEGER
The number of states (and next states).
Y[ ]
RT_FLOAT
An array (of size
NY
) of outputs from the UCB.
NY
RT_INTEGER
The number of outputs from the UCB.
R_P[ ]
RT_FLOAT
An array of real parameters.
I_P[ ]
RT_INTEGER
An array of integer parameters.