Specifications

Defined Input and
Output Channels
An algorithm “references” channels. It can reference input or output channels. But,
in order for these channels to be available to the algorithm, they must be “defined.”
To be “defined,” an SCP must be installed and an appropriate SOURce or
SENSe:FUNCtion must explicitly (or implicitly, in the case of VT1531A/32A and
VT1536A SCPs) be tied to the channels. If an algorithm references an input
channel identifier that is not configured as an input channel or an output channel
identifier that is not configured as an output channel, the driver may generate an
error when the algorithm is defined with ALG:DEF.
Defining and
Accessing Global
Variables
Global variables are those declared outside of the main() function and any
algorithms (see Figure 4-1). A global variable can be read or changed by any
algorithm. To declare global variables, use the command:
ALG:DEF ‘GLOBALS’,’<source_code>
where <source_code> is Algorithm Language source limited to constructs for
declaring variables. It must not contain executable statements. Examples:
declare single variable without assignment;
ALG:DEF ‘GLOBALS’,’static float glob_scal_var;’
declare single variable with assignment;
ALG:DEF ‘GLOBALS’,’static float glob_scal_var = 22.53;’
declare one scalar variable and one array variable;
ALG:DEF ‘GLOBALS’,’static float glob_scal_var, glob_array_var[12];’
Global variables are accessed within an algorithm like any other variable.
glob_scal_var = P_factor * I108;
NOTES 1. All variables must be declared static float.
2. Array variables cannot be assigned a value when declared.
3. All variables declared within an algorithm are local to that algorithm. If a
variable is locally declared with the same identifier as an existing global
variable, the algorithm will access the local variable only.
Determining
First Execution
(First_loop)
The VT1419A always declares the global variable First_loop. First_loop is set to 1
each time INIT is executed. After main() calls all enabled algorithms, it sets
First_loop to 0. By testing First_loop, the algorithm can determine if it is being
called for the first time since an INITiate command was received. Example:
The Algorithm Language and Environment
Accessing the VT1419A’s Resources
Chapter 4 111
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com