Strings can be used in all types of expressions in the DeltaV system. The use of strings allows great flexibility when constructing or selecting parameter reference paths in internal, external, and dynamic reference parameters.
A reference parameter/field can be assigned a string constant or a string variable. String constants are enclosed in quotation marks (" "). String variables are enclosed in single quotes (' ').
Strings referring to module names and associated paths must always use uppercase letters.
Supported string functions are described below.
String Assignment — A string constant can be assigned to a parameter/field. For example:
'OUTLET_POS.$REF' := "VLV1004/AO/OUT.CV"; 'OUTLET_POS.$REF' := ""; // empty string constant
A string parameter/field can be assigned to another string parameter/field. For example:
'TEMPSTR2.CV' := 'TEMPSTR1.CV'; 'OUTLET_POS.$REF' := 'TEMPSTR2.CV';
A named set string value can be assigned to a string parameter/field. For example:
'STRING.CV' := 'NAMED_SET.CVS';
Numeric Value to String Conversion — If the right side of the assignment evaluates to a numeric value and the left side of the assignment is a string parameter, the numeric value is converted to a string, and the string is assigned.
String to Numeric Value Conversion — If the right side of the assignment evaluates to a string value and the left side of the assignment is a numeric parameter, the string is converted to a float, which is then converted to the type of the numeric parameter.
String Comparison Using Relational Operators — Two relational operators, equal (=) and not equal (!=), can be used to compare string parameter/fields or string constants, as in the following:
IF ('OUTLET_POS.$REF' = "VLV1004/AO/OUT.CV")
THEN …
IF ("VLV1004/AO/OUT.CV" != 'OUTLET_POS.$REF')
THEN …
IF ('TEMPSTR2.CV' = 'TEMPSTR1.CV')
THEN …
IF ('TEMPSTR2.CV' != 'TEMPSTR1.CV')
THEN …
Other relational operators are not supported for string comparison.
String Concatenation — The full path is constructed from a partial path string (for example, a module name) and concatenated with a another string (such a string constant) using a plus operator (+). For example:
'OUTLET_POS.$REF' := 'MODULE.CV' + "/PID/SP.CV";
Strings written from expressions are limited to 256 characters. The software does not check if the limit is exceeded and no messages appear. You must ensure that strings written from expressions are no longer than 256 characters.
If one of the terms is a string and the other is numeric, the numeric term is converted to a string and the two strings are concatenated, resulting in a string. For example:
'TEMPSTR.CV' := "FIC"; 'TEMPNUM.CV' := 105; 'TEMPSTR2.CV' := 'TEMPSTR.CV' + 'TEMPNUM.CV'' IF 'TEMPSTR2.CV' = "FIC105" THEN // would be true
String Selection Function (SELSTR) — The SELSTR function allows selection from up to five string constants or string parameters, based on an input to the string selection function. It is intended to take the place of a series of IF…THEN statements and temporary string parameters.
SELSTR takes float one term (expected to hold an integer value) and five string terms (usually string constants), returning a string that corresponds to the value of the float term:
Float Value |
String Returned |
|---|---|
<1.0 |
empty string |
>= 1.0 and <2.0 |
first string parameter |
>= 2.0 and <3.0 |
second string parameter |
>= 3.0 and <4.0 |
third string parameter |
>= 4.0 and <5.0 |
fourth string parameter |
>= 5.0 and <6.0 |
fifth string parameter |
>=6 |
empty string |
For example:
'OUTLET_POS.$REF':= SELSTR('SEL.CV',
"FIC101",
"FIC102",
"FIC103",
"",
"") + "/PID1/SP.CV";