VXI VT1422A User Manual

Page 245

Advertising
background image

VT1422A Command Reference 243

Chapter 7

ALGorithm

If <alg_name> has been enabled to swap (originally defined with the <swap_size>
parameter included) then the <alg_name> can be re-defined (do not include
<swap_size> now) either while the module is in the Trigger Idle State or while in
Waiting-For-Trigger State (INITed). Here <alg_name> is an algorithm name only,
not 'GLOBALS'.

OK
*RST
ALG:DEF 'ALG3',200,'if(O108<15.0) O108=O108 + 0.1; else O108 = -15.0;'

INIT

starts algorithm

ALG:DEF 'ALG3','if(O108<12.0) O108=O108 + 0.2; else O108 = -12.0;'

ALG:UPDATE

Required to cause new code to run

"No error"

Error
*RST
ALG:DEF 'ALG3',200,'if(O108<15.0) O108=O108 + 0.1; else O108 = -15.0;'

INIT

starts algorithm

ALG:DEF 'ALG3',200,'if(O108<12.0) O108=O108 + 0.2; else O108 = -12.0;'
"Algorithm swapping already enabled; Can't change size"
Because <swap_size> included at re-definition

Notes

1. Channels referenced by algorithms when they are defined are only placed in

the channel list before INIT. The list cannot be changed after INIT. If an
algorithm is re-defined (by swapping) after INIT and it references channels
not already in the channel list, it will not be able to access the newly
referenced channels. No error message will be generated. To make sure all
required channels will be included in the channel list, define <alg_name> and
redefine all algorithms that will replace <alg_name> by swapping them
before INIT is sent. This insures that all channels referenced in these
algorithms will be available after INIT.

2. If an algorithm is redefined (by swapping) after INIT and it declares an

existing variable, the declaration-initialization statement (e.g.,

static float my_var = 3.5

) will not change the current value of that

variable.

3. The driver only calculates overall execution time for algorithms defined

before INIT. This calculation is used to set the default output delay (same as
executing ALG:OUTP:DELAY AUTO). If an algorithm is swapped after
INIT that take longer to execute than the original, the output delay will behave
as if set by ALG:OUTP:DEL 0, rather than AUTO (see ALG:OUTP:DEL
command). Use the same procedure from note 1 to make sure the longest
algorithm execution time is used to set ALG:OUTP:DEL AUTO before INIT.

Advertising
This manual is related to the following products: