Variables can be created and used freely within the script. The tags may also be used as variables (generic or associated with a equipment).
(To understand how to introduce the script in the SCADA software: Script – Introduction – Step 1)
There are two types of variables:
1 – Number
2 – String / Text
Initialize the variable as number.
The numeric variables can be set or calculated by the operators = + – * /.
Initialize the variable as text.
text1 =“Process running!”
Convert number to text: s = CStr(x)
Converts text to numbers: x = Val(s)
Text constants are set in quotation marks. Texts can be concactenados using + operator.
Example text concatenation: s=“Done” +CStr(x) + “Test (s).” (To use text variables in the command If use the operator ==. – See If expression)
The variable text can also function as memories or byte packets. They can be used to communication or processing of binary data. (see functions like BytesToStr)
= Associate. Ex: y=1
+ Sum. Ex: y=y+1
– Subtraction. Ex: y=y–1
* Multiplication. Ex: y=y*2
/ Division. Ex: y=y/2
= Associates. Ex: s=“Text”
+ Concatenate text. Example: s=s+“Text”