IEC-61131-3

March 16th, 2010 by admin

The IEC 61131 standard was published in 1993 by the International Electrotechnical Commission (a non-profit group that creates electrical standards).  There are 8 parts to the standard they are as follows:

1: General information

2: Equipment requirements and tests

3: Programming languages

4: User guidelines

5: Messaging

6: Communications

7: Fuzzy Logic control

8: Guidelines implementation

Part 3 is the section that programmers are most concerned with.  It details the languages and common elements used in programming with the standard.

The common elements of the IEC61131-3 standard are as follows:

  1. Data Types
    1. Standard (Boolean, Byte, Integer, word, string, float, etc)
    2. User Defined Type (UDT)

i.      Powerful way of organizing your data into a manageable and scalable structure

ii.      Allows combining, grouping, and nesting of multiple standard data types to produce more customized types that are application specific

iii.      By grouping and organizing data into structures, UDT’s permit easy data transfer

2.  Variables

3.  Configuration

4.  Resources

5.  Tasks

Programming units are divided into 3 categories:

  1. Functions – logic that does not require static or pre-allocated memory.  This is useful for logic that does have to retain memory values between scans
  2. Function Blocks – Logic that does retain its memory between scans.
    1. A Function Block is encapsulated logic with Inputs, Outputs, Input/Outputs, Internal data, and Internal logic.
  3. Programs – programs are sections of code that run under certain execution criteria
    1. Cyclical – Logic that continuously loops and runs as fast as the processor will allow
    2. Periodic – Logic that runs on a timed basis (e.g. every 100ms)
    3. Event Drive – Logic that runs when an event is triggered (such as the rising edge of an input or if a fault occurs)

Languages:

The  IEC61131-3 standard supports 5 languages:

Instruction list

  1. Function Block Diagram
  2. Structured Text
  3. Ladder Diagram
  4. Sequential Function Charts

Instruction List (IL)

Instruction list is very similar to assembly code.  It is useful for very low level operations and can be optimized to run very quickly in certain situations.  It can be difficult to read, but has the advantage of being text-based so it is easy to copy and paste.

Function Block Diagram (FBD)

Function Block Diagram expresses use a set of interconnected graphical blocks to represent the logic flow of the program.  It is very similar to Boolean logic diagrams used in digital circuit design.

Structured Text (ST)

Structured Text is a text-based language that is very powerful and can be used to create high level logic and complicated functions.  It is especially suited to performing math, array,  and string operations.

Ladder Diagram (LD)

Ladder Diagram is a graphical representation of the logic that resembles electrical relay logic diagrams.  It is very popular in the United States and is very simple and easy to learn.  It is ideally suited to bit logic involving digital inputs and outputs.  It is not well suited for array operations or complex data manipulations.

Sequential Function Charts (SFC)

Sequential Function Charts is a language that is graphical and resembles a flow chart.  It is a high-level language that is designed for sequential operations.  It can be used to create complicated state logic and step-by-step operations.  The graphical nature of SFC is ideally suited for debugging since many software packages permit a step mode that can easily be used to advance through the logic in a controlled manner.

Choosing a language can be challenging.  It is best to evaluate the situation and choose the language that best solves the problem at hand.

There are many benefits to using the IEC61131-3 standard.  Reduced training, debugging,  and maintenance time, Code re-usability reduced costs for subsequent systems, Better consistency and reduced errors due to standardization.  Easy collaboration since multiple languages can be used in the same program.