Compiling an ST Program or ST Library

You can use the Build menu options to compile your ST program. The compilation feature is useful as it checks that your program has the correct syntax.

There are 2 compile options:

To compile an ST program or ST library:

  1. Display the ST program or ST library in Design mode.
  2. Select the Build menu, then select the Compile option or the Compile with Diagnostics option as required.
    The program or library is compiled and the compile messages are shown in the Compiler display.

    If there are syntax errors, you will need to alter the ST code. Typically, the causes of syntax errors are minor, such as the wrong type of value being specified or a missing semi-colon.

When you have successfully compiled your program, you can use the Debug option to check that its Logic defines the required behavior (see Debugging an ST Program).

If a database item's name includes parentheses ( ), you should ensure that each opening parenthesis is paired with a closing parenthesis. If this is not the case, any Logic programs that reference the database item will not compile successfully. For example, a point named "Analog Point (4" or "Analog Point (4))" will generate a compile error message. Multiple sets of parentheses will compile successfully, including nested parentheses. For example, a Logic program can refer to a point named "Analog Point (4)" or "Analog Point (4(x))". For more information, see Limitation for Database Item Names Referenced in Logic Programs in the Geo SCADA Expert Guide to Logic.

When you include SQL queries in ST programs, and use braces '{' and '}' within SQL statements, you should use the caret '^' escape character before each brace.

For example:

VAR NOCACHE

rsPoints AT %S(SELECT ID, CurrentValueFormatted, CurrentTime FROM CSIMPLEPOINT WHERE CURRENTTIME = ^{ OPC 'D' ^}): RESULTSET OF Point;

END_VAR

If you reference system status tags in your ST programs, you need to prefix the names of those system status tags with an additional caret '^' escape character. This escapes the reserved caret '^' character that is used at the start of the names of system status tags (also known as 'status attributes') (see Access System Status Information).

For example:

VAR

sServerStateTime AT %M(^^<server name>.ServerStateTime): DATE_AND_TIME;

END_VAR


Disclaimer

Geo SCADA Expert 2019