CAPL Script

SysSetVariableAsync

This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.

Syntax

void sysSetVariableAsync(SysVarName, byte data[], long size); // form 1

void sysSetVariableAsync(SysVarName, float value); // form 2

void sysSetVariableAsync(SysVarName, float values[], long arraySize); // form 3

void sysSetVariableAsync(SysVarName, long value); // form 4

void sysSetVariableAsync(SysVarName, long values[], long arraySize); // form 5

void sysSetVariableAsync(SysVarName, int64 value); // form 6

void sysSetVariableAsync(SysVarName, char value[]); // form 7

Function

Assigns the given value (data, value or values[]) to the system variable with identifierSysVarName. The bytes of data buffers are copied to struct, generic data and byte array system variables (form 1). The content of a character string is copied to String system variables (form 7). Floating point or integer numbers and arrays are assigned to the corresponding types of system variables (form 2 – 6). The assignment is executed asynchronously. Whenmeasurement setup parallelizationis activated, other branches in the measurement setup will see the new value earlier or later than the branch where the function is called. In contrast tosysSetVariable*functions,sysSetVariableAsyncdo not prevent a measurement setup branch from being parallelized.

Parameters

SysVarName System variable name.Must exist in the database.

data, value or values[] New value for the system variable (form 1, 2) or buffer with new data (form 3, 4).

size The number of bytes to be copied (form 1).

arraySize The number of elements to be copied (form 3, 5).

Return Values

—

byte dataBuf[64] =  {
  0
};
// Example variables must exist; adapt these values to your test setup.
sysSetVariableAsync(sysvar::Switch, 0);
sysSetVariableAsync(sysvar::Temperature, 22.5);
sysSetVariableAsync(sysvar::NodeName, "Master");
sysSetVariableAsync(sysvar::DiagData, dataBuf, 64);

Related reference: Direct access to values from system variables | putValueAsync