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:
- Changing the value of the “Cell_meter” hour meter value is not allowed.
- Changing the value of the “PAM_point” variable is not allowed. Use the “setPAMpoint” command to do this.
- 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 [-f <format>] <variable_label> <value> svar <filename> svar < stdin_file svar [–updated_by </path/to/script>] <variable_label> <value>
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.
-f <format>
Enter a format specifier. The format string must be valid for the type of variable that is being set. Only int and real type general use variables are supported.
The format matching should be: %[flags][width][.precision][length]specifier
The ‘%’ and specifier are required.
Flags: 0, #, +, –
Width: number only, NOT *
Precision: number only, NOT .*
Length:
integers: h, l, j, z, tSpecifiers:
floating point: e, E, f, F, g, G, a, A
integers: d, i, u, o, x, XExample:
svar -f %10.4f myReal 12.345–updated_by </path/to/script>
This argument is intended to allow the application to override the variables field for the last process to update the variable. This can make it easier if a shell script is used to call svar on variables when troubleshooting.
Specify a string, which will often be a path to a script. The path needs to be 23 characters or less. If longer than 23 characters, only the first 23 characters of the script name will be used.value
The value to which variable is set.
For REAL or REAL_ARRAY variables, the value may be expressed in 4 different ways.
- 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
- 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]
- 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
- 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 0x10For LOGICAL variables, the value may be entered in any of the following forms:
TRUE, ON (not case sensitive)
FALSE, OFF (not case sensitive)
state_descriptionsvar water_value On
svar water_value false
svar water_value OpenIn 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”
- As a number where the units are assumed to be the same units as the target variable.
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.