IEC 61131-3

IEC 61131-3 is the third part (of 10) of the open international standard IEC 61131 for programmable logic controllers, and was first published in December 1993 by the IEC. The current (third) edition was published in February 2013.

Part 3 of IEC 61131 deals with basic software architecture and programming languages of the control program within PLC. It defines three graphical and two textual programming language standards:

Data types

  • Elementary Data Type
    • Bit Strings – groups of on/off values
      • BYTE – 8 bit (1 byte)
      • WORD – 16 bit (2 byte)
      • DWORD – 32 bit (4 byte)
      • LWORD – 64 bit (8 byte)
    • INTEGER – whole numbers (Considering byte size 8 bits)
      • SINT – signed short integer (1 byte)
      • INT – signed integer (2 byte)
      • DINT – signed double integer (4 byte)
      • LINT – signed long integer (8 byte)
      • USINT – Unsigned short integer (1 byte)
      • UINT – Unsigned integer (2 byte)
      • UDINT – Unsigned double integer (4 byte)
      • ULINT – Unsigned long integer (8 byte)
    • REAL – floating point IEC 60559 (same as IEEE 754-2008)
      • REAL – (4 byte)
      • LREAL – (8 byte)
    • Duration
      • TIME – (Size is not specified)
      • LTIME – (8 byte)
    • Date
      • DATE – calendar date (Size is not specified)
      • LDATE – calendar date (Size is not specified)
    • Time of day
      • TIME_OF_DAY / TOD – clock time(Size is not specified)
      • LTIME_OF_DAY / LTOD – clock time (8 byte)
    • Date and time of Day
      • DATE_AND_TIME / DT – time and date(Size is not specified)
      • LDATE_AND_TIME / LDT – time and date(8 byte)
    • Character / Character string
      • CHAR – Single-byte character (1 byte)
      • WCHAR – Double-byte character (2 byte)
      • STRING – Variable-length single-byte character string
      • WSTRING – Variable-length double-byte character string
STRING escape sequences
Escape sequence Produces
$$ $
$' '
$L linefeed
$N newline
$P page (form feed)
$R return
$T tab
$xx hex value
  • Generic Data Types – Only available for the input / output/ in-out variables of system-defined Program Organization Units (POUs, see below)
    • ANY
          • ANY_NUM
            • ANY_REAL: LREAL, REAL
            • ANY_INT
              • ANY_SIGNED: LINT, DINT, INT, SINT
        • ANY_CHARS
          • ANY_CHAR: CHAR, WCHAR
  • User-defined Data Types
    • Enumerated data type
    • Enumerated data type with named value
    • Subrange data type – puts limits on value i.e., INT(4 .. 20) for current
    • Array data type – multiple values stored in the same variable.
    • Structured data type – composite of several variables and types.
    • Directly derived data type – type derived from one of the above types to give new name and initial value as a type.
    • References – a kind of strongly typed pointer. Arithmetic operation of the value of this type is prohibited.


Variable attributes: RETAIN, CONSTANT, AT

  • Global
  • Direct (local)
  • I/O Mapping – Input, Output, I/O
  • External
  • Temporary


  • Resource – Like a CPU
  • Tasks – Can be multiple per CPU.
  • Programs – Can be executed once, on a timer, on an event.

Program organization unit (POU)

  • Functions
    • Standard: ADD, SQRT, SIN, COS, GT, MIN, MAX, AND, OR, etc.
    • Custom
  • Function Blocks
    • Standard:
    • Custom – Libraries of functions can be supplied by a vendor or third party.
  • Programs

Configuration, resources, tasks

  • Configuration – processing resources, memory for IO, execution rates, number of tasks.


  1. ^ PLCopen: The third edition of IEC 61131-3

Tom Mejer Antonsen, "PLC Controls with Structured Text (ST), 2018, ISBN 978-87-4300-241-3, ISBN 978-87-4300-242-0

External links

Agile Automation

Agile Automation refers to the application of select Agile software development principles, patterns and practices, to the area of industrial automation and process control software development. The term was coined by HAL Software (Ireland) in 2013.

Traditionally, industrial automation software has been developed using languages that do not fully implement object-oriented programming. Software development lifecycle is in line with the Waterfall model. For example, the GxP (Good Automated manufacturing practice) V model that is pervasive throughout the pharmaceutical regulated industries. There was a growing belief however that the model was too rigid, did not allow for sufficient change throughout the software development lifecycle and did not target testing according to risk. The latest version of the GxP model went some way towards testing based on risk assessment.

The latest GxP model advocates testing and documenting according to perceived risk to the end user. (The patient, in the case of the Pharmaceutical industry).

In fact the GAMP5 guide in 2008 explicitly mentioned Agile programming;

"The approach described in this document is designed to be compatible with a wide range of other models, methods, and schemes, including: Software development methods such as RAD, Agile, RUP, or Extreme programming." (GAMP5)There is debate however over whether Agile methods can truly satisfy regulatory requirements, as outlined in the article on Alternative Software development models and methods in GxP Environments, by ISAP GMAP D_A_C_H SIG ASDMM. (Pharmaceutical Engineering Jan2012 Vol32 No.1). The Industry has some experience of poorly executed manufacturing execution system Agile software projects and these experiences have tended to reinforce the traditional notion that Waterfall software development lifecycle is the simplest way to enforce Engineering Rigour and budgetary/schedule constraints on a software development team.

Agile Automation software development has the potential to reduce the development lifecycle and at the same time, encompass automated unit testing. Something that the industry is calling for. In addition, the "don't repeat yourself" aspects of Agile object oriented software development encompassing extension of software classes through interfaces (Software class is open for extension but closed for modification) are very attractive in a regulated industry where software change validation is particularly expensive. Agile software development promotes true object oriented software programming which in turn results in software that is more amenable to change and less likely to break.The two most widely used strategy design patterns in Pharmaceutical and other Batch Industrial Automation higher level systems (SCADA, Batch and MES ) are ISA S88 & ISA S95. These patterns can be implemented such that the action behaviours (e.g., read/write method or Valve command on/off method) are encapsulated as interfaces using languages such C#, or Java. Commercial Control System software development is biased towards inheritance and subtyping, and the other OOP tenets (Encapsulation, Polymorphism) are not exposed to the programmer to the same extent. This incomplete OOP implementation increases the amount of design effort required. Even Commercial Proprietary DCS systems such as Emerson DeltaV are biased towards subtyping and inheritance without an easy way to implement a behaviour through an interface or similar construct. (There is no way to implement multiple inheritance.)

The IEC 61131-3 programming language is the most widely used language for programming PLC & DCS systems. It is not a truly object oriented language, implementing only 1 tenet of OOP (inheritance/subtyping) and not encapsulation or polymorphism. This limits its amenability to automated unit testing and encapsulating of behaviours for class extension.

Generally there is less scope for encapsulating behaviours in most industrial controllers except for platforms that run a more advanced operating system (for example the Beckhoff Twincat platform) that can be programmed via high level IDEs such as visual studio.

There is a replacement standard (IEC 61499) that is more object oriented, but industry uptake is small. There are moves towards IEC61131-3 consolidation, notably through the PLCOpen standard. This approach to developing an abstract XML class can result in a library of tested class modules/types that can subsequently be instantiated and imported to target platform.

Interest is growing in model driven architecture (MDA) Agile programming whereby a platform independent model is first developed. As a result of regulatory filing requirements and the need to protect against litigation, the Pharmaceutical industry records and saves data that must be reconstituted for subsequent filing submittal or Batch release (Electronic batch records). A model developed in the pilot lab and used as the guideline for manufacturing scale up, can aid filing submittal.

Block diagram

A block diagram is a diagram of a system in which the principal parts or functions are represented by blocks connected by lines that show the relationships of the blocks. They are heavily used in engineering in hardware design, electronic design, software design, and process flow diagrams.

Block diagrams are typically used for higher level, less detailed descriptions that are intended to clarify overall concepts without concern for the details of implementation. Contrast this with the schematic diagrams and layout diagrams used in electrical engineering, which show the implementation details of electrical components and physical construction.


Codesys (usually stylized as CODESYS, a portmanteau for controller development system, previously stylised CoDeSys) is a development environment for programming controller applications according to the international industrial standard IEC 61131-3.

Function block diagram

The Function Block Diagram (FBD) is a graphical language for programmable logic controller design, that can describe the function between input variables and output variables. A function is described as a set of elementary blocks. Input and output variables are connected to blocks by connection lines.

Inputs and outputs of the blocks are wired together with connection lines, or links. Single lines may be used to connect two logical points of the diagram:

An input variable and an input of a block

An output of a block and an input of another block

An output of a block and an output variableThe connection is oriented, meaning that the line carries associated data from the left end to the right end. The left and right ends of the connection line must be of the same type.

Multiple right connection, also called divergence can be used to broadcast information from its left end to each of its right ends. All ends of the connection must be of the same type.

Function Block Diagram is one of five languages for logic or control configuration supported by standard IEC 61131-3 for a control system such as a Programmable Logic Controller (PLC) or a Distributed Control System (DCS). The other supported languages are ladder logic, sequential function chart, structured text, and instruction list.

Functional Mock-up Interface

The Functional Mock-up Interface (or FMI) defines a standardized interface to be used in computer simulations to develop complex cyber-physical systems.

The vision of FMI is to support this approach: if the real product is to be assembled from a wide range of parts interacting in complex ways, each controlled by a complex set of physical laws, then it should be possible to create a virtual product that can be assembled from a set of models that each represent a combination of parts, each a model of the physical laws as well as a model of the control systems (using electronics, hydraulics, digital software, ..) assembled digitally.

The FMI standard thus provides the means for model based development of systems and is used for example for designing functions that are driven by electronic devices inside vehicles (e.g. ESP controllers, active safety systems, combustion controllers).

Activities from systems modelling, simulation, validation and test can be covered with the FMI based approach.

To create the FMI standard, a large number of software companies and research centers have worked in a cooperation project established through a European consortium that has been conducted by Dassault Systèmes under the name of MODELISAR.

The MODELISAR project started in 2008 to define the FMI specifications, deliver technology studies, prove the FMI concepts through Use Cases elaborated by the consortium partners and enable tool vendors to build advanced prototypes or in some cases even products.

The development of the FMI specifications was coordinated by Daimler AG.

After the end of the MODELISAR project in 2011, FMI is managed and developed as a Modelica Association Project (MAP).

The four required FMI aspects of creating models capable of being assembled have been covered in Modelisar project:

FMI for model exchange,

FMI for co-simulation,

FMI for applications,

FMI for PLM (integration of models and related data in product life-cycle management).In practice, the FMI implementation by a software modelling tool enables the creation of a simulation model that can be interconnected or the creation of a software library called FMU (Functional Mock-up Unit).

IEC 61131

IEC 61131 is an IEC standard for programmable controllers. It was known as IEC 1131 before the change in numbering system by IEC. The parts of the IEC 61131 standard are prepared and maintained working group 7, programmable control systems, of subcommittee SC 65B of Technical Committee TC65 of the IEC.

IEC 61499

The international standard IEC 61499, addressing the topic of function blocks for industrial process measurement and control systems, was initially published in 2005. The specification of IEC 61499 defines a generic model for distributed control systems and is based on the IEC 61131 standard. The concepts of IEC 61499 are also explained by Lewis and Zoitl as well as Vyatkin.

Industrial control system

Industrial control system (ICS) is a general term that encompasses several types of control systems and associated instrumentation used for industrial process control.

Such systems can range from a few modular panel-mounted controllers to large interconnected and interactive distributed control systems with many thousands of field connections. All systems receive data received from remote sensors measuring process variables (PVs), compare these with desired set points (SPs) and derive command functions which are used to control a process through the final control elements (FCEs), such as control valves.

The larger systems are usually implemented by Supervisory Control and Data Acquisition (SCADA) systems, or distributed control systems (DCS), and programmable logic controllers (PLCs), though SCADA and PLC systems are scalable down to small systems with few control loops. Such systems are extensively used in industries such as chemical processing, pulp and paper manufacture, power generation, oil and gas processing and telecommunications.

Instruction list

Instruction List (IL) is one of the 5 languages supported by the IEC 61131-3 standard. It is designed for programmable logic controllers (PLCs). It is a low level language and resembles assembly. All of the languages share IEC61131 Common Elements. The variables and function call are defined by the common elements so different languages can be used in the same program.

Program control (control flow) is achieved by jump instructions and function calls (subroutines with optional parameters).

The file format has now been standardized to XML by PLCopen.

Ladder logic

Ladder logic was originally a written method to document the design and construction of relay racks as used in manufacturing and process control. Each device in the relay rack would be represented by a symbol on the ladder diagram with connections between those devices shown. In addition, other items external to the relay rack such as pumps, heaters, and so forth would also be shown on the ladder diagram.

Ladder logic has evolved into a programming language that represents a program by a graphical diagram based on the circuit diagrams of relay logic hardware. Ladder logic is used to develop software for programmable logic controllers (PLCs) used in industrial control applications. The name is based on the observation that programs in this language resemble ladders, with two vertical rails and a series of horizontal rungs between them. While ladder diagrams were once the only available notation for recording programmable controller programs, today other forms are standardized in IEC 61131-3 (For example, as an alternative to the graphical ladder logic form, there is also a more assembly language like format called Instruction list within the IEC 61131-3 standard.).

List of programming languages by type

This is a list of notable programming languages, grouped by type.

Since there is no overarching classification scheme for programming languages, in many cases, a language will be listed under multiple headings.


PLCopen is an independent organisation providing efficiency in industrial automation based on the needs of users. PLCopen members have concentrated on technical specifications around IEC 61131-3, creating specifications and implementations in order to reduce cost in industrial engineering. The outcome for example is standardized libraries for different application fields, harmonized language conformity levels and engineering interfaces for exchange. Experts of the PLCopen members are organized in technical committees and together with end users define such open standards.

PLCopen was founded in 1992 just after the world wide programming standard IEC 61131-3 was published. The controls market at that time was a very heterogeneous market with different types of programming methods for many different PLCs. The IEC 61131-3 is a standard defining the programming languages for PLCs, embedded controls, and industrial PCs, harmonizing applications independent from specific dialects, but still based on known methods such as the textual programming languages Instruction List, and Structured Text, the graphical programming languages Function Block Diagram and Ladder Diagram (a.k.a. Ladder logic), and the structuring tool Sequential Function Chart.

Today, IEC 61131-3 is a highly accepted programming standard and many industrial software and hardware companies offer products based on this standard, which in the end are used in many different machinery and other application fields.

Current topics are:

Motion control and

Safety functionality

XML data exchange format standardizing the base data of IEC projects in software systems, as used for instance by AutomationML

Benchmarking projects in order to have a good sophisticated benchmark standard.

And in the field of communication PLCopen has developed together with OPC Foundation the mapping of the IEC 61131-3 software model to the OPC Unified Architecture information model.

Programmable logic controller

A programmable logic controller (PLC) or programmable controller is an industrial digital computer which has been ruggedized and adapted for the control of manufacturing processes, such as assembly lines, or robotic devices, or any activity that requires high reliability control and ease of programming and process fault diagnosis.

PLCs were first developed in the automobile manufacturing industry to provide flexible, ruggedized and easily programmable controllers to replace hard-wired relays, timers and sequencers. Since then, they have been widely adopted as high-reliability automation controllers suitable for harsh environments. A PLC is an example of a "hard" real-time system since output results must be produced in response to input conditions within a limited time, otherwise unintended operation will result.


Supervisory Control and Data Acquisition (SCADA) is a control system architecture that uses computers, networked data communications and graphical user interfaces for high-level process supervisory management, but uses other peripheral devices such as programmable logic controller (PLC) and discrete PID controllers to interface with the process plant or machinery.

The use of SCADA has been also considered for management and operations of project-driven-process in construction.

Sequential function chart

Sequential function chart (SFC) is a graphical programming language used for programmable logic controllers (PLCs). It is one of the five languages defined by IEC 61131-3 standard. The SFC standard is defined as, Preparation of function charts for control systems, and was based on GRAFCET (itself based on binary Petri nets).

It can be used to program processes that can be split into steps.

Main components of SFC are:

Steps with associated actions;

Transitions with associated logic conditions;

Directed links between steps and transitions.Steps in an SFC diagram can be active or inactive. Actions are only executed for active steps. A step can be active for one of two motives:

It is an initial step as specified by the programmer.

It was activated during a scan cycle and not deactivated since.Steps are activated when all steps above it are active and the connecting transition is superable (i.e. its associated condition is true). When a transition is passed, all steps above are deactivated at once and after all steps below are activated at once.

Actions associated with steps can be of several types, the most relevant ones being Continuous (N), Set (S) and Reset (R). Apart from the obvious meaning of Set and Reset, an N action ensures that its target variable is set to 1 as long as the step is active. An SFC rule states that if two steps have an N action on the same target, the variable must never be reset to 0. It is also possible to insert LD (Ladder Diagram) actions inside an SFC program (and this is the standard way, for instance, to work on integer variables).

SFC is an inherently parallel language in that multiple control flows — Program Organization Units (POUs) in the standard's parlance — can be active at once.

Non-standard extensions to the language include macroactions: i.e. actions inside a program unit that influence the state of another program unit. The most relevant such macroaction is "forcing", in which a POU can decide the active steps of another POU.


SiMotion is Siemens' flagship motion control platform, a scalable high performance hardware and software system designed to control the automated movements of a wide variety of machines. It aims to provide user-friendly stuff which can be used by unskilled workers, covering a broad range of motion control issues with all the engineering functions in one system.

It is part of Siemens' Total Integrated Automation (TIA) system, which aims to offer a "seamless, integrated platform" to implement customer-specific automation solutions in all sectors and across the entire production process, with integrated data management, engineering, and communications.

Structured text

Structured text, abbreviated as ST or STX, is one of the five languages supported by the IEC 61131-3 standard, designed for programmable logic controllers (PLCs). It is a high level language that is block structured and syntactically resembles Pascal, on which it is based. All of the languages share IEC61131 Common Elements. The variables and function calls are defined by the common elements so different languages within the IEC 61131-3 standard can be used in the same program.

Complex statements and nested instructions are supported:

Iteration loops (REPEAT-UNTIL; WHILE-DO)

Conditional execution (IF-THEN-ELSE; CASE)

Functions (SQRT(), SIN())

IEC standards
ISO/IEC standards

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.