PLCopen
for efficiency in automation
IEC 61131-3: a standard programming resource
IEC 61131-3 is the first real endeavor 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:
• Part 1: General Overview
• Part 2 Hardware
• Part 3 Programming Languages
• Part 4 User Guidelines
• Part 5 Communication
• Part 7 Fuzzy Logic
• Part 8 Application Guidelines
There are many ways to look at part 3 of this standard. Just
to name a few:
• the result of the Task Force 3, Programming
Languages, within IEC TC65 SC65B
• the result of hard work by 7 international companies
adding tens of years of experience in the field of
industrial automation
• approx. 200 pages of text, with 60-something tables,
including features tables
• the specification of the syntax and semantics of a
unified suite of programming languages, including the
overall software model and a structuring language.
Another elegant view is by splitting the standard in two
parts (see figure 1):
1. Common Elements
2. Programming Languages
Let’s look more in detail to these parts:
Common Elements
Data Typing
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 datatypes 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 analog
input channel as data type, and re-use this over an over
again.
Variables
Variables are only assigned to explicit hardware addresses
(e.g. input and outputs) in configurations, resources or
programs. In this way a high level of hardware
independency is created, supporting the reusability of the
software.
The scopes of the 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,
e.g. the scratchpad. If the variables should have global
scope, they have to be declared as such (VAR_GLOBAL).
Parameters can be assigned an initial value at start up and
cold restart, in order to have the right setting.
Configuration, Resources and Tasks
To understand these better, let us look at the software
model, as defined in the standard (see below).
Access path
Execution
control path
FB
Task
Program Program
FB FB
Task
Program
Task
Program
FB FB
Task
Resource Resource
Configuration
Function
Block
The IEC 61131-3 Standard
Common Elements
Programming Languages
At the highest level, the entire software required to solve a
particular control problem can be formulated as a
Configuration. A configuration is specific to a particular
type of control system, including the arrangement of the
hardware, i.c. processing resources, memory addresses for
I/O channels and system capabilities.
Within a configuration one can define one or more
Resources. One can look at a resource as a processing
facility that is able to execute IEC programs.
Within a resource, one or more Tasks can be defined.
Tasks control the execution of a set of programs and/or
function blocks. These can either be executed periodically
or upon the occurrence of a specified trigger, such as the
change of a variable.
Programs are built from a number of different software
elements written in any of the IEC defined languages.
Typically, a program consists of a network of Functions
and Function Blocks, which are able to exchange data.
Function and Function Blocks are the basic building
blocks, containing a datastructure and an algorithm.
Let’s compare this to a conventional PLC: this contains
one resource, running one task, controlling one program,
running in a closed loop. IEC 61131-3 adds much to this,