【正文】
ENGINEERING APPROACHThe presented approach towards reengineering (cf. ) 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. (Even if the PLCopen succeeds in defining a standardized format for PLC applications, there will remain a lot of existing programs that do not conform to this standard.) Based on this code a stepwise transformation to a formal model (automata) is planned. This model can then be used for analysis, simulation, formal verification and validation, and finally for the reimplementation of the optimized algorithm on the same or another PLC.Since reengineering of plete programs will, in most cases, be only a semiautomatic process, intermediate visualization of the code is an important point. At different stages of the process different aspects of the code and/or formal model have to be visualized in a way that a designer can guide the further work. XML with its powerful visualization and transformation tools is an ideal tool for solving this task.IV. XML AS A TOOL FOR VISUALIZATIONXML (extensible Markup Language) is a simple and flexible metalanguage, , a language for describing other languages. Tailored by the World Wide Web Consortium (W3C) as a dialect of SGML [S], XML removes two constraints which were holding back Web developments [6]. The dependence on a single, inflexible document type (HTML) which was being much abused for tasks it was never designed for on one side。 more recently a number of alternative languages have been proposed. The W3C XML Schema language replicates the essential functionality of DTDs, and adds a number of features: the use of XML instance syntax rather than an ad hoc notation, clear relationships between schemas and namespaces, a systematic distinction between element types and data types, and a singleinheritance form of type derivation. In other words schemas offer a richer and more powerful way of describing information than what is possible with DTDs. Fig. 4 shows the XML technologies discussed above and the connection between them. V. AN APPROACH FOR THE VISUALIZATION OFPLC PROGRAMSA. Overview Since Instruction List (IL) is the most monly 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 611313 are considered. The generation of XML documents showing different aspects of a PLC program is realized in the following three steps (cf. Fig. 5): of the PLC program to an XML document of the XML against the XML Schema which sets the syntax of the XML of the Instruction elements of the transformed XML according to the instruction set of the source PLC These three steps are discussed in subsections B to D respectively. Subsection E explains the visualization of the different XMLs obtained during the preceding steps.Throughout this Section an example is used to illustrate the presented concepts. Fig. 6 shows a PLC code written in Instruction List Siemens S5. The PLC code is written in atabular form where each row element is either a delimited list consisting of address, label, instruction, operand and description or a ment.Kommentar :AutorErstellt : Geaendert am: B1B:ONETZWERK 1 EMPFANGEN SLAVE 3 VON MASTERNAME :EMPE39。s grasp of the PLC code.Fig. IO shows the same PLC code as shown in Fig. 4 as a HTML document converted amp。一個(gè)傳統(tǒng)思路的方法就是在PLC編程中設(shè)立一個(gè)正式的設(shè)計(jì)方法。轉(zhuǎn)型成為一個(gè)獨(dú)立的格式和可視化的結(jié)構(gòu),在這個(gè)過(guò)程中,PLC程序的確定是作為這項(xiàng)措施的重要中間步驟。應(yīng)用在制造業(yè)和化工過(guò)程控制,機(jī)械加工,交通,電力分配,以及其他許多領(lǐng)域。為了確保高品質(zhì)的要求,我們需要檢查和驗(yàn)證程序,以及分析和模擬現(xiàn)有系統(tǒng)[ 2 ] 。 現(xiàn)有的PLC程序的可視化是逆向工程一個(gè)重要的中間步驟。在第三部分,在現(xiàn)有基礎(chǔ)上用形式化PLC程序重新設(shè)計(jì)方法的介紹。最后一節(jié)總結(jié)了結(jié)果,并就今后的工作在這方面正在進(jìn)行的項(xiàng)目做了一個(gè)前景的展望。在1993國(guó)際電工委員會(huì)[ 4 ]上公布了IEC 61131作為可編程控制器標(biāo)準(zhǔn)。Originated語(yǔ)言L被視為PLC的在所有其他IEC61 1313語(yǔ)言都可以翻譯語(yǔ)言。圣借從帕斯卡爾那里借用了它的語(yǔ)法,充實(shí)它的一些特點(diǎn)。FBD把換文本編程轉(zhuǎn)變?yōu)楣δ軌K編程,因而提高了模塊化和軟件重用性。目前,每個(gè)廠商都在運(yùn)用他們各自的具體的不同格式。 三 重新設(shè)計(jì)的方法 對(duì)于重新設(shè)計(jì)所提出的態(tài)度,(參見圖1 )是基于認(rèn)為XML可作為一種中間媒體語(yǔ)言用來(lái)改造PLC的代碼。這個(gè)模型可以用來(lái)進(jìn)行分析,模擬仿真,正式的檢查和驗(yàn)證,最終對(duì)同一PLC或其他產(chǎn)品重新執(zhí)行該優(yōu)化算法。 四 作為一種可視化工具的XML XML (可擴(kuò)展標(biāo)記語(yǔ)言)是一種簡(jiǎn)單而靈活的元語(yǔ)言,即一種描述其他語(yǔ)言的語(yǔ)言。 當(dāng)HTML描述了數(shù)據(jù)本身是怎樣顯現(xiàn)的同時(shí), XML描述了數(shù)據(jù)本身。使用擁有強(qiáng)大的解析器和固有的簡(jiǎn)單性的條款XML,句法和語(yǔ)義語(yǔ)法比常規(guī)詞匯分析器和驗(yàn)證分析器的使用更有利,(參見圖2 .7 ) 。一個(gè)應(yīng)用這種方法的方法的例子可以在[ 8 ] 發(fā)現(xiàn) 。 DOM的是一個(gè)應(yīng)用程序編程接口( apii )對(duì)HTML和格式良好的XML文件有效。不過(guò), XML介紹了此數(shù)據(jù)文件,并且DOM可以用來(lái)管理這方面的數(shù)據(jù)[ 5 ] 。XSLT的演變,作為一個(gè)高層次的宣示性的語(yǔ)言,[ 9 ]對(duì)利用的觀念,習(xí)俗申請(qǐng)的變革都是十分相似的。這個(gè)轉(zhuǎn)變最重要的優(yōu)勢(shì)是它允許一個(gè)可以想象的簡(jiǎn)單而容易的文件或數(shù)據(jù)結(jié)構(gòu)良好嵌入內(nèi)部結(jié)構(gòu),以了解XML來(lái)制作。根據(jù)W3C建議,這套規(guī)則已通過(guò)文件型態(tài)定義( DTD )或一個(gè)XML架構(gòu)加以界定。使用XML的語(yǔ)法,例如,明確之間的關(guān)系架構(gòu)和命名空間,一個(gè)有系統(tǒng)的區(qū)分元素的種類和數(shù)據(jù)類型,和單繼承的形式,類型的推導(dǎo)。西門子第5步和標(biāo)準(zhǔn)版根據(jù)的IEC 611313正在被考慮。 在整個(gè)這一節(jié)的一個(gè)例子是用來(lái)說(shuō)明所提出的概念。MAST0005 :U ABFRAGE OB EMPFANG MOEGLICH00060007 :SPB= MOOl00080009 :A DB140 EMPFANGSFACH IST DB 140OOOA :L KF+20 LAENGE DES DATENPAKETSoooc :T DLOOOOD :L KF+O ZIELNUMMER O=MASTEROOOF :T DRO00100011 : FANGEN WIEDER ERLAUBEN0012 :S 0013 MOOl :NOP 000140015 :BE BAUSTEIN ENDEFig. 6 A PLC program written in Siemens S5 Instruction ListB PLC程序轉(zhuǎn)換成為格式良好的XML 圖 7顯示通過(guò)XML文件獲得改造的PLC。C. XML驗(yàn)證和XML架構(gòu) 由于前處理,除了正在完善被確認(rèn)XML文件,可以驗(yàn)證的使用驗(yàn)證解析器取得的XML,形成符合一套句法規(guī)則所界定的背景下的PLC編程語(yǔ)言。 轉(zhuǎn)換的XML的指示識(shí)別的證明了XML的語(yǔ)義是與PLC的編程語(yǔ)言的操作類型相一致的。Logical Operation)U/Instruction/ILROW.ILRowInstruction instructionId=Jump OperationSPB/InstructionInstruction instructionId= special Operation BE/Instruction/ILROW/ILRowFig. 8 A new transformed XML showing only the inslructions and thecorresponding instruction ID/ILCodeBlackE. 可視化的XML上述所產(chǎn)生的兩種XML文件可轉(zhuǎn)化為HTML或在XSL的幫助下轉(zhuǎn)換為其他可讀的文件。這可視化已經(jīng)完成XML的轉(zhuǎn)換,他作為一個(gè)表中的子元素去驗(yàn)證的語(yǔ)法。這可視化,更好地了解PLC程序成為可能。在給出了書面指示PLC程序的基礎(chǔ)上,在清單的通過(guò)一個(gè)明確步驟轉(zhuǎn)型為被建議的正式代表?;赬ML的描述PLC程序的進(jìn)一步轉(zhuǎn)變,將適用于最后得出一個(gè)完全形式化描述原PLC的代碼。 2 、 . 里茲 , “形式化方法在PLC編程” ,在IEEE結(jié)論對(duì)系統(tǒng),人與控制論( smc39。 5 、在萬(wàn)維網(wǎng)財(cái)團(tuán): htfp 。