资源描述
1 Abstract
Visualization of PLC Programs using XML
M.Bani younis and G.Frey
1 Abstract
Due to the growing complexity of PLC programs there is an increasing interest in the application of formal methods in this area. Formal methods allow rigid proving of system properties in verification and validation. One way to apply formal methods is to utilize a formal design approach in PLC programming. However, for existing software that has to be optimized, changed, or ported to new systems .There is the need for an approach that can start from a given PLC program. Therefore, formalization of PLC programs is a topic of current research. The paper outlines a re-engineering approach based on the formalization of PLC programs. The transformation into a vendor independent format and the visualization of the structure of PLC programs is identified as an important intermediate step in this process. It is shown how XML and corresponding technologies can be used for the formalization and visualization of an existing PLC program.
Programmable Logic Controllers (PLCs) are a special type of computers that are used in industrial and safety critical applications. The purpose of a PLC is to control a particular process, or a collection of processes, by producing electrical control signals in response to electrical process- related inputs signals. The systems controlled by PLCs vary tremendously, with applications in manufacturing, chemical process control, machining, transportation, power distribution, and many other fields. Automation applications can range in complexity from a simple panel to operate the lights and motorized window shades in a conference room to completely automated manufacturing lines.
With the widening of their application horizon,PLC programs are being subject to increased complexity and high quality demands especially for safety-critical applications. The growing complexity of the applications within the compliance of limited development time as well as the reusability of existing software or PLC modules requires a formal approach to be developed. Ensuring the high quality demands requires verification and validation procedures as well as analysis and simulation of existing systems to be carried out. One of the important fields for the formalization of PLC programs that have been growing up in recent time is Reverse-engineering. Reverse Engineering is a process of evaluating something to understand how it works in order to duplicate or enhance it. While the reuse of PLC codes is being established as a tool for combating the complexity of PLC programs, Reverse Engineering is supposed to receive increased importance in the coming years especially if exiting hardware has to be replaced by new hardware with different programming environments.
Visualization of existing PLC programs is an important intermediate step of Reverse Engineering. The paper provides an approach towards the visualization of PLC programs using XML which is an important approach for the orientation and better understanding for engineers working with PLC programs.
1
2 PLC AND IEC61131
2 PLC AND IEC 61131
IEC 61131 standard defines a suit of five programming languages:
(1) Ladder Diagram (LO) Ladder Diagram (LO) is a graphical language that has its roots in the USA. LDs conform to a programming style borrowed from electronic and electrical circuits for implementing control logics.
Fig.1 Re-engineering
Transformation
PLC-Code
Bosch
PLC-Code
IEC
PLC-Code S5
XML
Description
Formalization
Simulation
Analysis
Verification
Validation
Implementation
(2) Function Block Diagram (FBD) Function Block Diagram (FBD) is a graphical language and it is very common to the process industry. The presented approach towards re-engineering (cf. Fig.1) is based upon the conception that XML can be used as a medium in which PLC codes will be transformed.This transformation offers the advantage of obtaining avendor independent specification code.Based on this code a step-wise transformation to a formal model is planned.
2
3 AN APPROACH FOR THE VISUALIZATION PLC PROGRAMS
3 AN APPROACH FOR THE VISUALIZATION PLC PROGRAMS
3.1 Overview
Since Instruction List (IL) is the most commonly used PLC language in Europe, the presented approach is based on this language. The proprietary IL dialect Siemens STEP 5 and the standardized version according to IEC 61131-3 are considered.
The generation of XML documents showing different aspects of a PLC program is realized in the following three steps:
(1)Transformation of the PLC program to an XML document
(2)Validation of the XML against the XML Schema which sets the syntax of the XML
(3)Identification of the Instruction elements of the transformed XML according to the instruction set of the source PLC.
These three steps are discussed in sub-sections B to D respectively. Sub-section E explains the visualization of the different XMLs obtained during the preceding steps.
3.2 Conversion of a PLC Program inio a well-formed XML
Given a PLC program in ASCII format and in a tabular structure with separate columns for addresses, labels, instructions, operands and descriptions delimited by whitespaces, XSLT can convert it into a well-formed XML document. The XML document obtained through this transformation is a hierarchically structured document.
The XML document is structured in a hierarchy in which the root element is the IL Code Block representing the whole PLC code. Each of the rows of the PLC code is contained within a corresponding Row element which is M e r smtctured into child elements.
Note: The structure chosen for the XML representation of IL-Code is oriented at the working proposal of the PLC.
3.3 Visualization of XML
Both of the XML documents generated above can be transformed into HTML or other readable documents with the help of XSL. An ingenious XSL can be designed so as to produce an HTML which can convey the logical and other features of the PLC program in an easily conceivable form. Moreover, the DOM structure embedded in the XML, also enables the user to navigate through the PLC programs in an easy way.
For the example the visualization is done in HTML. This visualization is done for the transformed XML after the validation of it's syntax as a table where the child elements of the Row are the columns of this table.
The XML after the instruction identification is transformed using the XSL, where the instruction and the instruction Id, obtained after extracting the XML according to the type of operations are visualized in a table containing two columns (Instruction, Instruction Id) in HTML.
The HTML structures suggested here are not the only possibilities, with which the XML can be visualized, but they give a very easy practical option for the user's grasp of the PLC code.
3
1 摘要
可视化的PLC程序使用XML
米巴尼尤尼斯和G.弗雷
1摘要
由于P LC程序日益复杂,在PLC应用方面有越来越多的兴趣爱好者。形式化方法,让僵化的证明系统属性被核查和验证。一个传统思路的方法就是在PLC编程中设立一个正式的设计方法。不过,现有的软件已被优化,改变,或移植到新系统.有需要找到从某一PLC程序开始的方法。因此,规范PLC程序是一个现在研究的热点。该文章概述了基于形式化的PLC程序基础上从新启动的方法。转型成为一个独立的格式和可视化的结构,在这个过程中,PLC程序的确定是作为这项措施的重要中间步骤。这表明如何XML和相应的技术可用于形式化和可视化现有的PLC程序。
可编程逻辑控制器(PLC)是一种特殊类型的计算机,它应用于工业和安全的关键地方。应用PLC的目的是控制某一特定的或可选择的过程,它是通过产生的电控制信号回应电器中相关的输出信号来实现的。应用在制造业和化工过程控制,机械加工,交通,电力分配,以及其他许多领域。PLC控制有着极大的不同,自动化应用范围的复杂性从一个简单的小组运作到控制一个会议室的的灯光和自动窗成为一个全自动化的生产线。
随着他们应用PLC知识的增加,他们把PLC应用到复杂性和品质要求高的地方,特别是对安全性要求特别严格的地方。由于在有限的时间里PLCD的发展应用日益复杂,现有的软件或PLC的模块也在迅速发展,以此,需要一个正式的办法加以规范 。为了确保高品质的要求,我们需要检查和验证程序,以及分析和模拟现有系统。其中一个重要的领域就是已经在最近的时间成长在规范化的PLC程序是逆向工程。逆向工程是通过评估达到了解它的运转过程,以达到重复或加强的目的。而重用的PLC守则正在建立,作为一种打击复杂PLC程序的工具,逆向工程在今后几年将得到越来越多的重要性,特别是如果现有的硬件被适用于各种不同程序环境的新硬件所取代的情况下。
现有的PLC程序的可视化是逆向工程一个重要的中间步骤。本文章提供了一个方法,使用XML使PLC程序可视化,让PLC程序工程师更容易把握方向和更好地了解。
4
2 PLC 和IEC 61131
2 PLC和IEC 61131
国际电工委员会61131标准设立固定的一套符号,定义了一个适合2种编程语言标准:
(1) 梯形图(L0) 梯形图(L0)是一种被认为起源于于美国的图形语言。LDS符合从电子及电器电路实施控制逻辑的编程风格。
图1重建方法
编译
PLC-Code
Bosch
PLC-Code
IEC
PLC-Code S5
XML
规范化描述
正规化
仿真
分析
验证
复核
重复阶段
(2)功能块图(FBD) 功能块图(FBD)是一种图形语言,在工业流程里是常见的。在这种语言中,控制器被认为是功能块之间流动的信号和数据。FBD提高了模块化和软件重用性。对于重新设计所提出的态度,(参见图1)是基于认为XML可作为一种中间媒体语言用来改造PLC的代码。这种转变提供了取得avendor独立规格代码优势。在此代码基础上的一个明智步骤转型到一个正式的模型正在计划之中。
5
3 方法的可视化PLC程序
3 方法的可视化PLC程序
3.1概况
由于Instruction List (IL)是在欧洲最常用的PLC编程语言,现在展示的介绍的做法是在此基础上的语言。西门子第5步和标准版根据的IEC 61131-3正在被考虑。
XML文件显示的生成显示了不同方面的PLC程序,实现了在以下三个步骤:
(1)PLC程序到XML文件的转换,
(2)XML的可行性和确定了语法的XML架构,
(3)根据该指令集的来源,临立会,转换的XML介绍元素的定义。
这三个步骤是讨论分别分节B至D。小组E节解释了在前一阶段期间不同的XMLS的可视化取得的成绩。
3.2 PLC程序转换成为格式良好的XML
给定一个PLC程序在ASCII码格式,并在一个表格结构与分离柱、标签、指令、地址和描述由whitespaces分隔符,XSLT可以将它转换成一个完备的XML文档。XML文档中获得这种变革是一个层级结构文档。
XML文档结构层次的根元素是代表全IL代码块可编程序控制器(PLC)的代码。每一个行可编程序控制器(PLC)的代码被包含在一个相应的ILRow元素是Mersmtctured成子元素中。
注:结构为XML表示的选择IL-Code导向的PLC工作方案。
3.3 可视化的XML
上述所产生的两种XML文件可转化为HTML或在XSL的帮助下转换为其他可读的文件。一个巧妙的XSL可以被设计用来产生一个可以容易想象的转达PLC程序的逻辑或者其他特征的HTML文件。此外, DOM的结构在嵌入在XML中,也可让使用者用一个简单的方法浏览PLC程序。
例如在HTML中做的可视化程序 。这可视化已经完成XML的转换,他作为一个表中的子元素去验证的语法。
指示鉴定后的XML被转化成使用XSL转化,取得那里的指示和身份指示后,根据该行动的类型提取的XML在 HTML表载列了两栏(指示,指令编号)是在可视化的。
HTML结构的建议,这不是唯一的可能性,其中的XML可以可视化,但他们提供一个很容易的切实可行的方案,那就是为用户把握的PLC代码。
6
展开阅读全文