ST Programs
Structured Text (ST) 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.
There are also indirect variables that enable an ST program to perform calculations on tags that are specified at runtime. For example, you might use an indirect variable to read the value of a system status tag (also known as a 'status attribute').
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 may find them difficult to work with. However, you need to have an understanding of ST to use it 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.
For more information, see the topics that are listed in the gray footer section at the bottom of this topic. Select the relevant entry to display the topic that you require.
We recommend that you familiarize yourself with these sections, even if you do not intend to work with ST programs. By familiarizing yourself with the ST basics, you will find it easier to understand the principles of other types of Logic program.
You must have the required user permissions on the database items that a Logic program references, and (if applicable) the Configure Extended Logic feature enabled in order to successfully compile, execute, or save a Logic program (see User Permissions Required for Working with Logic Programs).
For information on configuring the various properties of an ST program, see Logic Program Properties and Values.