Expressions > Syntax rules

Variables in expressions

Variables are only used in expressions for the Calc/Logic Function block. You can simplify complex calculations by using variables to temporarily store values. The following examples show how variables can be used in a Calc/Logic block.

Some keywords are reserved for DeltaV expressions and cannot be used as local variable names.

From the above information, it is apparent that variables do not have to be declared. They are assumed to be variables because of the absence of quotation marks ("…","…") around their names. Variable names are not case sensitive.

All variables are floating point numbers. The value of a variable is retained from one scan to the next. The initial (first scan) value of a variable is zero.

The scope/visibility of variables is limited to the Calc/Logic function block in which they exist.

Option Explicit; (* This is optional.*)
VAR (* Used to declare local variables *)
    T63;
    T64;
    T17;
    T18;
END_VAR;
T63 := .5;
T64 := -15.803;
T17 := SIGN(T63);
T18 := SIGN(T64);
T62 := 88; (* This will give an error with the option explicit, since no T62 declared; otherwise no error is flagged. *)