Chapter 2
C Language Reference
©
National Instruments Corporation
2-25
properly. Refer to the
SystemBuild User Guide
for an explanation of
rinfo
. Only the first four elements of this array will be used by the
generated procedure. This array will be passed as argument
rinfo
.
3.
Create an array sized by the number of inputs in the procedure (refer to
the comment) of type
double
and copy in the inputs to the procedure.
This array will be passed as argument
U
. Also create a variable of type
int
and initialize to the number of inputs in the procedure. A pointer
to this variable will be passed as argument
NU
.
4.
Create an array sized by the number of outputs in the procedure (refer
to the comment) of type
double
where the outputs of the procedure
will be stored. This array will be passed as argument
Y
. Also create
a variable of type
int
and initialize to the number of outputs in the
procedure. A pointer to this variable will be passed as argument
NY
.
5.
Create two arrays sized by the number of states in the procedure (refer
to the comment) of type
double
and initialize all elements to 0.0.
These arrays will be passed as arguments
X
(states) and
XD
(derivatives). Also create a variable of type
int
and initialize to the
number of states in the procedure. A pointer to this variable will be
passed as argument
NX
.
6.
Create two arrays sized by the number of integer and real parameters
in the procedure. Refer to the comment of types
int
and
double
and
initialize all elements to 0 and 0.0, respectively. These arrays will be
passed as arguments
I_P
and
R_P
.
7.
Invoke the procedure using the arrays and pointers to the variables
created in steps 1 through 6.
Invoking Procedures Using Generated Subsystem
Function
When generating a reusable procedure from a Procedure SuperBlock, along
with the algorithmic procedure and the (UCB-style) wrapper, a subsystem
function (
subsys_
number
) also is generated. You can use the subsystem
function directly from your application to invoke the procedure, but keep
in mind that this function is not re-entrant, as several variables in this
function are declared static to avoid the overhead of copy in and out of the
variables.
All of the following arguments need to be passed for each call to the
procedure in the following order:
U
,
Y
. These arguments are pointers to
structures reflecting the procedure’s inputs and outputs. The inputs to the
subsystem are provided by the argument
U
, a pointer to a structure named
_Subsys_
number_in
(or
_Sys_ExtIn
). This structure has mixed