IEC 61131-3 is the first real endeavour to standardize programming languages for industrial automation. With its worldwide support, it is independent of any single company.
IEC 61131-3 is the third part of the IEC 61131 family. This consists of: (1) General information, (2) Equipment requirements and tests, (3) Programming languages, (4) User guidelines, (5) Communications, (6) Safety, (7) Fuzzy control programming, and (8) Guidelines for the application and implementation of programming languages.
IEC 61131-3 basically describes the Common Elements and Programming Languages.
Within the common elements, the data types are defined. Data typing prevents errors in an early stage. It is used to define the type of any parameter used. This avoids for instance dividing a Date by an Integer.
Common data types are Boolean, Integer, Real and Byte and Word, but also Date, Time_of_Day and String. Based on these, one can define own personal data types, known as derived data types. In this way one can define an analogue input channel as data type, and re-use this over and over again.
Ctrl Variables are only assigned to explicit hardware addresses (e.g. input and outputs) in Ctrl Configurations, Ctrl Resources or Ctrl Programs. In this way a high level of hardware independency is created, supporting the reusability of the software.
The scopes of the Ctrl Variables are normally limited to the organization unit in which they are declared, e.g. local. This means that their names can be reused in other parts without any conflict, eliminating another source of errors. If the Ctrl Variables should have global scope, they have to be declared as such (VAR_GLOBAL). Ctrl Variables can be assigned an initial value at start up and cold restart, in order to have the right setting.
These elements are integrated within the software model as defined in the standard (see below).
Figure 1 – Software Model
At the highest level, the entire software required to solve a particular control problem can be formulated as a Ctrl Configuration. A Ctrl Configuration is specific to a particular type of control system, including the arrangement of the hardware, i.e. processing resources, memory addresses for I/O channels and system capabilities.
Within a Ctrl Configuration one can define one or more Ctrl Resources. One can look at a Ctrl Resource as a processing facility that is able to execute Ctrl Programs.
Within a Ctrl Resource, one or more Ctrl Tasks can be defined. Ctrl Tasks control the execution of a set of Ctrl Programs and/or Ctrl Function Blocks. These can either be executed periodically or upon the occurrence of a specified trigger, such as the change of a Ctrl Variable.
Ctrl Programs are built from a number of different software elements written in any of the defined programming languages. Typically, a Ctrl Program consists of a network of Ctrl Functions and Ctrl Function Blocks, which are able to exchange data. Ctrl Functions and Ctrl Function Blocks are the basic building blocks, containing a data structure and an algorithm.
Within IEC 61131-3, the Ctrl Programs, Ctrl Function Blocks and Ctrl Functions are called Ctrl Program Organization Units, POUs.
IEC 61131-3 has defined standard Ctrl Functions and user defined Ctrl Functions. Standard Ctrl Functions are for instance ADD(addition), ABS(absolute), SQRT, SIN(sinus) and COS(cosinus). User defined Ctrl Functions, once defined, can be used over and over again.
Ctrl Function Blocks are the equivalent to integrated circuits, representing a specialized control function. They contain data as well as the algorithm, so they can keep track of the past (which is one of the differences w.r.t. Ctrl Functions). They have a well-defined interface and hidden internals, like an integrated circuit or black box. In this way they give a clear separation between different levels of programmers, or maintenance people.
A temperature control loop, or PID, is an excellent example of a Ctrl Function Block. Once defined, it can be used over and over again, in the same Ctrl Program, different Ctrl Programs, or even different projects. This makes them highly re-usable.
Ctrl Function Blocks can be written in any of the languages, and in most cases even in “C”. This way they can be defined by the user. Derived Ctrl Function Blocks are based on the standard defined Ctrl Function Blocks, but also completely new, customized Ctrl Function Blocks are possible within the standard: it just provides the framework.
The interfaces of Ctrl Functions and Ctrl Function Blocks are described in the same way.
Within the standard Sequential Function Chart (SFC) is defined as a structuring tool. This means that syntax and semantics have been defined, leaving no room for dialects. The language consists of a textual and a graphical version.
A Ctrl Program is a network of Ctrl Functions and Ctrl Function Blocks. A Ctrl Program can be written in any of the defined programming languages.