Limitation for Database Item Names Referenced in Logic Programs

If a database item's name includes parentheses ( ), each opening parenthesis needs to be paired with a closing parenthesis. If this is not the case, any Logic programs that reference the database item will not compile successfully.

Example:

The following ST program refers to a digital point named "Digital Point (4". Observe that the point's name includes a single opening parenthesis.

PROGRAM STProgramExample

VAR

CU_IN AT %M(.Digital Point 1.CurrentValue): BOOL;

CD_IN AT %M(.Digital Point 2.CurrentValue): BOOL;

R_IN AT %M(.Digital Point 3.CurrentValue): BOOL;

LD_IN AT %M(.Digital Point (4.CurrentValue): BOOL;

END_VAR

When the program compiles, the following is displayed in the output panel:

Compile error: at line: 6, column: 10; <direct variable> expected.

To avoid a situation such as that described in the example above, it is recommended that you rename any referenced database items to remove all occurrences of an unpaired parenthesis. In the example above, you could rename "Digital Point (4" to "Digital Point 4" or "Digital Point (4)". Multiple sets of parentheses will also compile successfully, including nested parentheses. For example, a Logic program can refer to a database item named "Digital Point (4)(x)" or "Digital Point (4(x))".

If it is impractical to change a database item's name, you can use another logic program to call the item's name, and then pass it as a parameter.

Example:

The ST program from the example above is modified to declare an input variable named "PointName". The point name "Digital Point (4" is then replaced with {PointName}.

PROGRAM STProgramExample

VAR_INPUT

PointName : STRING;

END_VAR

VAR

CU_IN AT %M(.Digital Point 1.CurrentValue): BOOL;

CD_IN AT %M(.Digital Point 2.CurrentValue): BOOL;

R_IN AT %M(.Digital Point 3.CurrentValue): BOOL;

LD_IN AT %M(.{PointName}.CurrentValue): BOOL;

END_VAR

The execution interval for this ST program is set to zero (0).

A new ST program is created that passes the object name "Digital Point (4" as a string.

PROGRAM STProgramCalling

METHOD

ExecuteLogic AT %M(.STProgramExample.Execute) : STRING;

END_METHOD

ExecuteLogic('Digital Point (4');

END_PROGRAM

The execution interval for this ST program is set to 10 seconds.


Disclaimer

Geo SCADA Expert 2019