当前位置:首页 >> 机械/仪表 >>

ABB DCS 系统 培训课程 系列讲座 ST Language


Course T530

Chapter 9 Structured Text (ST) Language

9.1 General Information 9.1.1 Description
This chapter describes the use of the programming language ST.

9.1.2 Objectives
On completion of this chapter you will be able to: ? Use the ST Language.

9.1.3 Reference Documentation
In the Online help: Contents tab, Programming Languages > ST–Structured Text.

3BSE 022 850/A

9-1

Course T530 Chapter 9 Structured Text (ST) Language

9.2 Lesson 1 - ST Language 9.2.1 Description
This lesson describes the use of the ST Language.

9.2.2 Objectives
On completion of this lesson you will be able to: ? Use the ST Language.

9.2.3 General
Structured Text (ST) is a high-level programming language. It is highly structured and contains a comprehensive range of constructs for assignments, function/function block calls, expressions, conditional statements, iterations and more. One major advantage to other control programming languages is that the code is very simple to write and easy to read, because of its logical and structured layout. Tabs and spaces are used to structure the code for easy reading. Below is an example of code written in Structured Text to demonstrate the clearness and structure of this language.

9.2.3.1 Functions simplifying while editing
Press < Ctrl I > to insert Statement in the code pane or use the Press < Ctrl J > to insert declared variables in the code pane. button.

9-2

3BSE 022 850/A

Course T530

9.2.3.2 Using Microsoft Word
It is possible to write the code in Microsoft Word and then use the copy and paste function to move the code to the code pane if you are using the Structured Text editor.

9.2.4 Comments and the ABB extension
Comments can be inserted wherever it is acceptable to insert one or more spaces in the code. You can insert comments in the code by framing them with the characters (* and *) according to IEC 1131-3. You can not nest comments using this syntax. If you need to nest comments you can frame the comment with the characters (# and #). You can nest (*...*) comments inside (#...#) comments. This is useful for commenting out large blocks of code containing comments. Operator (*…*) (#…#) Description Comment according to IEC 1131-3. Comment that can be nested (ABB extension).

9.2.5 Instructions
The following basic instructions are available in the ST language.

9.2.5.1 Assign statements
Operator := () Description Assigns a value (number, logical or string) to a variable Parentheses. Commonly used to change the priority of an expression.

A variable is assigned a certain value with an assignment statement. If we wish the variable to take the value of Start we write: Run := Start; A statement is always concluded with a semicolon, ‘;’. As in mathematics, the parentheses are used to change the priority in which execution is performed. Parentheses have the highest order of precedence.

3BSE 022 850/A

9-3

Course T530 Chapter 9 Structured Text (ST) Language

9.2.5.2 Expressions
There are different kinds of expressions. They are Boolean Expressions (and, or, not, xor), Arithmetic Expressions (+, -, *, **, mod), Relational Expressions (=, >=, >, <=, <, <>). An expression produces a result. An expression contains operators, functions and operands. Operators may be +, -, /. Functions may be sin or cos. The operand can be a value, a variable, a function or another expression.

9.2.5.2.1 Boolean expressions
Operator NOT, AND & XOR OR Description Negates the Boolean value (1/0, on/off or True/False). Boolean AND. Boolean AND. See AND. Boolean XOR. Boolean OR.

Example of a Boolean expression: Activated := Start and not Stop;

9.2.5.2.2 Arithmetic expressions
Operator ** * / + MOD Description Exponential, i.e. raising to the power. Multiplication Division. Addition. Subtraction. Modulus.

Example of an Arithmetic expression: Value:= Value +1;

9-4

3BSE 022 850/A

Course T530

9.2.5.2.3 Relational expression
Operator < > <= >= = <> Description Less than. Greater than. Less than or equal to. Greater than or equal to. Equal to. Not equal to.

Under the headline Conditional Statements, is an example given with Relational Expressions.

9.2.5.3 Statements 9.2.5.3.1 Conditional statements
Operator if Description The if... then... elsif... else... statements conditionally execute a group of statements, depending on the value of a Boolean expression. An if statement is always concluded with end_if;

An example of a conditional statement:

9.2.5.3.2 Iteration statements
Operator For Description The for statement is used to allow a statement (or statements) to be executed repeatedly for a given number of times. The counter used in the repetition process can be used in the statements. The while statement is used in order to allow a statement (or statements) to be executed repeatedly while a certain condition is True. This separates it from the for statement. It has some similarities with the repeat statement.
9-5

While

3BSE 022 850/A

Course T530 Chapter 9 Structured Text (ST) Language

Repeat

The Repeat statement is used in order to allow a statement (or statements) to be executed repeatedly until a certain condition is True. This separates it from the for statement. It has some similarities with the while statement. Use the exit statement whenever you want to terminate a loop immediately and continue execution from the first line after the iteration statement.

Exit

9.2.5.3.3 Return statements
Operator Return Description Exit and terminate the execution of the current code. The instruction is usually found in function blocks and functions. It is not advisable to use the statement unless you are an advanced user as it can cause problems when executing together with other function blocks.

9.2.5.4 Execution order
The priority of operators decides the order of evaluation of an expression. Below is a summary of available operators, in descending priority: Operator (…) Function (…) Not, Description Parenthesized expression. Parameter list of a function, function evaluation. Negation, Boolean complement, i.e. value with "opposite" value (0 becomes 1, 1 becomes 0) and arithmetical negation (-). Exponentiation, i.e. raising to a power. Multiplication, division and modulus. Addition and subtraction. Comparison operators Equality and inequality. Boolean AND. Boolean exclusive OR Boolean OR Lowest Priority Highest

** *, / ,mod +, <, >, <=, >= =, <> and, & xor or

9-6

3BSE 022 850/A

Course T530

9.2.5.5 Simulate
When you simulate code written in the language Structured Text, is it possible to view the code in Ladder or Function Block Diagram (This works only for code written in Structured Text). Select (Tools> Setup) in the menu of the code block where the code is written (You must be in online mode when you do this).

9.3 Exercise 9.1 – Use the ST language
Please do exercise 9.1

3BSE 022 850/A

9-7

Course T530 Chapter 9 Structured Text (ST) Language

This page is intentionally left blank

9-8

3BSE 022 850/A

Course T530

TABLE OF CONTENTS Chapter 9 Structured Text (ST) Language ................................................................ 1 9.1 General Information ......................................................................................... 1 9.1.1 Description ......................................................................................... 1 9.1.2 Objectives .......................................................................................... 1 9.1.3 Reference Documentation.................................................................. 1 9.2 Lesson 1 - ST Language................................................................................... 2 9.2.1 Description ......................................................................................... 2 9.2.2 Objectives .......................................................................................... 2 9.2.3 General ............................................................................................... 2 9.2.3.1 Functions simplifying while editing ................................. 2 9.2.3.2 Using Microsoft Word...................................................... 3 9.2.4 Comments and the ABB extension .................................................... 3 9.2.5 Instructions ........................................................................................ 3 9.2.5.1 Assign statements ............................................................. 3 9.2.5.2 Expressions....................................................................... 4 9.2.5.2.1 Boolean expressions..................................... 4 9.2.5.2.2 Arithmetic expressions................................. 4 9.2.5.2.3 Relational expression ................................... 5 9.2.5.3 Statements ........................................................................ 5 9.2.5.3.1 Conditional statements ................................. 5 9.2.5.3.2 Iteration statements ...................................... 5 9.2.5.3.3 Return statements ......................................... 6 9.2.5.4 Execution order ................................................................ 6 9.2.5.5 Simulate ............................................................................ 7 9.3 Exercise 9.1 – Use the ST language ................................................................. 7

3BSE 022 850/A

9-i

Course T530 Chapter 9 Structured Text (ST) Language

This page is intentionally left blank

9-ii

3BSE 022 850/A


相关文章:
ABB DCS 系统 培训课程 系列讲座 Control Modules
ABB DCS 系统 培训课程 系列讲座 Control Modules_信息与通信_工程科技_专业资料。Course T530 Chapter 17 Control Modules 17.1 General Information 17.1.1 ...
ABB DCS 系统 培训课程 系列讲座 Tasks
ABB DCS 系统 培训课程 系列讲座 Tasks - Course T530 Chapter 13 Tasks 13.1 General Information 13.1.1 Descr...
ABB DCS 系统 培训课程 系列讲座 Backup and Rest...
ABB DCS 系统 培训课程 系列讲座 Backup and Restore_机械/仪表_工程科技_专业资料。Course T530 Chapter 24 Backup and Restore 24.1 General Information 24.1....
ABB DCS
ABB DCS_机械/仪表_工程科技_专业资料。ABB AC800M 资料 ABB DCS 培训记录本...▲System Topology 系统布局结构图: 一个 ABB 800 系列 DCS 系统必备的部分: ...
ABB DCS培训学习总结
ABB DCS培训学习总结_哲学_高等教育_教育专区。symphony 系统ABB公司培训资料 组态学习总结 北京 ABB DCS 组态学习总结 2008 年 1 月 7 到 11 日我们运行部由...
ABB DCS发展历程以及产品线
DCS ABBDCS 控制系统能够交付满足过程和电力...Infrastructure、Charging networks、DC Fa st chargers...Compact 800 系列产品的设计理念新颖,依照特定标准...
ABB DCS 培训课程 T315-16 Alarm and Events - Re...
ABB DCS 培训课程 T315-16 Alarm and Events - RevA_机械/仪表_工程科技_专业资料。System 800xA training Chapter 16 Alarm and Events TABLE OF CONTENTS ...
ABB DCS 培训课程 T315-19 Exercise 19.1 - RevA
ABB DCS 培训课程 T315-19 Exercise 19.1 - RevA_机械/仪表_工程科技_专业资料。System 800xA training Exercise 19.1 Create your own Faceplate 19.1.1 ...
ABB DCS 培训课程 T315-04 Project Framework - R...
ABB DCS 培训课程 T315-04 Project Framework - RevA_机械/仪表_工程科技_专业...language editors in Control Builder: Instruction List LD ANDN ST A B C ...
ABB DCS系统操作手册
ABB DCS系统操作手册_能源/化工_工程科技_专业资料。ABB DCS系统操作手册天津天铁炼焦化学有限公司 15 万 t/a 焦油 DCS 系统 应用软件操作说明书 组审编 审:许...
更多相关标签: