【正文】
andard defines a suit of five programming languages: Instruction List (IL) is a lowlevel textual language with a structure similar to assembler. Originated in Europe IL is considered to be the PLC language in which all other IEC61 1313 languages can be translated. 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. Structured Text (STJ is a very powerful highlevel language. ST borrows its syntax from Pascal, augmenting it with some features from Ada. ST contains all the essential elements of a modem programming language. Function Block Diagram (FBD) is a graphical language and it is very mon to the process industry. In this language controllers are modelled as signal and data flows through function blocks. FBD transforms textual programming into connecting function blocks and thus improves modularity and software reuse. Sequential Function Chart (SFC) is a graphical language. SFC elements are defined for structuring the anization of programmable controller programs. One problem with IEC 61 1313 is that there is no standardized format for the project information in a PLC programming tool. At the moment there are only vendor specific formats. This is also one reason for the restriction of formalization approaches to single programs or algorithms. However, recently the PLC users? anization PLCopen (see started a Technical Committee to define an XML based format for projects according to IEC 611313. This new format will ease the access of formalization tools to all relevant information of a PLC project. Ⅲ . REENGINEERING APPROACH The 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 VISUALIZATION XML (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。 and the plexity of full SGML, whose syntax allows many powerful but hardtoprogram options on the other side. While HTML describes how data should be presented, XML describes the data itself. A number of industries and scientific disciplinesmedical records and newspaper publishing among themare already using XML to exchange information across platforms and applications. XML can be tailored to describe virtually any kind of information in a form that the recipient of the information can use in a variety of ways. It is specifically designed to support information exchange between systems that use fundamentally different forms of data representation, as for example between CAD and scheduling applications. Using XML with its powerful parsers and inherent robustness in terms of syntactic and semantic grammar is more advantageous than the conventional method of using a lexical analyzer and a validating parser (cf. Fig. 2, [7]). The conventional method of analysis of program code requires a scanner (lexical analyser) which generates a set of terminal symbols (tokens) followed by a parser that checks the grammatical structure of the code and generates an object . In the object the internal structure of the program is represented by identified objects and the relations between them. Both the scanner and the parser to be used in this method are document oriented which implies that analysis of different types of documents requires rewriting the generated code for the scanner and the parser. An example of an application of this method can be found in [8]. The most promising aspect of using XML instead is that XML and its plementary applications for transformations are standardized so as to provide maximum flexibility to its user. The XML based method is advantageous, since the lexical specification is an invariant ponent of XML。 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 mon