svar

Purpose:

Set the value of a variable or list of variables.

Only REAL, REAL_ARRAY, INTEGER, INTEGER_ARRAY, LOGICAL, LOGICAL_ARRAY, STRING, and STRING_ARRAY variable types are supported. COMPOSITION, PROPERTY, STATISTICAL and EMISSION types cannot be set with this command.

Note that there are many optional ways to express the value, such as a constant, variable label, or computed expression. Special consideration is given to certain cases of REAL variables:

  1. Changing the value of the “Cell_meter” hour meter value is not allowed.
  2. Changing the value of the “PAM_point” variable is not allowed. Use the “setPAMpoint” command to do this.
  3. If you set the value of a counter (CI) channel or a Gantner counter channel from a 2143 module, a message is sent to the transfer layer task so that this new value can be ‘synchronized’ to the current raw data value from the input channel.

In version CyFlex.6.2 and newer releases, dimensional consistency checking has been added.

Enter:

svar <variable_label> <value>
svar <label1> <value1> label2 value2 label3 value3 …
  (etc. list of variable_label,value pairs)
svar <filename>
svar <       stdin_file      

Where:

filename

Specify a text file containing an indefinite number of lines, each containing a label, value pair of entries. All the options for ‘value’ described below are supported in the file entries. This form, where the argument is NOT a redirected stdin, may contain #comment lines, blank lines, etc., similar to a normal CyFlex spec file.

stdin_file

Specify a text file containing an indefinite number of lines, each containing a label, value pair of entries. All the options for ‘value’ described below are supported in the file entries. When the input file is stdin_file, #comment lines and blank lines are not ignored and will produce an error.

variable_label

Specify the label of the variable to be modified. A CSAR variable label may also be specified.

value

The value to which variable is set.

For REAL or REAL_ARRAY variables, the value may be expressed in 4 different ways.

  1. As a number where the units are assumed to be the same units as the target variable.

    Example: svar engine_hrs 13.5

    The above command sets the hour meter to 13.5 hours

  2. As a number with concatenated units. The value will be converted to the units of the target variable.

    Example: svar engine_hrs 1[sec]

    Assuming that engine_hrs variable has units of [hr], the result will be .0064[hr]

  3. As a variable label

    Example: svar engine_hrs test_hrs

    The value of the test_hrs variable will be copied to the engine_hrs variable with appropriate units conversion

  4. As a computed expression

svar engine_hrs “test_hrs + 1[min]”

The quoted expression will be evaluated and the result will be placed in the engine_hrs variable with appropriate units conversion.

For INTEGER variables, the value may be entered as a decimal or hex number. Both below commands have the same result.
svar  count 16
svar count 0x10

For LOGICAL variables, the value may be entered in any of the following forms:

TRUE, ON  (not case sensitive)
FALSE, OFF (not case sensitive)
state_description

svar water_value  On
svar  water_value  false
svar  water_value  Open

In the last case, the string “Open” is assumed to match the “true_desc” field used when the variable was created.  See the example output from the “gvar” command below.  The true and false descriptions can also be obtained from the ‘dumpit’ command.

gvar water_valve
water_valve is OFF which is ‘Closed’ with status = NO, mem.index=33

‘Closed’ is the “false_desc”

 

Example:

See above descriptions for Enter and Where.

Notes:

The svar command sets the value of the specified variable in the units of the specified variable.

Some variables have their values continuously updated by another CyFlex process, which can overwrite any value set with this command. Analog inputs are an example of variables in this category. The ‘gvar’ command will show the name of the last process which modified the variable value.

See Also:

gvar, dumpit. Array Variables