ST Programs
Structured Text is a high level programming language that you can use to define the relationships between values.
ST programs can consist of:
- Variables—Input and output values that can change. There are also internal variables which are values that are only used within the ST program. For example, an ST program can read the value of an input (such as the value from a property of a database item), use an internal value to perform a calculation on the input value, then write the result of the calculation to an output value.
- Constants—These are special types of value that are used by the ST program. These values are fixed and cannot change (they are constant).
- Data Types—There are several types of value. You need to specify which type of value is applicable to each variable. For example, values such as descriptions are STRING values (they contain a string of characters) whereas values from analog points are REAL or LREAL values.
There are built-in data types, also referred to as literals, that you can use to define the type of a value. You can also use derived data types to apply meaningful names to values, group internal values, and form arrays etc.
- Methods—These are actions that can be performed by an ST program. For example, an ST program can be created to acknowledge an alarm when a specific condition occurs.
- Control Structures—Control structures are used to define the Logic of the ST program. By using keywords and adhering to the formatting rules, you can create a flow of conditions and results. These define the behavior that the ST program provides.
- Function Blocks—Function blocks are blocks of code that provide specific functionality, for example, convert a temperature in Celsius to a temperature in Fahrenheit. The function blocks can be used over and over again in each of your Logic programs, including ST programs.
To configure an ST program, you will need an appreciation of the Structured Text standard. As the ST programs are not graphical, some users find them more difficult to work with. However, you need to have an understanding of ST as you may need to use ST when working with Function Block Diagrams, Sequential Function Charts etc. This is especially true if you need to reference historic data or are using SQL queries.
We recommend that you familiarize yourself with the following sections, even if you do not intend to work with ST programs:
- Create an ST Program in the ClearSCADA Database
- Edit an ST Program
- Understanding the Basic Structure of an ST Program
- Statements, Expressions and Operators
- Entering a Comment
- Internal Variables
- Direct Variables
- Constants
- Historic Values in ST Programs
- Built-In Data Types
- Derived Data Types
- Setting the Default Values
- Executing Methods on Database Items
- Controlling the Flow of the Program
- Using an ST Program to Call an SQL Query
- Inserting, Updating, and Deleting Values by Using SQL in an ST Program
- Passing Multiple Parameters into an SQL Query in an ST Program
- Function Blocks in ST Programs
- Using Libraries in ST Programs
- Compiling an ST Program or ST Library
- Debugging an ST Program
- Viewing the Variables in your ST Program
By familiarizing yourself with some of the ST basics, you will find it much easier to understand the principles of the other types of Logic program.
For information on configuring the various properties of an ST program, see Logic Program Properties and Values.