cvar
Purpose:
-
Create and initialize variables in the CyFlex system from the command line or scripts, supporting data types such as REAL, INT, LOGICAL, and STRING.
Enter:
-
For REAL: cvar REAL <label> <initial_value> [units] [resolution]]
For INT: cvar INT <label> <initial_value> [units]]
For LOGICAL: cvar LOGI <label> <initial_value> [true_event_name] [false_event_name]]
For STRING: cvar STRING <label> <initial_value>
Where:
-
label
Specify the variable label to be created.
initial_value
Specify the numeric value to which the variable will be set when created.
units
Optional. Specify a valid CyFlex units string. The default is none.
resolution
Optional. Specify the display resolution.
true_event_name
Optional. Specify the name of an event that will be set when the variable value transitions from FALSE to TRUE.
false_event_name
Optional. Specify the name of an event that will be set when the variable value transitions from TRUE to FALSE.
event_name
Optional. Specify a transition event name which will be set if the string value is changed.
Examples:
-
REAL variable Example:
Enter: cvar REAL xyz 100 psi 2
The preceding creates a real variable named “xyz” and set the units to [psi] and the initial value to 100[psi] and the display resolution to 2 places.INTEGER variable Example:
Enter: cvar INT my_int 99 none
The preceding creates an integer variable named “my_int” with an initial value of 99 and the units string of none.LOGICAL variable Example:
Enter: cvar LOGI pump ON pump-turned-on pump-turned_offThe preceding creates a logical variable named “pump” with initial_value ON, true_event_name “pump_turned_on”, and false_event_name “pump_turned_off”.STRING variable Example:
Enter: cvar STRING my_name ‘Joe Random’The preceding creates a string variable named “my_name” and sets the value to ‘Joe Random’.
Notes:
Variables created with cvar can only be updated if they are owned by cvar and of the same type.
Ensure the variable does not already exist or matches the specified type.