Barker 1996 Micro Processing and Micro Programming

download Barker 1996 Micro Processing and Micro Programming

of 20

  • date post

  • Category


  • view

  • download


Embed Size (px)

Transcript of Barker 1996 Micro Processing and Micro Programming

  • 8/9/2019 Barker 1996 Micro Processing and Micro Programming



    MicroprocessingandMicroprogrammingMicroprocessing and Microprogramming 41 (1996) 737-756

    A graphical simulator for programmable logic controllers basedon Petri netsH.A. Barker, P.W. Grant * J. Song

    Departm ents o f Electrical and Electronic Engineering and of Computer Science, Uniuersiry of W ales, Sw ansea, Singleton Park, Sw ansea,SA2 8PP, UK

    Received 6 February 1994; revised 2 June 1994; accepted 27 October 1995

    AbstractIn this paper an extended Petri net, the programmable logic controller net (PLCNet) is defined. A rule-based PLCNet

    simulator has been designed based on the semantics of PLCNets, with facilities provided to set up and control simulation.Both step and time responses are provided for the presentation of simulation results. A graphical environment is provided forthe construction of the PLCNet, simulation and the presentation of simulation results.Keywords: Programmable logic controller; Discrete event dynamic system; Simulation; Rule-based systems; Petri nets

    1. IntroductionIt has been over a decade since Petri nets [12] were first applied in process control. As early as 1980, acompiler which maps a Petri net description into Intel 8085 assembly language was designed for control

    purposes [6]. In the same year, a simulator and controller, implemented on a minicomputer with a primitivegraphical display, were developed, based on a marked flow graph, a subset of the Petri net model. The simulatorwas used to eliminate deadlock in control systems [ 111. Later this work was transferred to programmable logiccontrollers (PLCs), the first application of this type being described by 191. Based on their work, a C-net wasproposed at Hitachi to design a station controller, the cell level of their factory automation project [lo]. Petrinets have also been used to replace conventional ladder diagrams in the design of programs for PLCs [7]. This

    l Corresponding author. Email: 0 1996 Elsevier Science B.V. All rights reservedSSDI 0165-6074(95)0003 1-3

  • 8/9/2019 Barker 1996 Micro Processing and Micro Programming


    738 HA . Barker et al./Mi croprocessing and Mi croprogramm ing 41 (1996) 737-756

    work shows that the Petri net is a powerful representational method for the modelling, simulation andprogramming of PLCs.There are, however, still many important aspects which have not been fully investigated. PLC applicationsare mainly restricted to sequential control processes, and modelling often depends on the users personalunderstanding of the system and interpretation of the Petri net, resulting in different representations for the samesystem. A systematic modelling methodology is not yet available and the method of presentation of simulationresults is limited to the flow of tokens.

    In this paper an extended Petri net, the program mable logic controller net (PLCNet), will be introduced anda set of operational rules used to simulate PLCNets. A rule-based simulator is designed which follows closelythe definitions of the PLCNet and its operational rules. Various facilities are used to set up and control thesimulation and time and step responses are used to present the simulation results. The simulator is embedded inan interactive graphical environment, the Control Engineering workstation (CES) [ 1,3,4]. This has beendeveloped as a general purpose graphical environment for the design, simulation and implementation ofdynamic systems, particularly for control. More recently, a thorough redesign and reimplementation of CESusing the X windows environment has been undertaken which is called extended X-based Control engineeringworkstation (eXCeS) [2].

    2. eXCeSeXCeS makes full use of modem computer graphics workstation technology conforming to the OPEN LOOK

    look and feel. A tool-based design policy separates the user-interface from the applications. The tools can runconcurrently on a single workstation or on several remote workstations across the network using the X-protocol.In particular, eXCeS provides an integrated environment to prototype discrete event dynamics systems [3,4]

    for each level of a flexible manufacturing system. At the job-shop level, simulation and analysis tools have beendeveloped based on Petri nets. At the cell level, modelling, simulation, implementation and transformation toolshave been designed for PLC applications based on three graphical models - Petri nets, ladder diagrams [ 141 andGrafcet [8]. The modelling tools allow users to construct control processes graphically. The simulation toolsallow logical errors to be detected and corrected before the implementation phase. The implementation toolsprovide a graphical programming environment in which various PLC codes can be generated directly from thegraphical models. Transformation tools allow one kind of graphical model to be converted into another so thatusers can work with their preferred representation, yet still access others [13]. This paper, however, describesonly the design of the simulation tool for PLCs based on Petri nets.3. Programmable logic controller nets

    To introduce the programmable logic controller net (PLCNet), a simple wagon control process is used as anexample. A wagon is initially at rest. When the start button Xl is pressed, the wagon moves forward. As aresult, both states Sl and Y 1 receive a token. The token at Sl indicates the system reaches the system state Sl,the token at Y 1 that the motor is energised. The movement of the wagon will eventually cause it to encounterthe limit switch X2. This external event is modelled by e3. When the limit switch X2 is encountered, the

  • 8/9/2019 Barker 1996 Micro Processing and Micro Programming


    HA . Barker et al./ Mi croprocessing and Mi croprogramm ing 41 (1996) 737-756 739



    Fig. I. Petri net for the sequential process.

    wagon moves backward, adding a token to both S2 and Y2. This simple sequential control process can bemodelled by using a Petri net, Fig. 1.

    Initially, a token is added to the state Xl representing the action that the start button has been pressed.According to Petri net firing rules, the event el is enabled. The firing of el removes the token at X 1 and adds atoken to Sl and Y 1. The removal of the token by el indicates that the button has been released, the token at Slthat the system reaches a new stage. This system stage denotes that the wagon is moving forward. The token atY 1 models the motor being energised. The enabling conditions for e3, require a token at Y 1 and no token atX2. These two conditions are met by the current status of the system illustrated in Fig. 1. Event e3 is thereforeenabled, which means the wagon encounters the limit switch X2. The firing of e3 will remove the token at Y 1and add a token to X2 and Y 1. As the token at Y 1 is removed and added at the same step, the total number oftokens remains constant. The token at X2 represents that the limit switch is energised, the token at Y 1 themotor is still energised when the wagon encounters the limit switch X2. This observation conforms with thephysical reality. Now the event e2 is enabled. The firing of e2 removes the tokens at Sl, Y 1 and X2 and addsa token to S2 and Y 2. The firing of e2 models the wagons movement backwards. The removal of the token atY 1 indicates that the motor is de-energised. The removal of the token from Sl and the addition of the token toS2 models that the system status is transformed from the wagon moving forward to the wagon movingbackward. The addition of the token to Y2 models that the reversing motor is energised.Notice there are three types of states in Fig. 1: the system states (SYS) Sl and S2, the physical output states(PHYOUT) Y 1 and Y 2, and the physical input states (PHYIN) X 1 and X2. As some physical input states areinitiated by users and others by the actions of physical output states, two sub-categories are identified - userdriven physical input states (USERDRIVEN), such as Xl, and physical driven physical input states(PHYDRIVEN), such as X2. Two types of events can be identified - internal events and external events.Internal events occur in PLCs and external events take place in the environment. In Fig. 1, el and e2 areinternal events and e3 is an external event.

    The disadvantage of the representation above is its complexity. Even for the simplest of control systems thecomplexity of the resultant model is evident. The size of a model soon becomes overwhelming in modelling reallife control systems. A complicated model is not only hard for users to understand, but also requires morecomputational resources. However, these disadvantages can be overcome by transforming the Petri net to asimplified form. The idea behind the transformation is to remove some parts of the Petri net and toautomatically generate the missing components from the existing ones. The corresponding semantics, defined bythe Petri net operational rules, has to be modified to reflect these structural changes.

  • 8/9/2019 Barker 1996 Micro Processing and Micro Programming


    740 HA. Barker et al./Microprocessing and Microprogramming 41 (1996) 737-756

    YI e3 x2 Y2Fig. 2. Petri net for the sequential process with a virtual event.

    The first technique is to simplify the structure of models by introducing a new type of event called a virtualevent (E, ). Ordinary events in a Petri net are then referred to as concrete events (Ec). The semantics of virtualevents are informally stated as follows:a the enabled conditions for a virtual event are the same as those for a concrete event,l the firing of a virtual event will not, however, remove the tokens at its input states, but will add tokens to its

    output states as usual.The semantics of virtual