PLCopen
for efficiency in automation
The 3rd Edition
of IEC 61131-3
Eelco van der Wal
Managing Director PLCopen
PLCopen 1 printed at 27-Sep-11
PLCopen
for efficiency in automation
Overview of the IEC 61131
and
why a 3rd edition?
Living standards
PLCopen 2 printed at 27-Sep-11
PLCopen
for efficiency in automation
IEC 61131 Parts
Project Title Valid till
61131- 1, Ed 2.0 General information, 2003-05 2013
61131- 2, Ed 3.0 Equipment requirements and tests, 2007-07 2012
61131- 3, Ed 3.0 Programming languages (Currently CDV - Committee Draft for Voting) 2012+5
61131- 4, Ed 2.0 User guidelines (TR), 2004-07 2010
61131- 5, Ed 1.0 Communications, 2000-11 2013
61131- 6, Ed 1.0 Functional safety for PLC (Currently CDV - Committee Draft for Voting) 2012+5
61131- 7, Ed 1.0 Fuzzy control programming, 2000-08 2013
61131- 8, Ed 2.0 Guidelines applic. & implem. progr. languages (TR), 2003-09 2008
Single-drop digital communication interface for small sensors 2012+5
61131- 9, Ed 1.0
and actuators (SDCI) aka “IO-Link” (Currently CD - Committee Draft)
PLCopen 3 printed at 27-Sep-11
PLCopen
for efficiency in automation
Why include Object Orientation?
Main reason:
To link better to the scared resources
of engineers in the future
We should better adopt to them
then vice versa
PLCopen 4 printed at 27-Sep-11
PLCopen
for efficiency in automation
3rd edition fully compatible
with 2nd edition + extensions
The OOP features are selectable
and usable over time
And many other enhancements
and proposals to reduce – like delete IL
PLCopen 5 printed at 27-Sep-11
PLCopen
for efficiency in automation
Fully compatible extensions:
• Rules for implicit type conversions
• Functions for endianess, type conversion
• References (no pointer arithmetic)
• Object oriented extentions:
FB / Class: Method, Inheritance, Interface, Polymorphism
• Namespaces
• Etc.
PLCopen 6 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (1/7)
6.1.5 Comments New: Single line comment // text
6.2.1 Numeric literals … New: INT#16#7FFF = decimal value 32767
New: Typed double-byte string and char (using “single quote”
character)
6.2.3 Duration literal New: Nanosec
6.3 Data Types Clar: Harmonization with variables, Subclause reorganized
6.3.2 Elementary data types New: (Enum) Type with named values
6.3.3 Generic data type Corr: Hierarchy
0 User-defined data type New: Enum data type
Declaration and initialization New: Named values
New: OVERLAP, OVERLAYED
New: Relative location for structure elements
New: Directly derived data type
New: REF_TO declaration and operations
New: Structured data type with relative addressing AT and OVERLAP
New: Directly represented components of a structure - partly specified
using “ * ”
New: Initialization of a variable with user-defined data type
PLCopen 7 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (2/7)
6.4.1 Variables – General Clar: Harmonization with data types
Subclauses and tables reorganized
New: Variable with user-defined data type
6.4.1 Declaration and initialization Clar: Declaration and initialization
6.4.3 Variable-length array New: ARRAY [*, *, *] OF INT;
Std FBs for upper and lower bound
6.4.4 Overlayed variables New: OVERLAYED
6.4.5 Directly repres. variable Clar.
6.4.6 Retentive variabless Clar: RETAIN
6.5.1 Common features of POUs New: Overview of common features . Subclauses reorganized
Clar: Assignment and expression
New: Partial access of ANY-Bit
Clar: Call representation (execution sequence)
Clar: Execution control EN ENO
New: Implicit – explicit; Conversion rules
PLCopen 8 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (3/7)
6.5.2 Function Clar: Harmonization of rules with function blocks
Subclauses reorganized
Clar: Overview, Delaration, call representation, call rules.
Clar: Features tables: Function declaration and call
6.5.2.3 Function call Clar: Results: VAR_EXTERNAL, VAR_IN_OUT
New: Function without function result
Clar: Feature Table 21 restructured
Clar: Initialization of Input and output a feature
6.5.2.4 Typed overloading Corr: WORD_TO_INT vs. TO_INT
6.5.2.5.2 Type conversion New: Implicit and explicit conversion
New: TRUNC vs. TRUNC_**
New: Conversion of Numerical, bit, etc.
New: Conversion of Time = implementation dependent
6.5.2.5.7 Functions of time and date New: Concatenate and split
6.5.2.5.8 Function for endianess New: Endianess conversion functions
6.5.2.5.10 Functions New: Validate
PLCopen 9 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (4/7)
6.5.3 Function block Clar: Harmonization of rules for function
Subclauses reorganized
Clar: Overview, Delaration, call representation, call rules.
Clar: Features tables: Function block declaration and call
New: Error if no value specified for in-out and FB instance
6.5.3.2 FB type declaration New/Clar: Text and feature table: Rules for FB I/O var usage
Clar: Feature table: FB decl. restructured (Harmonization)
New: In feature table: Init. of inputs and outputs (was missing)
New: FB result like Function
New: Feature table: FB instance decl (was missing)
6.5.3.3 FB instance declaration Clar: Text and feature table
6.5.3.4 FB call Clar: Textual and graphical repr., feature table (Harmomized with
function)
6.5.3.5.2 Bistable elements New: Additionally long name: SR SET1, RESET… vs. S1, R...
6.5.3.5.4 Counters Del: Long input names: LOAD, RESET
PLCopen 10 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (5/7)
6.5.4 Object oriented ext. of FB New: FB with optional OO-extensions
concept New: CLASS as special case of OO FB
New: Function block inherits from base class
- VAR_IN_OUT of a (base) FB type may be assigned an instance of a
derived FB type,
- A reference to a (base) FB type may be assigned the address of an
instance of a derived FB type
OO FB Clar: Feature Table restructured
Classes - Feature New: CLASS as subset of OO FB and feature table
Methods New: METHOD for FB
Interfaces New: INTERFACE, method prototypes, FB IMPLEMENTS
Inheritance New: EXTENDS for Interface and FB
6.5.7.3.2 FB inheritance New: FINAL, SUPER
6.5.7.3.6 Type check and cast New: Type check, derivation check, cast
6.6.5 SFC - Evaluation rules Corr: Simult. seq. – divergence and convergence
6.8 Namespaces New: NAMESPACE, INTERNAL ACCESS, PUBLIC ACCESS
PLCopen 11 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (6/7)
7.2 Instruction list DEL: Proposal:
This language is a) often implementation specifically realised and b)
outdated as an assembler like language. Therefore it will not be
contained in the next version of this part of the standard.
New: Method call with formal and nonm-formal list
New: IL FB call – Counter RESET (Long name)
7.2.3 IL function and FB call New: Harmonized with the general call rules.
7.3.2 Structured Text New: Feature table
New: Statements: “;“, CONTINUE
8.1.2 Representation of lines and Clar: Feature table > Figure Example (not normative anymore)
blocks
8.2.4 Ladder Diagram New: Contacts for Compare (typed and overloaded)
PLCopen 12 printed at 27-Sep-11
PLCopen
for efficiency in automation
Details walkthrough (7/7)
Annex A Syntax New: updatenew element (open)
Annex B Delimiter and kexword New: update new element (open)
Annex C Implement. dependencies New: update new element (open)
Annex D Error conditions New: update new elements (open)
Annex E Extension of 3rd Edition New: Text, Figure and Table (This table (here) will go to an Annex
Annex Interoperability with IEC Del:
61499 devices
Annex Examples Del: Move to next edition of part 8 - Guidelines
PLCopen 13 printed at 27-Sep-11
PLCopen
for efficiency in automation
Some examples
PLCopen 14 printed at 27-Sep-11
PLCopen
1. Objects for efficiency in automation
Creation of Objects:
through declaration of Variables
Usage of Objects:
Call of Methods
PLCopen 15 printed at 27-Sep-11
PLCopen
2. Classes for efficiency in automation
Classes define Data and
Operations for the relevant
instances of the objects
Definitions of the instance
data: Variablens of the FB
Definition of the Operations:
Method = Action of the FB with
own Variables + Return value
PLCopen 16 printed at 27-Sep-11
3. Sub (1): Inheritance PLCopen
for efficiency in automation
Spezialfall von Pump
zusätzliches Datum
zusätzliche Operation
bei unverändertem Start u.
GetState
EXTENDS deklariert, dass Spezialfall vorliegt
Neuer FB hat zumindest alle Daten u. Operationen des alten durch
Vererbung
Erweitern und anpassen (statt Copy&Modify)
PLCopen 17 printed at 27-Sep-11
3. Sub(2): Interfaces PLCopen
for efficiency in automation
INTERFACE = Oberklasse, so allgemein, dass weder Daten noch
Op.-Implementierungen feststehen (rein abstrakte Klasse)
Völlig unabhängig definierte FBs können Spezialfälle davon sein →
eine Hierarchie
Interface definiert die Methodenschnittstelle, FBs implementieren
diese (IMPLEMENTS)
PLCopen 18 printed at 27-Sep-11
3. Sub(3): Polymorphie PLCopen
for efficiency in automation
Interface als Typ
→ Referenz auf FB-Instanz
ein Array / eine POE für
Instanzen verschiedener FBs
im1(DriveCAN1)
im1(DriveAnalog1)
einheitlicher Aufruf der jeweils
passenden Implementierung
(dynamisches Binden)
PLCopen 19 printed at 27-Sep-11
PLCopen
for efficiency in automation
Comparison
Spracheigenschaften IEC 3rd Edition C++ Java C#
Multi languages + + - - -
OOP/procedural mixed - + + - -
Classes ~ (FB) + + + +
Methods ~ (Aktionen) + + + +
Interfaces - + - + +
Polymorphi - + +/- + +
‚Referenzsemantik‘ - + (Interfaces) - + +
Constructor / Destructor - + + + +
Properties - + - - +
Dyn. Memory („new“) - - + + +
Access control ~ (Variablen) ~ (Variablen) + + +
PLCopen 20 printed at 27-Sep-11
PLCopen
for efficiency in automation
PLCopen 21 printed at 27-Sep-11