3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
-
Upload
nguyen-anh-tu -
Category
Documents
-
view
249 -
download
0
Transcript of 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
1/180
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
2/180
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
3/180
System 800xA ControlAC 800M
Planning
System Version 5.1
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
4/180
NOTICE
This document contains information about one or more ABB products and may include a
description of or a reference to one or more standards that may be generally relevant to
the ABB products. The presence of any such description of a standard or reference to a
standard is not a representation that all of the ABB products referenced in this document
support all of the features of the described or referenced standard. In order to determine
the specific features supported by a particular ABB product, the reader should consult the
product specifications for the particular ABB product.
ABB may have one or more patents or pending patent applications protecting the intel-
lectual property in the ABB products described in this document.
The information in this document is subject to change without notice and should not be
construed as a commitment by ABB. ABB assumes no responsibility for any errors that
may appear in this document.
In no event shall ABB be liable for direct, indirect, special, incidental or consequential
damages of any nature or kind arising from the use of this document, nor shall ABB be
liable for incidental or consequential damages arising from use of any software or hard-
ware described in this document.
This document and parts thereof must not be reproduced or copied without written per-
mission from ABB, and the contents thereof must not be imparted to a third party nor used
for any unauthorized purpose.
The software or hardware described in this document is furnished under a license and
may be used, copied, or disclosed only in accordance with the terms of such license. This
product meets the requirements specified in EMC Directive 2004/108/EEC and in Low
Voltage Directive 2006/95/EEC.
TRADEMARKS
All rights to copyrights, registered trademarks, and trademarks reside with their respec-
tive owners.
Copyright © 2003-2010 by ABB.
All rights reserved.
Release: June 2010
Document number: 3BSE043732-510
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
5/180
3BSE043732-510 5
TABLE OF CONTENTS
About This Book General ..............................................................................................................................9
Document Conventions ...................................................................................................10
Warning, Caution, Information, and Tip Icons................................................................10
Terminology.....................................................................................................................11
Related Documentation ...................................................................................................11
Section 1 - Design Issues
Introduction .....................................................................................................................13
Conceptual Issues ............................................................................................................14
Traditional Programming and Object-Oriented Programming ............................14
List-Driven Execution and Data Flow Driven Execution.....................................16
Libraries .............................................................................................................17
Code Organization................................................................................................19
Programming Languages .....................................................................................32
Structured Data Types ..........................................................................................33
Performance Issues..........................................................................................................34
Memory Consumption .........................................................................................34
Calculations and Performance Data .....................................................................35
Choosing Controller Hardware ............................................................................36
Distribution on Applications and Controllers ......................................................38
Limitations.......................................................................................................................42
OPC Server Limitations .......................................................................................43
Application Size Limit .........................................................................................43
Maximum Number of Controllers, Applications, Diagrams, Programs and Tasks44
Maximum Number of POUs and Variables .........................................................45
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
6/180
Table of Contents
6 3BSE043732-510
INSUM Limitations ............................................................................................. 47
Section 2 - Programming Languages
General ............................................................................................................................ 49
Structured Text, ST ......................................................................................................... 51
Suitable for Complex Calculations and Looping................................................. 51
High Threshold for Programmers ........................................................................ 52
Functions in ST....................................................................................................52
Function Block Diagram, FBD ....................................................................................... 53
Similar to Electrical Diagrams............................................................................. 55
Boolean Functions and Feedback are Easy to Implement ................................... 55
Not Suitable for Conditional Statements ............................................................. 56
Functions in FBD.................................................................................................56
Standard Function Block Types in FBD .............................................................. 58Ladder Diagram, LD ....................................................................................................... 63
Easy to Understand .............................................................................................. 64
Weak Software Structure ..................................................................................... 65
Limited Support for Sequences............................................................................ 66
Difficult to Reuse Code........................................................................................68
Functions in LD ................................................................................................... 68Instruction List, IL .......................................................................................................... 69
Best System Performance .................................................................................... 70
Weak Software Structure ..................................................................................... 70
Machine-dependent Behavior .............................................................................. 70
Functions in IL.....................................................................................................71
Example ............................................................................................................71
Result Register ..................................................................................................... 72
Sequential Function Chart, SFC...................................................................................... 73
Powerful Tool for Design and Structuring...........................................................74
Other Programming Languages are Needed........................................................75
Functions in SFC .................................................................................................75
Chart Structure ..................................................................................................... 77
Steps and Transitions ........................................................................................... 78
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
7/180
Table of Contents
3BSE043732-510 7
3BSE043732-510 7
Action Descriptions..............................................................................................79
Sequence Selection and Simultaneous Sequences ...............................................80
Subsequences .......................................................................................................82
SFC Viewer Recommendations ...........................................................................82
Advice on Good Programming Style ...................................................................84
Section 3 - Programming in Practice
Introduction .....................................................................................................................85
Organizing Code..............................................................................................................85
Programming with Function Blocks ....................................................................86
Function Block Calls............................................................................................89
Function Block Execution....................................................................................90
Function Block Code Sorting...............................................................................92
Control Modules in Function Blocks ...................................................................93Continuous and Event-Driven Execution of Function Blocks .............................96
Self-Defined Types.............................................................................................101
Structured Data Type Examples.........................................................................106
Code Sorting..................................................................................................................111
Code Loops ........................................................................................................112
Variable State .....................................................................................................113NoSort Attribute.................................................................................................114
Interpret and Correct Code Loop Errors ............................................................114
Code Optimization.........................................................................................................123
Basic Rules and Guidelines Regarding Tasks and Execution ............................124
Function Block, Operation, and Function Calls.................................................125
Firmware Functions for Arrays and Struct.........................................................127
Excessive Conditional Statements......................................................................128
16- or 32-Bit Data Variables ..............................................................................129
Variables and Parameters ...................................................................................129
Code Optimization Example ..............................................................................130
Task Tuning ...................................................................................................................132
Example of Task Tuning Using Manual Anaysis...............................................132
Example of Task Tuning Using the Task Analysis Tool ....................................137
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
8/180
Table of Contents
8 3BSE043732-510
Appendix A - IEC 61131-3 StandardMain Objectives ............................................................................................................ 141
Benefits Offered by the Standard .................................................................................. 142
Well-structured Software ................................................................................... 142
Five Languages for Different Needs..................................................................142
Software Exchange between Different Systems ................................................ 143
Appendix B - Naming Conventions and ToolsIntroduction ................................................................................................................... 145
Naming Conventions..................................................................................................... 146
General Guidelines ............................................................................................146
Variables .......................................................................................................... 150
Types and Parameters......................................................................................... 151
Programs ..........................................................................................................153Alarms and Events ............................................................................................. 153
Tasks ..........................................................................................................154
Libraries ..........................................................................................................154
I/O Naming ........................................................................................................ 155
Collect I/O.......................................................................................................... 157
Parameters..........................................................................................................157Descriptions ....................................................................................................... 157
Suggested I/O Signal Extensions.......................................................................158
Name Handling in an 800xA System............................................................................162
Name Aspects in an 800xA System................................................................... 162
Avoid Name Conflicts for Types–Type Qualification........................................ 165
Name Uploader .................................................................................................. 167
Appendix C - AC 800M Aspects
INDEX
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
9/180
3BSE043732-510 9
About This Book
GeneralThis manual provides some guidelines of what to consider when designing an
automation solution using Control Software for AC 800M, such as memory
consumption, CPU load, and task execution. The manual also contains advice to
programmers regarding optimization of code.
The libraries described in this manual conform to the IEC 61131-3 Programming
Languages standard, except for control modules, which are not supported by thisstandard.
• Section 1, Design Issues, helps in identifying the issues to consider when
planning the automation system. This section also gives advice on how to
design the automation system.
• Section 2, Programming Languages, helps to decide which programming
language to use. This section is a description of the supported programminglanguages.
• Section 3, Programming in Practice, gives practical advice on programming. It
discusses a number of areas and gives practical advice on how to solve
common problems.
In addition, the appendixes describe support information:
• Appendix A, IEC 61131-3 Standard gives a short introduction to the standard.
• Appendix B, Naming Conventions and Tools contains rules and
recommendations for naming variables, parameters, types and instances
(objects). It also describes the Name Uploader.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
10/180
Document Conventions About This Book
10 3BSE043732-510
• Appendix C, AC 800M Aspects lists specific AC 800M aspects, with a short
description of each aspect.
Document Conventions
Microsoft Windows conventions are normally used for the standard presentation ofmaterial when entering text, key sequences, prompts, messages, menu items, screen
elements, etc.
Warning, Caution, Information, and Tip Icons
This publication includes Warning, Caution, and Information where appropriate
to point out safety related or other important information. It also includes Tip topoint out useful hints to the reader. The corresponding symbols should be
interpreted as follows:
Although Warning hazards are related to personal injury, and Caution hazards are
associated with equipment or property damage, it should be understood that
If SIL certified applications are to be run in a High Integrity controller, refer to
the System 800xA, Control, AC 800M, Getting Started (3BSE041880*) manual.
Electrical Warning icon indicates the presence of a hazard which could result in
electrical shock.
Warning icon indicates the presence of a hazard which could result in personal
injury.
Caution icon indicates important information or warning related to the concept
discussed in the text. It might indicate the presence of a hazard which could
result in corruption of software or damage to equipment/property.
Information icon alerts the reader to pertinent facts and conditions.
Tip icon indicates advice on, for example, how to design your project or how to
use a certain function
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
11/180
About This Book Terminology
3BSE043732-510 11
operation of damaged equipment could, under certain operational conditions, result
in degraded process performance leading to personal injury or death. Therefore,
fully comply with all Warning and Caution notices.
Terminology
A complete and comprehensive list of Terms is included in the System 800xA,
Engineering Concepts (3BDS100972*) instruction. The list included in EngineeringConcepts includes terms and definitions as they apply to the 800xA system where
the usage is different from commonly accepted industry standard definitions and
definitions given in standard dictionaries such as Webster’s Dictionary of
Computer Terms.
Related Documentation
A complete list of all documents applicable to the 800xA IndustrialIT Extended
Automation System is provided in Released User Documents, (3BUA000263*).
This document lists applicable Release Notes and User Instructions. It is provided in
PDF format and is included on the Release Notes/Documentation media provided
with your system. Released User Documents are updated with each release and a
new file is provided that contains all user documents applicable for that release with
their applicable document number. Whenever a reference to a specific instruction ismade, the instruction number is included in the reference.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
12/180
Related Documentation About This Book
12 3BSE043732-510
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
13/180
3BSE043732-510 13
Section 1 Design Issues
IntroductionConsider the following while planning an automation solution:
• The application layer protocol to be used – MMS or Inter Application
Communication(IAC). MMS uses control modules and function blocks
whereas IAC uses single control modules and diagrams for communication.
• A number of conceptual choices have to be made, for example regarding whichprogramming strategy to use, see Conceptual Issues on page 14.
• The right hardware and network solutions have to be selected, so that the
performance is satisfactory and there is sufficient margin for further
development. See Performance Issues on page 34.
• There are certain limitations to the number of controllers, applications,
programs and tasks that co-exist in an 800xA system and in a single controller.
See Limitations on page 42.
In addition to the information in this manual, refer to the following manuals:
• The 800xA System Guide, Performance and Capacity (3BSE041434*) contains
performance data and information on how to make important calculations.
Performance Issues on page 34 contains an overview of the information that
can be found in this manual.
• The System 800xA, System Configuration (3BDS011222*) contains
information on how to configure the engineering environment and how to use
high-level tools such as Bulk Data Manager to create a basis for the automation
system.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
14/180
Conceptual Issues Section 1 Design Issues
14 3BSE043732-510
Conceptual IssuesConsider the strategical (conceptual) issues provided below, before creating an
automation solution:
• The type of programming to be used: traditional or object oriented
programming. See Traditional Programming and Object-Oriented
Programming on page 14.
• The type of execution to be used: list-driven or data flow driven execution. SeeList-Driven Execution and Data Flow Driven Execution on page 16.
• The type of libraries to be used to create re-usable type solutions, and the
system parts suited for creating type solutions. See Libraries on page 17.
• The coding process to be used: control modules, programs or Function
Designer. See Code Organization on page 19.
• The programming language to be used. See Programming Languages on page32.
• The structured data type to be used, and the instance to use structured data
types. See Structured Data Types on page 33.
Traditional Programming and Object-Oriented Programming
This section discusses about the traditional programming and object-orientedprogramming concepts. The benefits of the object-based method as compared to the
traditional method is also discussed, in connection with the data-flow-driven
execution, which results in control modules – a very powerful programming
concept.
Traditional Programming
In traditional programming, the design and execution is determined by the
sequential appearance of the code, starting from the top to the bottom. As the
program design proceeds, the code has to be rewitten if any major changes are
made. Also, the programmer must understand the type of an action and when the
action should occur during an execution cycle. Hence, the code design is time-
consuming, excessive, and difficult to maintain and update. It also has a poor
structural design.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
15/180
Section 1 Design Issues Traditional Programming and Object-Oriented Programming
3BSE043732-510 15
Object-Oriented Programming
Object-oriented programming is quite different from traditional programing in
design and execution. While traditional programming focuses on the overall task
(for example “Manufacture cement”), the object-oriented method reduces a
complex or large problem, to isolated, self-sustained procedures. Such procedures,
while considering the “Manufacture cement” example, could be “Regulate motor
speed”, “Open valve for water”, etc. Each of these objects is an isolated procedure.
For example, “Regulate motor speed” does not require any specific informationabout the motor itself, and the same holds for the valve. Each object has an input
and an output, and between these, the object analyses the situation and makes the
appropriate decisions, resulting in an action, or output. While doing this analysis,
the object does not require any input from the outside world.
When using this method of program design, the dependencies on other objects must
be placed outside the current object.
For example, consider the command to start a motor. The “Regulator” object cannot
start the motor independently; however, it can stop the motor if the speed becomes
too high. Even the normal stopping order for the motor is placed outside the
“Regulator” object, since this object is only concerned with regulating the motor
speed and stopping the motor in cases of faults or emergency.
The normal behavior is placed outside the object, while actions, such as security
measures, are placed within the object.
Using object-oriented design, the modelling environment is made simple. A number
of reusable tools are created while the objects are being developed. These tools help
in creating larger and more complex projects easily.
When the number of re-usable tools has reached a stage such that they become an
acceptable and defined standard in the daily project development routine, they can
be made into a library, for even more simplified project development.
In object-oriented programming, the initial effort and time is high. Each object must
be analyzed thoroughly, and then designed, such that it can remain as an isolated,
self-sustained, and re-usable object. Once the toolbox (or library) is ready with re-
usable objects, large-scale projects can be developed with ease.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
16/180
List-Driven Execution and Data Flow Driven Execution Section 1 Design Issues
16 3BSE043732-510
The object-oriented design applies to both function blocks and control modules.
However, technical considerations may lead to one technique being more suitable
than the other in some situations. The difference between control modules and
function blocks is the automatic code sorting of code blocks in control modules,
which gives better execution performance since the code blocks are then executed in
the most optimized way (see Data Flow Driven Execution on page 16).
Summary
The object-oriented programming/design:
• Simplifies daily project development.
• Provides a toolbox of reusable building blocks.
• Makes it easier to design large, complex projects using the building blocks.
• Makes it possible to create full-scale libraries that can be shared among projectparticipants.
• Makes it easier to survey, maintain, and update your code.
List-Driven Execution and Data Flow Driven Execution
The actual control and interaction between the building blocks in a program can be
through list-driven execution or data flow driven execution.
List-Driven Execution
The list-driven execution is a cyclic process. The code must be programmed and
executed in the correct order. Otherwise, it leads to time delays.
Data Flow Driven Execution
In Data flow-driven execution, the coding procedure is easy. All the objects
communicate with each other, and can determine when individual objects can send
and receive information.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
17/180
Section 1 Design Issues Libraries
3BSE043732-510 17
Figure 1. The code block in control module 1 must be executed before the code block
in control module 2 – not the other way around
A data flow driven design can avoid errors caused in the execution order. In dataflow-driven execution, code sorting exists.
Sometimes, Control Builder may not analyze the code design, resulting in code
sorting loop errors. For example, two IF statements cannot possibly be executed at
the same time. However, the code sorting routine may consider it as a loop, though it
is not a loop. For such instances, there is a nosort attribute that can be issued to
suppress such errors.
Summary
The data flow driven execution:
• Eliminates dangerous situations caused by poor, unclear design.
• Optimizes the code so that execution is carried out effeciently.
• Simplifies the code design allowing the user to concentrate on small partsrather than the entire project.
• Maintains the execution cycle and the performs the actions contained in the
cycle.
Libraries
There are two types of libraries, Standard and Self-Defined . The set of Standardlibraries is installed with the system and is always present. They may not all be
present in the current project, but will be loaded on demand (that is, if you connect
them to your library or application).
To re-use the function blocks and control modules, save them as types in either of
following ways:
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
18/180
Libraries Section 1 Design Issues
18 3BSE043732-510
• Save them in the application. You can then re-use types within that particular
application only.
• Save them in a self-defined library and then re-use them in any application or
project.
Types saved locally in the application will not be available for the other applications
or project.
As mentioned earlier, you can save your building blocks in your own, self-defined
library. As is the case with any of the other libraries, this library will also be
available to other projects, and you can also share the library with other project
members.
The structure of a library does not need to be flat, you can connect other libraries
(Standard or Self-Defined ) to a new library, and by doing so, you create a library
hierarchy. Assume you want to set up a project library called Cement Factory
Library, which connects to a large number of Standard and Self-Defined libraries(perhaps in a deep hierarchical structure). By doing so, other participants do not
have to load all the libraries required, just the “Cement Factory Library” in order to
access all the necessary data types, function block types and control module types.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
19/180
Section 1 Design Issues Code Organization
3BSE043732-510 19
Figure 2. Create (deep) hierarchical structures using both Standard and Self-
Defined libraries
Code Organization
This part of the manual will help you understand how function blocks and control
modules interact and important differences that might affect which programming
strategy you choose to use.
When organizing code, there are three basic methods of doing this:
• Using control modules, see Using Control Modules on page 20.
• Using function blocks inside programs, see Using Programs on page 21.
• Using Function Designer, see Using Function Designer on page 27.
Application 1 Application 2
Inlet Burners Cleaning Outlet
MyValveLib1 MyValveLib2
ProcessObjBasicLib AlarmEventLib
System BasicLib
A p pl i c a t i on s
P r o c e s s
s e c t i on
l i b r ar i e s
P r o c e s s
o b j e c t
l i b r ar i e s
C on
t r ol B ui l d er
s t an d
ar d
l i b r ar i e s
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
20/180
Code Organization Section 1 Design Issues
20 3BSE043732-510
It is also possible to mix control modules and function blocks inside each other, see
Mixing Control Modules and Function Blocks on page 24.
Using Control Modules
You can organize your code using control modules only. The benefit is clear:Control Builder will arrange (sort) the code1 so that optimal data flow is achieved
during execution. Note that this sorting only can be carried out for control modules,
see List-Driven Execution and Data Flow Driven Execution on page 16 for more
details.
Figure 3. Design using control modules only
Figure 3 shows an example of extensive use of control modules. All code is sorted
for optimal data flow during execution.
For more detailed information on control module and function block types and
objects, refer to the System 800xA, Control, AC 800M, Configuration
(3BSE035980*).
1. Since only control modules are used, all code will be sorted.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
21/180
Section 1 Design Issues Code Organization
3BSE043732-510 21
Using Programs
As well as using control modules only, it is also possible to use function blocks only.
These are then placed in a program.
When organizing your code, you will sooner or later face the question of how many
programs, code blocks, function blocks, etc., are needed and how the code should be
distributed on these objects. The below list provides some recommendations and
hints regarding this.
A Few Large Programs or Several Smaller Programs?
The smallest unit that is compiled and downloaded to the controller is a
Program Organization Unit (POU). As discussed in other sections in this
manual, a program is also a POU. It is tempting to put all the code in one
program, but this is not recommended, since this will lead to all code being
compiled every time, and all code being downloaded, even if the changes made
are minimal. The results of such a design would be that downloading wouldtake a long time, and that much more memory would be allocated in the
controller during download. The latter would result in a dramatic reduction in
the possible size of an application.
An obvious solution to this problem is to divide the program into several
smaller ones, and then make use of the code block features within the programs
(or POUs). Although this may seem to be an ideal solution, there are a number
of drawbacks with this design, compared to fewer but larger, programs. Findingthe right balance can be difficult.
• Let Programs Reflect Reality on a Large Scale!
Programs should be organized according to functional areas, such as “Intake”,
“Production”, “Outlet”, etc. Putting the code for these three functional areas in
one program would be poor design. Furthermore, programs (and code) should
also be organized with regard to execution demands (interval time, priority,etc.), that is, task properties.
Several programs can share the same task, and they should if the programs all
have the same requirements regarding interval time, priority etc. There is seldom
need for more than 3–5 tasks per application. Use Task Analysis to verify that the
tasks are properly configured with respect to priority and offset.
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
22/180
Code Organization Section 1 Design Issues
22 3BSE043732-510
• Let Code Blocks Reflect Reality on a Small Scale!
Apart from dividing the code into several programs, you can also use several
code blocks within each program (or POU). It is then necessary to decide how
many code blocks to use, and how much code should be allowed in each code
block.
(Up to 100 code blocks can be used in a POU, but it is seldom appropriate to
have so many code blocks.)
As programs reflect the process on a large scale, code blocks can be used to
reflect the process on a smaller scale. For example, the control of a motor or
valve (within a functional area) can be put in a single code block with a suitable
name. It is also possible to define the execution order within a POU using code
blocks, since code blocks are executed from left to right.
Obtaining a good balance between the number of programs and the number of
code blocks within the programs may be difficult. The problem can beillustrated as a two-dimensional chart.
Figure 4. Programs vs. Code blocks
Number of Code blocks
Number of Programs
A
B
C
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
23/180
Section 1 Design Issues Code Organization
3BSE043732-510 23
Having several programs and few code blocks (A), or few programs and several
code blocks (B) is poor design. A compromise like (C) is the best solution. Wecan also add a third dimension – function blocks that are declared in the
programs.
Figure 5. Including function blocks adds a third dimension to the problem
This third dimension is unlimited since you can have as many function blocks
as you like, and more function blocks, in each function block, etc. You can alsoadd control modules within a function block type, in order to use control
modules in a program. (This provides a way of using regulatory functions that
are only available as control modules, although you are using programs.)
It is important to note that the two-dimensional design (see Figure 4) is more
important than the three-dimensional design (see Figure 5), when it comes to
download time and memory consumption.
Mixing Control Modules and Function Blocks
It is also possible to mix control modules and function blocks, that is, to placefunction blocks inside control modules, and to place control modules inside
function blocks.
• Using Function Blocks in Control Modules
It is not always possible (or suitable) to use control modules throughout the
design. Simple tasks are best implemented using function blocks. Control
modules should be used at higher levels of complexity.
When using the programming languages FBD and LD it is easy to assume that
the pages in a code block correspond to the “function block axis” in Figure 5.
This is not the case. Code blocks in FBD and LD can contain many pages but
they still belong to the same code block in the POU.
Number of Programs
A
B
C
Function blocks
Number of Code blocks
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
24/180
Code Organization Section 1 Design Issues
24 3BSE043732-510
When you need to implement simple tasks, function blocks can be included in
a control module (or several control modules).
Figure 6. Function blocks can be used within control modules
In Figure 6, a function block (LevelHigh_1) of type LevelHigh (taken from
BasicLib) has been included within the InputValve control module (of Valvetype).
• Using Control Modules in Function Blocks
It is not always possible to use function blocks throughout the entire design, but
you can include control modules in a function block (or several function
blocks). A good reason to do this would be to include functionality that is only
available as control module types in your design, while you continue working
with function blocks and programs.
When control modules contain function blocks, the code blocks inside the
function blocks are not sorted.
Control modules are only executed once per scan, whereas function blocks may
be executed several times per scan (or not at all).
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
25/180
Section 1 Design Issues Code Organization
3BSE043732-510 25
Figure 7. Control modules can be used within function blocks
In Figure 7, several control modules (ProcessValue, PidController,
ControllerOutput) have been inserted into the function block CMInFBLoop. As
mentioned previously, the code for function blocks is not sorted for optimal
data flow during execution. However, the code for the control modules in the
function block is sorted (locally) according to data flow.
Let us assume that we have another function block in parallel with this one.The control modules in that function block are also sorted locally. But, these
two isolated groups of control modules are not sorted relative to each other. If
there is an exchange of variables between these two control modules, there will
be time delays.
In Figure 8 Control module 1 and 2 will be sorted together as will Control
module 3 and 4. However, these two individual groups (grouped by Function
Block 1 and 2) will not the sorted together.
C d O i i S i 1 D i I
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
26/180
Code Organization Section 1 Design Issues
26 3BSE043732-510
Figure 8. The boundaries of the function blocks limit the sorting of control modules
Control Modules versus Function Blocks
Control module solutions may be more efficient than function block solutions,
particularly if complex applications with deep hierarchical structures are to be used.
This is in particularly true for parameters of structured type, which are distributed as
In and/or Out parameters. Function block parameters are copied at each call, while
control module parameters are set up once during compilation.
Suppose we have the same code in a function block and in a control module, and
that the blocks do not have any parameters. In this case, the function block will
execute faster than the control module, since control modules have an extra
overhead of 4-5 microseconds for each code block (in PM860), function blocks donot have this overhead. The memory requirement will be the same for both.
The By_ref attribute can only be set for function block parameters with direction
“In” or “Out”. The attribute specifies that the parameter value will by passed by
reference instead of be value.
Differences arise when adding parameters to the block. Each parameter in a function
block adds to memory requirements, but parameters in control modules do not.
Furthermore, connected parameters (In or Out) in function blocks are copied from
one variable to another in order to establish data consistency within the block.
Parameters in control modules, on the other hand, are simply references that are
resolved during compilation.
The difference in performance between function blocks and control modules is
caused by the number of parameters used. Connecting parameters in function blocks
and/or having parameters of structured type in function blocks will result in poorer
Section 1 Design Issues Code Organization
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
27/180
Section 1 Design Issues Code Organization
3BSE043732-510 27
performance for the function blocks. Neither of these affect control module
performance.
Function block parameters are copied at each call, which means that the CPU will
spend considerable time passing parameter values to and from function blocks, if
there are deep structures in the program. The parameter connections of a control
module, on the other hand, are defined prior to compilation. This gives superior
performance using control modules when parameters are transferred through deep
hierarchies.
Figure 9. Parameter values passing through deep hierarchies
In other words, you should consider using control modules for complex applications
with deep hierarchical structures, and in applications with many parameters. In such
cases, the use of control modules may decrease the risk of deterioration in
performance.
Using Function Designer
Function Designer allows you to configure the control logic in your project in
comprehensive graphical Function Diagrams, in the spirit of the system-wide
Functional Planning approach. Using Function Designer gives you a good overview
of your application and supports planning without having to take controlapplications into account.
The Function Diagram (FD) allows the mixing of functions, function blocks, and
control modules, in the same diagram together with other constructs that are not
defined by standard FBD.
A..
Function block solution Control module solution
AA'
A"
AA'
A"
A..
Parameters copiedeach cycle
Connection performed onceduring compilation
Code Organization Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
28/180
Code Organization Section 1 Design Issues
28 3BSE043732-510
The following are the main elements in the FD:
• Pages
• Blocks
• Connection Ports
• Communication variables with cross navigation link
• IO signals representing IO channel configuration
The Function Designer compiles and allocates the Function Diagram to a selected
application available in the Control Builder, so that the diagram is available fordownload to the controller.
In the Control Builder, it is possible to:
• View the Function Diagram allocated to an application in the Control Builder.
The diagram appears under the Diagrams POU under the application.
• Connect the Function Diagram and its objects to controller tasks.
• Control the execution order of the Function Diagrams, based on the controller
tasks.
A Function Diagram typically shows a process control loop with all its function
components and their signal connections, see Figure 10.
Section 1 Design Issues Code Organization
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
29/180
Section 1 Design Issues Code Organization
3BSE043732-510 29
Figure 10. Function Designer example
Code Organization Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
30/180
Code Organization Section 1 Design Issues
30 3BSE043732-510
With Function Designer you are able to perform graphical plant function oriented
engineering with Aspect Objects. This is different from the traditional controller ortask oriented engineering. The graphical user interface makes complex control
strategies easy to engineer and even easier to maintain.
The Function Designer provides you with a Component view and a Diagram view
on a Function Aspect.
For information on how to use Function Designer to create a function diagram-
oriented design, see the manuals 800xA System Configuration and 800xAEngineering.
Summary
When choosing which way to organize your code, you have a number of choices to
make:
• If you prefer a task-oriented programming approach, you have to choosebetween control modules or function blocks organized in programs (but in the
first case, function blocks can be used inside control modules, and in the latter
case, control modules can also be used in the program and inside function
blocks).
• If you prefer a function diagram-oriented design, you should use the Function
Designer.
Which approach to choose depends on things such as how your organization collects
data and converts it to an automation solution, as well as on the development and
maintenance strategy chosen for the automation solution in question.
Section 1 Design Issues Code Organization
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
31/180
g g
3BSE043732-510 31
The most important differences between control modules and function blocks are
summarized in Table 1.
Table 1. Function blocks vs. control modules
Property Control modules Function Block
Execution order Automatic; compiler-determined via code
sorting/data flow optimization.
Manual; code statements,based on program flow as
implemented by theprogrammer.
Execution per scan Code blocks are alwaysexecuted once per scanaccording to data flowanalysis.
A function block can be called,and executed, zero, one, orseveral times per scan.
Static parameter connections Yes. This is an importantfeature. A static parameterconnection does not changeduring execution; it can onlybe changed via code changesand recompilation. Staticconnections are set atcompilation, yielding efficient
code generation, powerfulcompiler-based programanalysis, and betterperformance.
No. Parameters are copiedeach time the function block isexecuted according to the IEC61131-3 standard. For deepand complex hierarchies, theparameter copying of functionblocks demands significantCPU time.
By using the By-ref attributefor function blocks, the issuerelated to CPU time can beavoided.
Graphics Yes, in three different ways:free-layout programming,supervision, and interaction.
Indirectly via inclusion of subcontrol modules.
Programming Languages Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
32/180
32 3BSE043732-510
Programming Languages
When it comes to selecting which one of the available programming languages to
use, there is no clear rule. The languages available are Structured Text, Instruction
List, Function Block Diagram, and Ladder Diagram. These are all “basic”
programming languages and can be used in any code block. You can even use more
than one language in a single program, function block, or control module.There is an additional “programming language”, Sequential Flow Chart (SFC). SFC
is not, in a sense, a “real” programming language, but rather a structural
programming tool. Using SFC, you can easily design more complex sequences than
would be possible (with the same effort) in any of the other languages. As the name
Sequential Flow Chart implies, you have to plan sequentially when using this
language.
For each step in the sequence you can connect three code blocks, one that executes
at the start of the step, one that executes during the step and one that executes at the
end of the step. Additionally, there is also a Boolean variable for each step that can
be used as an indicator in another code block in any of the four languages listed
above.
For a more complete overview of the available programming languages, see Section
2, Programming Languages.
Parameters Parameters of the type in_outcan be connected to graphics.Connections cannot beinverted. ("NOT currentparameter name" is invalid.)
Parameters of the type in, out,or in_out can be connected tosub control modules.However, in_out parametersmust be connected statically if
they are connected to a controlmodule parameter.
Task connections Can be connected freely toany task.
Cannot be connected to a taskif it contains in_out parameters(see further Task Connectionand Parameters of Typein_out).
Table 1. Function blocks vs. control modules (Continued)
Property Control modules Function Block
Section 1 Design Issues Structured Data Types
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
33/180
3BSE043732-510 33
Structured Data Types
An important part of creating re-usable solutions is to use structured data types.
These serve as communicators (tunnels) through the application, and can in many
cases be used instead of writing code directly in function blocks and control
modules. If we implement object-specific code in every place, instead of using
variables of structured data types, we would soon narrow down the dynamics and
flexibility of the system.
Structured data types can be seen as a thick cable, with each component as a cordinside the cable. The strength of structured data types shows when they are used in
connections between types. You can connect control module types (through several
layers), without declaring any variables on each module level. One component
inside a valve can be directly accessed from a parameter on the outside. If you, later
on, need a new component, it will pass through all control module types and control
modules with no additional interconnection.
Figure 11 illustrates the use of structured data types inside a ValveLib library, inProject Explorer.
Figure 11. (Left) MyValveIOType created in ValveLib. (Right) MyValveIOType
with its components
For examples of the use of structured data types for I/O communication, see
Structured Data Type Examples on page 106.
Performance Issues Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
34/180
34 3BSE043732-510
Performance Issues
Before deciding on which hardware and communication protocol(s) to use, it is
necessary to make a number of calculations and estimate a number of things. Once
you have an idea of what you need, you can go on to choose your hardware. In order
to help you prepare for this choice, this subsection has been split into the following
parts:
• Memory Consumption on page 34, discusses things related to memory
consumption that should be considered during the planning phase.
• Calculations and Performance Data on page 35, gives an overview of the
Industrial IT, 800xA System Guide, Performance and Capacity
(3BSE041434*), which is of great help when discussing performance issues.
• Choosing Controller Hardware on page 36, lists a number of things that should
be considered when choosing controller hardware.
• Distribution on Applications and Controllers on page 38, discusses advantages
and disadvantages of splitting your code on several applications and/or
controllers.
When planning your control network communication, you should also read the
AC 800M, Communication Protocols (3BSE035982*). This manual gives a
conceptual overview of all supported protocols and contains useful performance
data for a number of key protocols, such as MMS.
Memory Consumption
Memory is reserved for each defined function block type and control module type.
When another function block or control module is created from a type, the amount
of memory reserved is very small, in relation to the memory reserved for the type.
You should therefore create as many control module and function block instances as
possible from a few types, instead of implementing your control solution with manydifferent memory-consuming types.
Section 1 Design Issues Calculations and Performance Data
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
35/180
3BSE043732-510 35
Calculations and Performance Data
Two very important concepts when discussing the performance of you automation
solutions is CPU load and memory consumption. In order for you to understand how
to calculate those in different situations, you should study the System Guide,
Performance and Capacity (3BSE041434*), which contains information on things
such as:
• How much memory is needed in a controller before downloading an
application? (Known as “available memory”.)• How much free memory is needed to update a running application?
• How does performance differ between different AC 800M processor units?
• How does performance differ between redundant and single controller
configurations?
• How does the execution interval affect CPU load?
• How do I calculate the CPU load percentage?
• How much memory does the first instance of a type consume and how much do
additional instances consume? Numbers are given for a number of common
library types.
• What is the execution time for instances of a number of common library types?
• How do I calculate the ModuleBus scan time?
• What is the I/O response time for a number of common protocols?
• What effects MMS communication speed?
• What is the accuracy of the different types of clock synchronization?In addition to the above manual, you should also study Section 3, Programming in
Practice.
Performance data for all supported protocols is also found in the AC 800M,
Communication Protocols (3BSE035982*).
Choosing Controller Hardware Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
36/180
36 3BSE043732-510
Choosing Controller Hardware
Another important consideration is the choice of controller hardware. At least two
very important issues should be considered when choosing controller hardware:
• CPU capacity
• CPU priority
CPU Capacity
If your application puts high demands on the controller regarding application
execution or communication performance, the following points should be
considered.
• How many I/Os are to be connected? As the number of I/Os increases, so do
the requirements on the control system.
• Do you have I/Os that require short interval times? You might want to add
external cards that contain separate CPUs for I/O processing,for example, PROFIBUS-DP.
• Which protocol should be used, and hence, which control hardware?
CPU Priority
1. AC 800M controller:
In AC 800M, servicing the S800 I/O via ModuleBus has the highest priority
(interrupt), and may cause a significant load on the CPU. Note that this
interrupt load is not accounted for separately, it will be evenly distributed over
other tasks. This means that the cyclic load presented for IEC 61131-3 task
execution includes the extra load caused by ModuleBus interrupts during task
execution.
The default setting for the ModuleBus scan cycle time is 100 ms.
Calculate the minimum scan time possible for the I/O configuration that is
used, using the formula in section Modulebus Scanning of Digital/Analog
modules in the System Guide, Performance and Capacity (3BSE041434*).
Section 1 Design Issues Choosing Controller Hardware
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
37/180
3BSE043732-510 37
Set the modulebus scan time to a value as high as possible, but higher than the
calculated minimum value and lower than the interval time of the fastest taskusing I/O signals. This decreases CPU load, in favor of user application(s), and
communication handling. This is needed in order to avoid sampling problems
due to the fact that the I/O systems and the IEC 61131-3 tasks execute
asynchronously.
A Supervision function implemented in the controller generates a system alarm
if the time taken to scan all modules exceeds the configured value +10 ms. If
the configured value is set to 0, then the Supervision is disabled.
The ModuleBus scan cycle time should be defined at an early stage of the
project, since many other parameters depend on it. Based on the ModuleBus
I/O system configuration, the complier indicates a recommendation or a
warning on scan time while downloading to the controller.
2. IEC 61131-3 Code:
Execution of IEC 61131-3 applications has the second highest priority.
Depending on the amount of code and requested task interval times,
applications may demand up to 70% of CPU capacity (never more)1; the
execution of IEC 61131-3 code is called cyclic load . Should an application
require more than 70% of CPU capacity, the task scheduler automaticallyincreases the task interval times to re-establish a 70% load. This tuning is
performed at 10-second intervals. You can read more about task handling in
the System 800xA, Control, AC 800M, Configuration (3BSE035980*).
Since IEC 61131-3 has higher priority than communication, it is recommendednot to configure for consecutive execution of more than 200ms.
Decreasing the ModuleBus scan cycle time in a running plant reduces CPU
capacity available for application(s) and communication handling.
1. This is not true if load balancing is set to false or if you run with an AC 800M HI. The controller will run until
it is forced to stop.
Load balancing can be disabled. For SIL certified applications, load balancing is
always replaced by overrun and latency supervision.
Distribution on Applications and Controllers Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
38/180
38 3BSE043732-510
3. Cyclic Diagnostics in an AC 800M HI controller:
It is important to consider the relevant FDRT setting in perspective of the
required diagnostic interval time for the system background diagnostics. Do
not set the FDRT setting lower than necessary, since this has a significant
impact on the load from diagnostic measures in the controller.
The system background diagnostics in the Controller must be able to execute to
completion with a cycle time of half the FDRT. The cyclic diagnosic executed
within FDRT has the priority next to 1131 application execution, which is, thesum of all 1131 application task execution time should not exceed 80% of ½
the configured FDRT setting. For example, with an FDRT setting of 3 sec, the
1131 execution during any 1.5 sec period must never exceed 1,2 sec (80% of ½
FDRT).
4. Communication Handling (lowest priority):
It is important to consider CPU load if communication handling is vital to the
application. Running at the maximum cyclic load will result in poor capacity
and response times for peer-to-peer and OPC Server communication.
Communication handling has the lowest priority in a controller. It is therefore
important to consider controller CPU load if the communication handling is
vital to the application. Running close to 100% total load will result in poor
capacity and response times for peer-to-peer and (OPC Server for AC 800M)
communication. It is recommended that peak total load will be kept below100%.
Inter Application Communication (IAC) has higher priority than normal MMS
communication.
Distribution on Applications and Controllers
The following sub-section discusses the pros and cons of dividing a project intoapplications for one or several controllers.
Communication between applications in controllers takes place using Access
variables or Communication Variables, independent of where the applications
are located. See the System 800xA, Control, AC 800M Configuration
(3BSE035980*).
Section 1 Design Issues Distribution on Applications and Controllers
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
39/180
3BSE043732-510 39
One Application to One Controller
In general, it is recommended to assign one application to one controller.
Figure 12. One application to one controller
There are some advantages to doing this, such as:
• There is only one application to keep track of.
• I/O variables can be freely connected (if several applications are connected to
the same controller, then variables must be sent between the applications via
communication), and it will be easy to search amongst them. You will not have
to transfer I/O values between applications.
• Communication variables, which use controller-IP based resolution, are used
for cyclic communication between diagrams, programs, and top level single
control modules (communication in the entire control network).
Figure 13. Project Explorer configuration with two controllers, each with one
application
Controller 1
Application 1
Controller 2
Application 2
Distribution on Applications and Controllers Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
40/180
40 3BSE043732-510
However, there are disadvantages. An application requires twice the memory size in
the controller when downloading changes, which means that more memory must beallocated in the controller (to be able to handle future modifications).
Dividing one Application on Several Controllers
If you must divide one application on several controllers, you have to consider this
when you plan your project. Although automatically generated variables handle
communication between the various parts of the application, unacceptable delays in
the variable communication may occur, leading to problems.
Figure 14. One application, divided on several controllers. There is automatic
Application Internal Communication between the controllers
The automatic communication that results from distributing an application betweenseveral controllers is called Application Internal Communication. The transfer of
exported variables takes place at a lower priority than the execution of tasks. The
controller (Client) reading a certain set of variables asks the owner (Server) for the
exported variables cyclically. There is no synchronization between communication
and execution.
Note that the communication load resulting from Application Internal
Communication can be high, if the structure of the application is such that a large
amount of data needs to be transferred. Communication is divided into telegrams
that can contain 1 kB. All telegrams required are fetched within a certain interval,
but spread over that interval to increase throughput. Setting a low interval time can
cause deterioration in communication performance. Task execution is, however,
unaffected.
Communication variables are not supported in distributed applications.
Controller 1 Controller 2
Application
Section 1 Design Issues Distribution on Applications and Controllers
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
41/180
3BSE043732-510 41
Distributed applications are not possible in High Integrity controllers. When
distributing an application on several controllers you must consider the following.
• Tasks in different controllers execute asynchronously.
• Automatic cyclic transfer of values between the controller (Application
Internal Communication), is asynchronous and the shortest possible interval
time depends on the controller and the network load. Recommended minimum
interval is 500 ms.
• The function WriteVar can be used to obtain non-cyclic Application InternalCommunication.
• The values of strings are normally not transferred (default setting) as this
lowers communication performance. If you want string values to be
transferred, set the system variable EnableStringTransfer to True.
• Data consistency is not guaranteed with Application Internal Communication.
Task execution can interrupt this communication service so it can not beguaranteed that all exported variables are sampled from the same execution, or
incorporated into the client at the same time.
• There is no automatic supervision of communication. This must be performed
manually, by using appropriate function blocks.
• I/O signals must be read/written by a task residing in the controller to which the
I/O signal is physically connected.
• You cannot run Compact Flash with distributed applications.
Several Applications in One Controller
Loading a controller with several applications can provide an excellent way ofreducing controller stop time during a program change, and of gaining more space
for code in the same controller.
There is more information in the Control Builder online help. Search for
“Distributed Execution”.
Limitations Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
42/180
42 3BSE043732-510
Figure 15. Several applications in one controller
A small application in a controller has the following advantages.
• The stop time during program modification will be reduced.
• The application will be easier to survey.
• There will be more memory available for future modifications.
However, there are a few disadvantages:
• It will be more complicated to exchange data between applications, for
example, if several applications must read from the same analog input.
• The number of tasks increases, which means that the overhead (the controller
load) will increase. A task can only execute code from one application, which
makes it difficult to specify the order of programs in different applications.
LimitationsWhen designing an automation solution, there are certain limitations to the system
and to hardware that must be considered. Limitations can be found within the
following fields:
• OPC server limitations, see OPC Server Limitations on page 43.
• The size of applications, see Application Size Limit on page 43.• Number of controllers, applications, programs and tasks, see Maximum
Number of Controllers, Applications, Diagrams, Programs and Tasks on page
44.
Controller 1
Application 1
Application 2
Section 1 Design Issues OPC Server Limitations
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
43/180
3BSE043732-510 43
• Number of Program Organization Units (POUs) and variables, see Maximum
Number of POUs and Variables on page 45.
• INSUM communication and number of MCUs, see INSUM Limitations on
page 47.
OPC Server Limitations
There are a number of limitations to OPC Server for AC 800M setup and
configuration, of which the most important are:• A single OPC Server for AC 800M may subscribe to data from several
controllers, or the equivalent number of variables from any other controller. For
more details refer to System Guide Technical Data and Configuration
(3BSE041434*).
• A maximum of three OPC servers may subscribe to Data Access and/or Alarm
and Event messages from one controller.
If third-party OPC clients are used, there will be further limitations.
For a complete list of basic rules and limitations when configuring OPC Server for
AC 800M, see the AC 800M, OPC Server (3BSE035983*).
Application Size Limit
The total amount of memory allocated for a complete application in the controller isa critical factor. This section provides general guidance regarding the size of an
application.
Using simple calculations of the amount of memory allocated for a function block
or control module, it is possible to obtain a fairly good estimate of the actual size of
an application.
When the template and added hardware have been downloaded, available memory
in the controller should be at least twice the application size. The reason for this is
that when changes are downloaded, the application running in the controller will be
duplicated, along with the new downloaded changes.
This raises the important question: How large an application can I download and
still maintain safe operation? A rule of thumb is: never download an application,
so large that it cannot be downloaded to the controller twice.
Maximum Number of Controllers, Applications, Diagrams, Programs and Tasks Section 1 Design
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
44/180
44 3BSE043732-510
Hence, at a certain point there will be 'two' applications, plus the new changes, in
controller memory at the same time, thus the need for at least twice the memorysize. When the new application has been fully built, the old application will be
removed from memory.
For a further discussion of application size and memory consumption, see
Calculations and Performance Data on page 35.
Maximum Number of Controllers, Applications, Diagrams, Programs andTasks
The following limitations apply to the number of controllers and applications that
can be handled by one 800xA system, and to the number of applications, diagrams,
programs, and tasks that can be handled by each controller.
Table 2. Maximum number of controllers, applications, diagrams, programs, and
tasks
Item Maximum Number
AC 800M controllers 32 per control project
Applications 1024 per control project
Applications 32 per controller
Applications One per task
Programs 64 per application
Diagrams 128 per application
Tasks 32 per controller
Section 1 Design Issues Maximum Number of POUs and Variables
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
45/180
3BSE043732-510 45
Maximum Number of POUs and Variables
The number of variables, function blocks, and control modules which can be used in
an application, a diagram, a program, a control module, or a function block, may be
very high, but it is not unlimited.
The total sum of diagrams, programs, control modules and function blocks in an
application is 65535. the maximum number of variables in an application, or a
control module type, or a program, or a diagram, or a function block type is 65535.
Applications
The maximum number of variables in one application is comprised of:
• Global variables with their total number of components,
• Local variables with their total number of components,
• Each program corresponds to one variable,
• Each diagram corresponds to one variable.
Control Module Type
The maximum number of variables in one control module type is made up from:
• Parameters (two variables per parameter),
• Local variables with their total number of components,
• Variables representing each graphical connection in FBD between sub-
function blocks, with their total number of components,
• Variables representing each graphical connection in CMD between sub-control
modules, with their total number of components,
• Variables representing each unconnected parameter on sub-control modules,
with their total number of components,
• Variables representing each unique literal used in connections to sub-control
modules (one per literal),
If you reach this limit, you should split your application (or type) into several.For details on other options, refer to System 800xA, Control, AC 800M
Configuration (3BSE035980*).
Maximum Number of POUs and Variables Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
46/180
46 3BSE043732-510
• Variables representing each SFC code block (two per code block),
• Variables representing each SFC state (three or four per SFC state),
• Project constants used in the control module type,
• Each function block corresponds to one variable.
Program
The maximum number of variables in one program is made up from:• Local variables and Communication variables (total number of all
components),
• Variables representing each graphical connection in FBD between sub-
function blocks (total number of all components),
• Variables representing each SFC code block (two per code block),
• Variables representing each SFC state (three or four per SFC state),
• Project constants used in the program,
• Each function block corresponds to one variable.
Diagram
The maximum number of variables in one diagram is made up from:
• Local variables and Communication variables (total number of all
components),
• Variables representing each graphical connection in the Function Diagram,
• Variables representing each SFC code block (two per code block),
• Variables representing each SFC state (three or four per SFC state).
Section 1 Design Issues INSUM Limitations
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
47/180
3BSE043732-510 47
Function Block Type
The maximum number of variables in one function block type is made up from:
• External variables (one per external),
• IN_OUT parameters (one per parameter),
• IN parameters with their total number of components,
• OUT parameters with their total number of components,
• Local function block variables with their total number of components,
• Variables representing each graphical connection in FBD between sub-
function blocks with their total number of components,
• Variables representing each unconnected parameter on sub-control modules
with their total number of components,
• Variables representing each unique literal used in connections to sub-control
modules (one per literal),
• Variables representing each SFC code block (two per code block),
• Variables representing each SFC state (three or four per SFC state),
• Project constants used in the function block type,
• Each function block corresponds to one variable.
Structured Variable and Project Constants
• The length of the name of each component in a structured variable or project
constant is limited to 32 characters,
• The total length of the name of a project constant (that is, the sum of the
number of characters in each component name) is limited to 140 characters.
INSUM Limitations
For information on INSUM-specific limitations, see INSUM performance data in
the System Guide, Performance and Capacity (3BSE041434*).
INSUM Limitations Section 1 Design Issues
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
48/180
48 3BSE043732-510
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
49/180
3BSE043732-510 49
Section 2 Programming Languages
This section gives an overview of the five programming languages in Control
Builder, and provides guidelines on selecting the language that suits your
application best.
General
Depending on previous experience, programmers often have their own personal
preference for a certain language. All the languages have advantages and
disadvantages, and no single one of them is suitable for all control tasks. We start
with three basic statements and then proceed to some important characteristics of
each language.
• In small applications with relatively few logical conditions, the demand for
good structure and re-use of code is not as great as in larger systems.
• ST and IL are textual languages, while FBD, LD, SFC, and FD are based on
graphical metaphors.
• LD and IL are not as powerful as ST or FBD.
The five languages are defined in the IEC 61131-3 standard, see also Appendix
A, IEC 61131-3 Standard. However, there are some differences compared to the
implementation in Control Builder.
Control Builder online help provides detailed information on the use of
instructions, functions, expressions, and so on, in the different languages.
Note that the definition of function block is allowed in all the five languages.
A function block is a method of encapsulating the code in a “black box” with
inputs and outputs.
General Section 2 Programming Languages
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
50/180
50 3BSE043732-510
Figure 16. A Boolean condition programmed with four of the five IEC 61131-3
programming languages. SFC is normally only used for sequences
Some important characteristics of the languages are listed in the Table 3.
Table 3. Control Builder programming languages
Language Function SIL
FunctionBlockDiagram, FBD
on page 53
A graphical language for depicting signal anddata flows through function blocks and re-usablesoftware elements. Function blocks and variables
are interconnected graphically, which makes theresulting control diagrams easy to read.
Non-SIL,SIL1-2, andSIL3
StructuredText, ST onpage 51
A high-level programming language. ST is highlystructured and has a comprehensive range ofconstructs for assignments, function/functionblock calls, expressions, conditional statements,iterations, etc.
It is easy to write advanced, compact, but clearST code, due to its logical and structured layout.
Non-SIL,SIL1-2, andSIL3
InstructionList, IL onpage 69
A traditional PLC language. It has a structuresimilar to simple machine assembler code.
Non-SIL
A1
A2
A3 M1LDN A3
AND( A1OR A2)ST M1
LD IL
M1 := ( A1 OR A2 ) AND NOT A3;
ST FBD
1 & M1
A1
A2A3
Section 2 Programming Languages Structured Text, ST
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
51/180
3BSE043732-510 51
Structured Text, ST
Structured Text (ST) is a high-level programming language, similar to Pascal and C ,
that has been specifically designed for use in programmable controllers. It is
compact, highly structured and contains a comprehensive range of constructs for
assignments, function/function block calls, expressions, conditional statements,
iterations and more. The code is simple to write and easy to read, because of its
logical and structured layout. The compactness of the language allows a clear
overview of the code and less scrolling in the editor. Tabs and spaces are used to
structure the code for easy reading.
Suitable for Complex Calculations and Looping
The ST language has an extensive range of constructs for assigning values to
variables, calling function blocks and creating conditional expressions. This is veryuseful for evaluating complex mathematical algorithms, commonly used in analog
control applications.
No other IEC language can match the power of ST when iterations are needed, that
is, when certain parts of the program code are to be repeated a fixed or a conditional
number of times.
LadderDiagram, LD on page 63
Ladder diagram (LD) is a graphical languagebased on relay ladder logic.
Non-SIL
SequentialFunctionChart, SFC on page 73
Sequential function chart (SFC) is a graphicallanguage for depicting the sequential behavior ofa control program.
SIL1-2 andNon-SIL
ST code can be written using any text editor, for example Microsoft Word, andthen copied and pasted into the Structured Text editor code pane in Control
Builder. Note however, that you only have access to online help (use the F1 key)
in the editor of Control Builder.
Table 3. Control Builder programming languages (Continued)
Language Function SIL
High Threshold for Programmers Section 2 Programming Languages
-
8/9/2019 3BSE043732-510 - En System 800xA Control 5.1 AC 800M Planning
52/180
52 3BSE043732-510
High Threshold for Programmers
Of the five IEC languages, Structured Text is often the natural choice for peoplewith former experience in computer programming. Control engineers without
computer knowledge sometimes consider ST to be more complex with a higher
learning threshold than the LD or IL languages.
On the whole, ST is fairly easy to learn and a very effective tool for developing
control applications. The language is a good general purpose tool for expressing
different types of behavior with all kind of structured variables.
Most programmable controllers supporting the SFC language use ST as the default
programming language to describe the step actions in sequences.
Functions in ST
Statements
The ST language contains a list of statements, such as assignment statements(variable:= expression), conditional statements (if, then, else, case), iteration
statements ( for, while, repeat ) and control statements (exit, return). Statements
contain expressions which, when evaluated, result in a value of a variable having
any kind of data type.
Statements should be written in a structured way, similarly to when pro