【文章內(nèi)容簡(jiǎn)介】
as HTML or PDF (cf. Fig. 3 ). The most important advantage of this transformation is that it allows a simple and easilyconceivable representation of the document or data structure embedded inside the wellstructured but hardtounderstand XML to be produced. When HTML is chosen as the format of the transformed produce it is possible to use the extensive ability of HTML to produce an easilyconceivable and attractive visualization of a program. Every XML document has its own syntax and vocabulary. Therefore, in addition to being wellformed, the XML document needs to conform to a set of rules. According to W3C remendations this set of rules has to be defined either through a Document Type Definition (DTD) or an XML Schema. The rules defined in a DTD or an XML Schema state the hierarchical and structural constraints of the XML document. The DTD is for defining the document grammars。 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 PROGRAMS A. 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 : Autor Erstellt : Geaendert am: B1B:O NETZWERK 1 EMPFANGEN SLAVE 3 VON MASTER NAME :EMPE39。MAST 0005 :U ABFRAGE OB EMPFANG MOEGLICH 0006 0007 :SPB= MOOl 0008 0009 :A DB140 EMPFANGSFACH IST DB 140 OOOA :L KF+20 LAENGE DES DATENPAKETS oooc :T DLO OOOD :L KF+O ZIELNUMMER O=MASTER OOOF :T DRO 0010 0011 : FANGEN WIEDER ERLAUBEN 0012 :S 0013 MOOl :NOP 0 0014 0015 :BE BAUSTEIN ENDE Fig. 6 A PLC program written in Siemens S5 Instruction List B. Conversion of a PLC Program inio a wellformed 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 wellformed XML document. The XML document obtained through this transformation is a hierarchically structured document. Fig. 7 shows the XML document obtained through the transformation of the PLC code of Fig. 6. 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 ILRow element which is M e r smtctured into child elements. Note: The structure chosen for the XML representation of ILCode is oriented at the working proposal of the PLCopen. C. XML Validation against the XML Schema The XML obtained as a result of the previous processing can be validated using a validating parser that confirms that the XML document in addition to being wellformed conforms to the set of syntactic rules defined in context of the PLC programming language. D. rdenhpcation of instructions This step in the process of visualization of PLC programs using XML ensures that the XML document to be used for visualization contains only valid can be used to transform the wellformed and valid Xh4L to another XML which as a result of identification on instructions has an additional attribute appended to the instruction tags. This attribute notifies whether the instruction is a valid instruction of the concerned instruction set. This transformation procedure is also capable of attaching attributes to the instruction tags that declares a classification of the instructions into predefined classes. The instruction identification of the transformed XML proofs the semantic of the XML in accordance with the operation types of the PLC programming language. In the example of this section, (cf. Fig. 8), the new XML contains additional attributes which classify the instructions according to the type of operation it represents. The STEPS instructions are categorized into eleven different types of operations . logical, jump, load or transfer operation assignment, etc. ?xml version= encOding=ISO88591 ? ILCodeBlock ILRow (Instruction instructionId=39。Logical Operation) U/Instruction /ILROW . ILRow Instruction instructionId=Jump Operation SPB/Instruction Instruction instructionId= special Operation BE/Instruction /ILROW /ILRow Fig. 8 A new transformed XML showing only the inslructions and the corresponding instruction ID