PLCopen
for efficiency in automation
Technical Paper
PLCopen Technical Committee 6
XML Formats for IEC 61131-3
Version 2.01 – Official Release
DISCLAIMER OF WARANTIES
THIS DOCUMENT IS PROVIDED ON AN “AS IS” BASIS AND MAY BE SUBJECT TO
FUTURE ADDITIONS, MODIFICATIONS, OR CORRECTIONS. PLCOPEN HEREBY
DISCLAIMS ALL WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, FOR
THIS DOCUMENT. IN NO EVENT WILL PLCOPEN BE RESPONSIBLE FOR ANY LOSS OR
DAMAGE ARISING OUT OR RESULTING FROM ANY DEFECT, ERROR OR OMISSION IN
THIS DOCUMENT OR FROM ANYONE’S USE OF OR RELIANCE ON THIS DOCUMENT.
Copyright © 2003 - 2009 by PLCopen. All rights reserved.
Date: May 08, 2009
Total number of pages: 80
The following paper
XML Formats for IEC 61131-3
PLCopen
for efficiency in automation
3S
3S
ABB
ABB
Beckhoff
Beckhoff
Bosch Rexroth
FH Wernigerode
Helmut Schmidt Univ.
ifak
IST
Keba
KW Software
KW Software
Logicals
Panasonic
Rockwell Automation
Rockwell Automation
Schneider Automation
Schneider Electrical Motion
Siemens
Siemens
Toshiba / PLCopen Japan
Triconex
Univ. Magdeburg
Univ. Magdeburg
PLCopen
Daimler
Zühlke
is a document representing the results of the work done in the PLCopen Technical Committee 6 -
XML. This release 2.1 is based on the work done on the version 2.0, ‘Official Release’, as published
in December 2008, as well as the feedback received from in particular PLCopen Japan and
AutomationML. There are only minor changes between both versions.
This specification has been written thanks to the following members of the TC6 XML:
Kevin Ketterle
Dirk Schubel
Rainer Drath
Annette Kratz
Josef Papenfort
Uwe Thomas
Thomas Brandl
René Simon
Knut Güttel
Matthias Riedl
Wolfgang Horn
Dietmar Berlesreiter
Andreas Weichelt
Dimitrij Kirzhner
Thomas Baier
Hansjörg Hotz
Monique Atali-Ringot
Paul Brooks
Heinz Dieter Ferling
Jürgen Fiess
Hans Peter Otto
Michael John
Hajime Taruishi
Les Powers
Lorenz Hundt
Arndt Lüder
Eelco van der Wal
Contributors
Björn Grimm
Dirk Weidemann
Change Status List:
Version
number
V 0.0
V0.1
V 0.2
V 0.3
V 0.4
V 0.5
TC6 XML
Version 2.01 – Official release
06/05/2002 Preliminary draft with additions from PLCopen
14/01/2003 Results of the meeting at infoteam software
25/02/2003 Results of the meeting at Beckhoff Elektronik
06/05/2003 Results of the meeting at Matsushita Electric Works
17/06/2003 Results of the meeting at Kirchner SOFT
15/07/2003 Results of the meeting in Amsterdam
© PLCopen (2004 .. 2009)
page 2/80
Date
Change comment
08/05/2008
PLCopen
for efficiency in automation
V 0.6
V 0.7
V 0.71
V 0.8
V 0.99
V 0.99 A
V 0.99 B
V 1.0
Results of the meeting at KW Software, Lemgo, Germany
2/10/2003
28/11/2003 Results of the meeting in Neurenberg, with further editing by EvdW
31/03/2003 Hotz: All elements that describe IEC 61131-3 object are entered
09/04/2004 Final version before release as 0.99 – EvdW
16/04/2004 Released as Version 0.99 – in combination with scheme
14/02/2005 Based on the feedback on the Version 0.99. Meeting Feb. 8+9, 05
18/04/2005 Changed pictures included. US proof reading.
27/04/2005 Last minor changes done. Examples added cf. new xsd. Official
release
10/06/2005 Minor update: “refLocalId” is required. Text and examples updated.
04/04/2006 Addendum created to Version 1.01 as result of meeting April 2006
07/08/2006 Update Addendum as result of meeting July 28, 2006
24/04/2007 Addendum updated with additional feedback
11/03/2008 Addendum updated with additional feedback
V 1.01
Add
Add V02
Add V03
Add V04
Add V041 19/05/2008 Update Addendum as result of meeting May 6, 2008
Add V042 24/09/2008 Update Addendum as result of meeting Sept. 2, 2008
Add V043 04/11/2008 As result of the meeting Nov. 4, 2008. Last version.
V20P
V20WD
V 2.0
V 2.01
07/11/2008 As result of the meeting Nov. 4, 2008.
21/11/2008 Sent to group for last editorial comments
03/12/2008 Official Release of all merged feedback and decisions
08/05/2009 Official Release of merged feedback and decisions
TC6 XML
Version 2.01 – Official release
08/05/2008
© PLCopen (2004 .. 2009)
page 3/80
PLCopen
for efficiency in automation
Table of Contents
INTRODUCTION....................................................................................................................6
1
PURPOSE..................................................................................................................................6
1.1.
SHORT INTRODUCTION INTO XML...........................................................................................7
1.2.
1.3.
IMPORTANT CHANGES IN VERSION 2.0 AND V 2.01 AND COMPATIBILITY ISSUES......................8
2 SCOPE..........................................................................................................................................9
USE CASE – EXCHANGE FORMAT FOR PROGRAMMING TOOLS (ALL IEC LANGUAGES).............9
2.1.
USE CASE: INTERFACE TO PRODUCERS OF GRAPHICAL AND LOGICAL INFORMATION ...............9
2.2.
2.3.
USE CASE: INTERFACE TO CONSUMER OF GRAPHICAL AND LOGICAL INFORMATION. ...............9
USE CASE – DISTRIBUTION FORMAT FOR FUNCTION BLOCK LIBRARIES ...................................9
2.4.
GRAPHICAL OVERVIEW OF THE USE CASES..............................................................................9
2.5.
3 DEFINITIONS, COMPLIANCE, VALIDATION AND TRANSFORMATIONS.............11
3.1.
DEFINITIONS..........................................................................................................................11
NAMING CONVENTIONS.........................................................................................................11
3.2.
COMPLIANCE TO IEC 61131-3 – 2ND EDITION ........................................................................11
3.3.
3.4.
COMPLIANCE TO SUPPLIER SPECIFIC EXTENSIONS ..................................................................11
VALIDATION, TRANSFORMATION AND REPRESENTATION OF XML DOCUMENTS ...................12
3.5.
FORMATTED TEXT..................................................................................................................14
3.6.
DEFINITION OF THE COORDINATE SYSTEM FOR GRAPHICAL INFORMATION ............................14
3.7.
3.8.
POSITIONS..............................................................................................................................15
3.9.
DEFINITION OF THE EXECUTION ORDER OF THE GRAPHICAL ELEMENTS .................................17
3.10. REFERENCE OF GRAPHICAL ELEMENTS...................................................................................17
4 OVERVIEW OF THE SCHEME EXPLANATION .............................................................18
5 PROJECT STRUCTURE.........................................................................................................19
HEADER INFORMATION OF AN XML FILE...............................................................................19
5.1.
5.2.
HEADER ELEMENTS ...............................................................................................................19
project/fileHeader ........................................................................................................................................................................ 19
project/contentHeader.................................................................................................................................................................. 20
project/coordinateInfo.................................................................................................................................................................. 21
ADDDATA AND ADDDATAINFO..............................................................................................21
addDataInfo ................................................................................................................................................................................. 22
addData........................................................................................................................................................................................ 22
6 TYPE SPECIFIC PART...........................................................................................................23
6.1.
DEFINED DATATYPES ............................................................................................................23
POUS.....................................................................................................................................24
6.2.
actions.......................................................................................................................................................................................... 24
transitions .................................................................................................................................................................................... 24
body............................................................................................................................................................................................. 25
POUS – DECLARATION SECTION ............................................................................................26
POUS – CODE SECTION ..........................................................................................................28
6.4.1. General..............................................................................................................................28
position ........................................................................................................................................................................................ 28
relPosition.................................................................................................................................................................................... 28
content ......................................................................................................................................................................................... 28
variable ........................................................................................................................................................................................ 29
expression.................................................................................................................................................................................... 29
values........................................................................................................................................................................................... 29
documentation ............................................................................................................................................................................. 29
COMMONALITIES OF GRAPHICAL LANGUAGES .......................................................................30
Overview Common Objects......................................................................................................................................................... 30
comment ...................................................................................................................................................................................... 30
6.3.
6.4.
5.3.
6.5.
TC6 XML
Version 2.01 – Official release
08/05/2008
© PLCopen (2004 .. 2009)
page 4/80
PLCopen
for efficiency in automation
error ............................................................................................................................................................................................. 30
connector ..................................................................................................................................................................................... 32
connectionPointIn........................................................................................................................................................................ 32
connection.................................................................................................................................................................................... 33
continuation ................................................................................................................................................................................. 34
connectionPointOut ..................................................................................................................................................................... 34
actionBlock.................................................................................................................................................................................. 35
Additional information ................................................................................................................................................................ 37
vendorElement............................................................................................................................................................................. 38
6.5.1. SFC elements.....................................................................................................................39
step............................................................................................................................................................................................... 40
connectionPointOutAction........................................................................................................................................................... 41
macroStep.................................................................................................................................................................................... 42
jumpStep...................................................................................................................................................................................... 43
transition...................................................................................................................................................................................... 44
selectionDivergence..................................................................................................................................................................... 45
selectionConvergence.................................................................................................................................................................. 45
simultaneousDivergence.............................................................................................................................................................. 46
simultaneousConvergence ........................................................................................................................................................... 46
6.5.2. FBD elements ....................................................................................................................47
block ............................................................................................................................................................................................ 47
inVariable .................................................................................................................................................................................... 48
outVariable .................................................................................................................................................................................. 48
inoutVariable ............................................................................................................................................................................... 50
label ............................................................................................................................................................................................. 51
jump............................................................................................................................................................................................. 52
return ........................................................................................................................................................................................... 53
6.5.3. LD elements.......................................................................................................................54
leftPowerRail............................................................................................................................................................................... 54
rightPowerRail............................................................................................................................................................................. 55
coil............................................................................................................................................................................................... 56
contact ......................................................................................................................................................................................... 57
SCHEMA TEXTUAL LANGUAGES:...........................................................................................58
6.6.1. Structured Text (ST) and Instruction List (IL) ..................................................................58
INSTANCE SPECIFIC PART.................................................................................................59
7
CONFIGURATION ....................................................................................................................59
7.1.
RESOURCE..............................................................................................................................60
7.2.
TASK......................................................................................................................................60
7.3.
POU INSTANCES ....................................................................................................................61
7.4.
8 USE OF LOGO..........................................................................................................................62
9 EXAMPLES...............................................................................................................................63
OVERVIEW.............................................................................................................................63
9.1.
9.2.
DECLARATIVE PART OF PLCOPEN XML FILES......................................................................63
USE OF THE ADDDATA ELEMENT...........................................................................................64
9.3.
SIMPLE EXAMPLE FOR SFC ...................................................................................................65
9.4.
SIMPLE FBD EXAMPLE ..........................................................................................................71
9.5.
EXAMPLE CONNECTORS, CONNECTION AND VARIABLES ........................................................78
9.6.
9.7.
EXAMPLE ON FORKED CONNECTIONS.....................................................................................80
6.6.
TC6 XML
Version 2.01 – Official release
08/05/2008
© PLCopen (2004 .. 2009)
page 5/80
1
Introduction
PLCopen
for efficiency in automation
Since the release of the IEC 61131-3 programming standard, users want to be able to exchange their
programs, libraries and projects between development environments. Although this was not the intent
of the standard itself, it was a task that the independent organization PLCopen committed itself to.
IEC 61131-3 is focused on the software development environment. As such it is just a part of a total
solution. The other parts are a structure of tools like:
• networking tools
• debugging tools
• simulators
• documentation tools
Therefore PLCopen had decided to develop interfaces towards these support tools. This has resulted
in a workgroup named TC6 for XML (eXtended Markup Language). This committee has defined an
open interface, which supports different kinds of software tools, and provides the ability to transfer
the information that is on the screen to other platforms. This screen information does not only contain
textual information, but also graphical information. This can include the position and size of the
function blocks, and how they are connected.
The design of the ‘transferred’ program itself has to remain the same after the transfer, so not to be
altered in look and feel. The wide variety of possibilities, especially in the graphical tools, has to be
brought under one umbrella. Originally, PLCopen looked to the STEP standard to do this. STEP can
be looked at as an earlier version of XML, but the graphical part was limited. The STEP protocol was
used for the PLCopen Portability Level, but showed a lack of graphical definitions. This meant that,
without extensive work, the graphical languages could not be transferred, and the original goals could
not be fulfilled.
PLCopen wants to be able to transfer a control project without much additional effort, from one
development environment to another without loosing information even when it is incomplete, e.g. not
compilable without errors. This of course is also valid for the POUs, and especially for the User
Derived Function Block libraries. XML provides the right technology for this.
As such it will be more than an export / import tool from one development environment to another.
From the moment that this format is available, it is just a small step to feed a documentation tool with
the information, for instance. Actually, it is not important where this XML-code is coming from, as
long as it is recognizable and useable. It could be generated by other tools like simulation and
modeling tools, and consumed by verification, documentation, and version control tools.
To support this principle, all relevant information will be exported. The importing tool has to be
intelligent in filtering which parts of this information are useful and needs to be imported. With this
approach, PLCopen creates a complete new market, in which the focus is on reusability of software
development from libraries up to complete control projects.
1.1. Purpose
This document presents the representation of the complete project within the IEC 61131-3
environment based on current XML technologies, including the common elements with Sequential
Function Chart (SFC), the two textual languages Structured Text (ST) and Instruction List (IL), and
the two graphical languages Function Block Diagram (FBD), and Ladder Diagram (LD). The
formats are specified through corresponding XML schema. This is an independent file, with the .xsd
TC6 XML
Version 2.01 – Official release
08/05/2008
© PLCopen (2004 .. 2009)
page 6/80
PLCopen
for efficiency in automation
extension, and as such part of this specification. A description of these schemas is contained in this
document. It is assumed that the reader of this document is familiar with the basic technologies.
The described formats are destined for the import and export of IEC 61131-3 Projects and Program
Organization Units (POUs). These items can be under development, and so incomplete. As such
there is no verification on their applicability or their correctness.
In principle all information is made available in the exported XML file. The intelligence is in the
importing function (One exception is the generation of the coordinate system information in free-
style graphical editors – this is generated in the export functionality)
Vendor specific information and attributes can be included in the export file and possible deleted
during import, if applicable. The supplier specific information should not deal with any of the logic
part of the program.
This means that filtering is done on the import – suppliers have to take care that the extensions of the
XML schemes for internal purposes is done in such a way that deletion of the info does not effect the
functionality of the project. This could be done via an additional, supplier specific XML scheme,
besides the PLCopen defined version, linked via an URL or file to the source.
Concerning the exchange of graphical language constructs between different Programming Systems,
the focus is on logical information with optional explicit graphics.
Concerning consistency – the XML description is the valid description. Other descriptions are added
for clarification, etc., and no consistency to the XML description is guaranteed.
1.2. Short introduction into XML
XML stands for extended Markup Language, providing the basis for the well-known HTML (Hyper
Text Markup Language) that is used extensively on the internet.
XML has several advantages:
1. It is extendable
2. The data included can be checked for consistency with the scheme provided
3. Different schemes provide a possibility to check the incompatibilities
The W3C consortium calls XML "a common syntax for expressing structure in data." Structured data
refers to data that is tagged for its content, meaning, or use. For example, whereas the
tag in
HTML specifies text to be presented in a certain typeface and weight, an XML tag would explicitly
identify the kind of information: tags might identify the author of a document,
tags could contain an item's cost in an inventory list - all the way down to if
that's the level of detail required.
A schema is defined as a formal specification of element names that indicates which elements are
allowed in an XML document, and in what combinations. It also defines the structure of the
document: which elements are child elements of others, the sequence in which the child elements can
appear, and the number of child elements. It defines whether an element is empty or can include text.
The schema can also define default values for attributes. A schema also provides for extended
functionality such as data typing, inheritance, and presentation rules.
By separating structure and content from presentation, the same XML source document can be
written once, then displayed in a variety of ways: on a computer monitor, within a cellular-phone
TC6 XML
Version 2.01 – Official release
© PLCopen (2004 .. 2009)
page 7/80
08/05/2008
for efficiency in automation
display, translated into voice on a device for the blind, and so forth. It will work on any
communications devices that might be developed; an XML document can thus outlive the particular
authoring and display technologies available when it was written. Check www.xml.org for more
information.
PLCopen
1.3.
Important changes in version 2.0 and V 2.01 and compatibility issues
During the implementation phases, several companies submitted feedback in the form of
improvements and changes. These were discussed and decided upon within the TC6 Working Group.
The main changes for Version 2.0 are:
• Number of worksheets in POU body
• SFC connectionPointIn missing
• Actionblock: add height and width attributes, add "localID" and "executionOrderId" and for
‘Action’ add connectionPointOut
Include Anytype Datatypes
•
• Add varAcccess and varConfig
• Add global identifiers
• Add possibility to add vendor specific data to elements
• pouInstance: no way to specify type name
The changes for Version 2.01 were in the graphics in Chapter 3.8 and the remark on pragmas, as well
as two type definitions changed in the schema and one attribute.
These updates should in practice not effect the upwards compatibility.
TC6 XML
Version 2.01 – Official release
08/05/2008
© PLCopen (2004 .. 2009)
page 8/80