National Instruments AutoCode NI MATRIX User Manual

Page 75

Advertising
background image

Chapter 3

Ada Language Reference

© National Instruments Corporation

3-13

AutoCode Reference

The operations within UCBs are controlled by the

INFO

argument, a record

of

RT_STATUS_RECORD

type that is passed as part of the argument list for

each UCB:

type RT_STATUS_RECORD is

record

ERROR: RT_INTEGER;

INIT: RT_BOOLEAN;

STATES: RT_BOOLEAN;

OUTPUTS: RT_BOOLEAN;

end record;

The following example shows the general form of UCB equations and
indicates how the

INFO

status record is used to control the computations.

if INFO.INIT then

-- do user code initialization

INFO.INIT := FALSE;

end if;

if INFO.OUTPUTS then

-- do output calculations having the general form:

-- Y := h(T,X,XD,U,R_P,I_P);

end if;

if INFO.STATES then

-- do state update calculations with the general form:

-- XD := f(T,X,XD,U,R_P,I_P);

end if;

When an error occurs within the UCB, set

INFO.ERROR:=

some nonzero

integer value as an error return. Also, make sure that

INFO.INIT

is set to

FALSE at the end of the initialization cycle.

To link UCBs (either handwritten or generated) with generated scheduled
subsystem code, compile the UCBs, required

sa_*

files, and the generated

scheduled subsystem code and link them together to build an application.

I_P:in out

RT_INTEGER

An array of integer parameters.

NIP:in out

RT_INTEGER

The number of integer parameters.

Table 3-5. UCB Calling Arguments and Data Types (Continued)

Argument

Data Type

Description

Advertising