A Formalisation of Automation Petri Nets for Control and Marked Matrix Logic Controllers

A Formalisation of Automation Petri Nets for Control and Marked Matrix Logic Controllers

Copyright © IFAC Control of Industrial Systems. Belfon. France. 1997 A FORMALISATION OF AUTOMATION PETRI NETS FOR CONTROL AND MARKED MATRIX LOGIC CON...

1MB Sizes 0 Downloads 59 Views

Copyright © IFAC Control of Industrial Systems. Belfon. France. 1997

A FORMALISATION OF AUTOMATION PETRI NETS FOR CONTROL AND MARKED MATRIX LOGIC CONTROLLERS A.B. Jones, D. Karimzadgan, S.B. Kenwa)' Intelligent Machinery Division Research Institute for DeSign, Manufacture and Marketing University ofSaljord, SALFORD M5 4/fl', UK ~: +44161 7455999 e-mail: [email protected]. uk

Abstract: Grafcet, and more recently IEC1131-3 SFC, have sought to provide a standardised, easy to interpret graphical programming technique for programming Programmable Logic Controllers (PLCs). Both techniques represent attempts to modify Petri nets to make them applicable to sequential control tasks. However, both depart significantly from the Petri net paradigm. In this paper Automation Petri Nets for Control (APNC) are defined which retain more of the features of generalised Petri nets. Marked Matrix Equations are presented for APNCs which naturally generate Marked Metric Logic Controllers. These are easily implemented on industrial and embedded PC's in high level programming languages. Extrait: Grafcet, et plus recemment IEC 11 31-3 SFC, ont cherche a mettre a disposition une technique graphique standardisee et facile a intepreter de programer les automates programables. Les deux techniques representent des essais de modification des reseaux de Petri aftn de les rendre applicables au contrOle sequentiel de taches. Cependant, toutes deux s'eloignent de fa<;:on significative du concept des reseaux de Petri. Dans cet article, les "Automation Petri Nets for Control"(APNC) sont definis; ils gardent plus de caracteristiques des reseaux de Petri generalises. "Marked Matrix Equations" sont presentees pour les APNC qui, naturellement generent un "Marked Matrix Logic Controller" facilement implemente dans des PC industriels et integres, avec des languages de programation de haut niveau. Keywords: Manufacturing systems, Petri-nets, Programmable logic controllers.

1. INTRODUCTION

ladder diagrams. Although Grafcet is starting to gain an acceptance outside France and Germany, and IEC 113 1-3 has attempted to standardise Grafcet's probable successor Sequential Function Charts (SFC), ladder diagrams and statement list, a sort of enhanced assembly language, still dominate PLC programming. As yet no formal techniques exist for finding sequential control solutions in ladder and

In recent years the adoption of agile manufacturing systems and the e>.:pansion of automation generally in manufacturing has meant the programmable logic controllers (PLCs) are now widespread in industry. Their less versatile predecessors, relay logic controllers, have left them a legacy in the form of

1331

which naturally generates Marked Matrix Logic Controller (MMLCs)

statement list. Petri nets have long been used to model sequential control systems and pro"ide a very effective means of assessing their functionality at the design stage. The models can also be controlled in parallel with the real system and mismatches in behaviour used to flag up fault in the real system. It would be convenient if there was a means of converting Petri net models into controllers for the systems they model. Attempts are being made to synthesise Grafcet from such models (Valette, 1987), but as stated, Grafcet is as yet only the choice of a minority for programming PLCs.

An Automation Petri Net for Control (APNC) is a tuple

C=( P,T,I,Q,Vt,Tmr,t, W', W, Wi , W, A, B,Tv,F) where P, T, I, Q, Vt, Tmr, and t are sets, W, W, Wi, W, A, B are matrices and Tv and F are vectors defined below. P={p},P 2, ... ,Ph, ... ,P n } is a finite, non empty set of n places. T={T),T 2 , ... ,Th, ... ,Tm } is a finite, non empty set of m transitions.

In this paper a definition for an alternative graphical technique for representing sequential control solutions is presented, termed Automation Petri Nets for Control (APNCs). These retain all of the features of generalised Petri nets, enhance them with the addition of a new means of introducing timing and resolve the ambiguity concerning the conditions for transition firing. It has been found that P-timed and T-timed Petri nets are not appropriate for application to sequential control problems and this has motivated a new approach which embraces time by including timers which are treated as though they are hardware devices controlled by the APNC. Moreover, APNCs are readily converted into lECI131-3 ladder diagram, instruction list and structured text language (Jones and Karirnzadgan, 1997; Karirnzadgan and Jones, 1997). This paper is the result of an current research into synthesising APNCs from Petri Net Models (PNMs) and is intended to define APNCs and their matrix representation. Furthermore, APNCs may be readily modified to embrace features of coloured Petri nets to form Automation Coloured Petri Nets for Control (ACPNCs). This will be the subject of a subsequent paper from the authors.

I={I},h, ... ,Ih. ... ,It} is a finite set of f. sensors with binary states. Q={Q},Q2, ... ,Q" .... ,Qp} is a finite set of p actuators with binary states. Vt={ a., p, y, 8, E, S } is the set of the six possible mutually exclusive validation conditions for transition firing: Condition a. is that there be a simultaneous leading edge of the enabling condition and leading edge of the firing condition. Condition p is that there be a simultaneous leading edge of the enabling condition and trailing edge of the firing condition. Condition y is that there be a level enabling condition and leading edge of the firing condition. Condition 8 is that there be a level enabling condition and trailing edge of the firing condition. Condition £ is that there be a leading edge of the enabling condition and a level firing condition.

The matrix representation of APNCs leads naturally to the definition of Marked Matrix Logic Controllers. These allows the rapid implementation of APNCs on Industrial and embedded PC systems in high level languages such as C++ and Pascal. The algorithm itself is presented under the heading on lineMMLC.

Condition S is that there be a level enabling condition and a level firing condition. These conditions have value 0 or 1, where 1 denotes that the condition is true. Tmr={Tmr},Tmr2, ... ,Tmrh, ... ,Tmrq } is a finite set of q on-delay timers.

2. DEFINITION OF AN AUTOMATION PETRI NET FOR CONTROL (APNC)

t={tl,t2, ... ,~, ... ,tq } is a finite set of q delays for the q on-delay timers of Tmr, th being the delay for ondelay timer Tmrh. .

Generalised Petri nets have been well defined (David and AlIa, 1992). The storage of a PN for the purpose of analysis within a computer has been previously described (Murata, 1989).

In the following definitions i and j are the matrix row and column indices respectively, ijE{ 1,2,3 }. is the set of positive integers {O,I,2 }.

r

The technique can be extended to provide a definition for Automation Petri Nets for Controllers,

1332

Matrix W" is termed the input incidence matrix and is of size nxm : W" =[w"jj], where W"ij E is the weight of the simple arc from place P j to transition Tj. If there is no arc the weight is zero.

Matrix B is termed the place timer output matrix and is of size qxn. B=[bij], where bij={O,I}.1f timer Trnrj is associated with place Pj ,bij= 1, and b ij = 0 if not.

r

Vector Tv=[tvj], size m, is termed the transition validation condition vector, where tvi is function of the truth of any single element of, or any ORed combination of the truths of elements from Vt. The value of tviE{O,I}, and tvj=l if and only if the condition is true. Thus Tv associates elements of Vt with elements of T.

Matrix W is termed the output incidence matrix and is of size nxm : W =[w\], where w\ E r is the weight of the simple arc from transition Tj to place Pi. If there is no arc the weight is zero. j Matrix W is termed the inhibitor incidence matrix is the and is of size nxm : W =[w\], where ~ij E weight of the inhibitor arc from place Pi to transition Tj. If there is no arc the weight is zero.

r

Vector F=[f;], size rn, is termed the vector of firing conditions. f; is a Boolean function of the states of the members of I and Trnr, or the tautology (always true, denoted by I), and is the firing condition for transition T j. The value off;E{O,I}, and f;=I if and only if the condition is true. Thus F associates elements of! and Trnr with elements ofT.

Matrix we is termed the enabler incidence matrix and is of size nxm : we =[w'ij], where w'J E r is the weight of the enabler arc from place Pi to transition Tj. If there is no arc the weight is zero. Matrix we is not strictly necessary for APNCs to be able to accommodate enabler arcs (read-write combination operations to transitions ). They may be represented by an entry of the same value (weight) in the same position in both W and Wo. The actual value is not important from the operational point of view. we is included for the sake of consistency with ,and to facilitate the easy transformation from, the diagrammatic representation of APNCs, where enabler arcs are employed to represent read-write simple arc pairs to both draw a distinction and reduce clutter.

By the way of an example consider the APNC of Figure 1: P={P 1,PZ,P3,P4 } T={T 1,Tz,T3 } I={I\'Iz,1)} F = {Ut.!2)+(lt. 1z),Tm1j,!3} = {J;J2J3}

Tmr={Trnrl} t={500} i.e. 500 rnili-seconds

~~'w·=l~

o 0]

Matrix A is termed the place actuator output matrix and is of size pxn. A=[aij], where aij={O,I}.1f actuator Qi is associated with place Pj aij= 1, and aij= o if not.

Input

A=[~ ~ ~ ~l

Boo"'an

PNC

, Function-

Transition TJ

Firing condition fj

/I·h +/1./2

0000]

8=[0 1 0 0]

Output

Table 2 Place description table

,

~.

~:

i

;GJ·:---, : :P2

~.;

DI::>H

O~I

i

~

Table 1 Transition description table

jo

12

ii

:~

01

~~

02

TmTj : Enabling condition

/3 Note:'+', '.'and '-' denote the Boolean OR. AND and NOT operation.

Firing condition

Fig I An eXample of an Automation Petri Net for Control

1333

Place Pi PI Pz P3 P4

Actuators Ql Qz Ql&QZ

fundamental equation. Thus Tmrj is triggered on the leading edge of g~.

3. DEFINITION OF A MARKED AUTOMATION PElRI NET FOR CONTROL (MAPNC) AND MARKED MATRIX LOGIC CONTROLLERS (MMLC).

Vector X=[Xj], size q, is termed the timer state vector, where Xj E {O, I} and

A marked Petri net controller (MAPNC) is a tuple D=(C,M(O»

r 1 if g~(k) > 0 and l0

where C is a APNC as defined above and M(O)=[mi«O») is a column vector of n initial markings, mi(O) being the number of tokens initially in place Pj.

Y=(D, S, V, R, L, E, Ge, Gt,Gr, X), where D is an APNC, and S, V, R, L, E, Ge, Gt, Gr and X are vectors.

Ij(k)= f;(S(k),X(k»

Vector E, size rn, is termed the enabling condition level vector. E=[ej], where <; is the enabling condition level for transition Tj . ej E {O,I} and ej (k)=1 if and only if Vi, i=l.. n, mj(k);::: w"jj and Vi, i=l.. n, mj(k) < ~jj and Vi, i=l.. n, mj(k);::: W'ij .

......(2)

Timer Tmrj is reset when gej = 0, irrespective of whether time tj ,the 'on' delay, has elapsed since the timer was triggered or not. This means that a timer can be reset before and not only after it has timed out. Vector Gr=[grj], size q, is termed the timer reset vector, where if ge;(k) =

l0

otherwise

-<

l0

otherwise

_~

'-----,---,-n ---i

time

~ < t,

time

",b

Thus Tmrj is reset on the trailing edge of g~. Vector Gt=[gtj]' size q, is termed the timer trigger vector, where

gtj (k) = ~

o

o

......(3)

if g~(k) > 0, ge;(k-I) = 0 and tej(k)=O

u

......(7)

,,:D'-----~~

°

r1

......(6)

In other words Ij is the truth level of the firing condition of transition T j.

Vector S is termed the sensor state vector and is of size f. where f. is the number of sensors in C. S=[Sj), where Sj E {O, I} and is the state of sensor Ij. Column vector Ge=[g~], size q, is termed the timer enable vector, gej ET. Ge is updated according to the equation (2)

r1

(5)

Vector L, size rn, is termed the transition firing condition level vector. L=[lj), where IjE{O,I} and

In the following definitions the suffix "(k)" denotes the vector, matrix or element of either after the kth iteration of the fundamental equation for updating markings, equation (9) below. Thus M(k)=[m;(k)] is the marking after the kth iteration of this equation.

grj(k)= ~

otherwise

Zero to q, the number of timers in Tmr, elements of X may be arguments of any transition firing condition f;. It is possible to realise the functionality of bounded P-timed Petri net places and T-timed Petri net transitions locally in APNCIMAPNCIMMLCs if required. The operation of an APNCIMAPNCIMMLC timer is summarised by the timing diagram of Figure 2.

A marked matrix logic controller (MMLC) is tuple

Ge(k) = B M(k-I)

te; (k) ;::: tj

Xi (k)= ~

......(1)

o

ne

time

.

,:r~_

(4)

time

tej(k) being the time elapsed at the kth iteration of the fundamental equation since Tmrj was triggered. Xj(k) is read from timer Tmrj before the kth iteration of the

Figure 2 Timing diagram for Tmr;

1334

Vector V, size m, is tenned the transition validation vector. V=[Vj], where Vi e{O,l} is the validation of transition Tj. A valid (validation = 1) transition fires. V is updated by the rule

situations. Both are described below, but before conflicts can be resolved they must be detected.

\fj=l...m, Vj(k) = value oftvj(k)

U(k) = M(k-l)- W' V(k)

Let vector U=[Uj], size n, be defined by

(8)

...... (12)

where UieZ.

where, as previously described, tvj is the validation condition for transition Tj, and is a function of the truth of any single element of Vt, or any ORed combination of the truths of elements from Vt. The truths of the elements of the VI are defined as

If Uj(k)
r 1 if w·ij > 0

(a) a=l (true) <=> ej(k)= 1, ej(k-l)= 0, Ij(k)=l and Ij(k-l)= O. (b) ~=1 (true) <=> ej(k)= 1, ej(k-l)= 0, Ij(k)= 0 and Ij(k-l)= 1. (c) y=1 (true) <=> ej(k)= ej(k-l)= 1, Ij(k)= 1 and Ij(k-l)= O. (d) 8=1 (true) <=> t;(k)= ej(k-l)= 1, Ij(k)= 0 and Ij(k-l)= l. (e) &=1 (true) <=> ej(k)= 1, ej(k-l)= 0 and Ij(k)= Ij(k-l)= 1. (f) l;=1 (true) <=> t;(k)= ej(k-l)= 1 and Ij(k)= Ij(k-l)= 1.

oij(k) = ~

l0

otherwise

......(14)

If oij(k) = 1 then transition Tj is competing for tokens from Pj. Either conflicts must be resolved by modifying V(k) appropriately for the application, or the fundamental equation (equation (9)) must be modified to read N(k)= M(k-l) - W'V(k) + WV(k) ... (15) where N is a column vector of size n : N=[n;], nj e Z, Z being the set of integers.

Iftvj= a+ y, where '+' denotes the logical ORing of the truths of a and y, then tvj= 1 if and only if

Then M(k)=[mi(k)) is generated from N(k) by applying the rule OR

r ni(k)

if nj(k) > 0

mi(k)=~

l0

The fundamental equation governing the updating of the marking vector M=[mj] and so driving MAPNCs andMMLCs is M(k)=M(k-l) - WV(k) + WV(k) Let column vector H= A M(k)

......(16)

If this modification is made, then the conflict will be resolved in the same manner as Grafcet resolves conflicts. That is, all the conflicting transitions are allowed to fire and so remove more tokens from donor places than may be present in them.

(9)

(10) 5. ON -LINE MMLC

H(k)=[h j ], where hier, is of size p. Vector R=[ri]' size p, is tenned the actuator state vector. rje{O,l} and

In the practical implementation of an MMLC to the control of a sequential manufacturing system, the following algorithm is deployed.

r 1 if hi> O.

rj= ~

l 0 otherwise

otherwise

It is assumed here that a set of rules exist for the resolution of all possible conflicts between transitions, indexed according to the combination of transitions involved. Thus to resolve a conflict detected, it is only necessary to look up the appropriate rule and modify V(k) to suit. Of course it may be required to resolve conflicts according not only to the combination of transitions involved, but also according to a marking history. Such a dynamic

......(11)

4. CONFLICT DETECTION AND RESOLUTION The preceding definition took no account of possible conflicts between transitions. There are two strategies that may be adopted to cope with conflict

1335

resolution strategy is readily accommodated through minor modifications to the algorithm.

Step 1

Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 Step 9 Step 10 Step 11 Step 12 Step 14

Step 15 Step 16 Step 17 Step 18 Step 19 Step 20 Step 21 Step 22

6. CONCLUSION To date there are no formal techniques available for generating sequential control solution in ladder diagram and statement list. Automation Peri Nets for Control have been proposed which combined with TPLL (Jones, et al., 1996) and Automation Petri Nets for Modelling (essentially APNCs with sensors treated as actuators and vice versa) promise to provide such a technique. The definition of marked APNCs leads naturally to an algorithm for their implementation on PC platforms in high level termed Marked Matrix Logic Controllers.

Initialisation: Set M(O) appropriate to the desired safe initial state of the system to be controlled. Apply condition (7) to set E(O) in accordance with M(O). Set R(O) in accordance with M(O) and write the vector to the actuators. Read the sensor states into S to fonn S(O). Set X(O)=Ge(O) = e, the zero vector. Initialise all timers to 'off'. Apply equation (6) to set L(O). Set k=l. Read the sensor states into S to fonn S(k). Evaluate Ge(k) using equation (2). Evaluate Gr(k) using condition (3) and write to the timers. Evaluate Gt(k) using condition (4) and write to the timers. Read X(k) from the timers. Evaluate L(k) using equation (6). Evaluate E(k) by applying condition (7). Evaluate V(k) by applying equation (8). Evaluate U(k) using equation (12). i=1 Ifuj ~ (no conflict) jump to step 15. Evaluate Oi(k) by applying condition (14) and use it to look up the modification required to V(k). Modify V(k). i=i+l If i :S n jump to step 12. Evaluate M(k) using the fundamental equation (9). Evaluate H(k) using equation (10). Evaluate R(k) using condition (11) and write to the actuators. Set all ·(k-l) vectors = *(k) vectors, where • denotes M, E and L. k=k+l Jump to step 2.

REFERENCES David, R and AlIa, H (1992). Petri Nets and Grafcet Tools For Modelling Discrete Event Systems. Prentice Hall, Cambridge. Jones, AH; Uzarn, M; Khan, AH; Karimzadgan, D; Kenway, S (1996). A General Methodology for Converting Petri Nets Into Ladder Logic: The TPLL Methodology. In: Proceedings of the CIMAT'96, France, May 29-31, 357-362. Jones, AH; Karimzadgan, D (1997). Transforming Automation Petri Nets For Control into IEC1l31-3 Instruction Lists Using The TPL Methodology. In: IFAC Workshop on Manufacturing Systems: Manufacturing Modelling, Management and Control (MIM'97), Vienna, Feb 3-5, 63-68. Karirnzadgan, D; Jones, AH (1997). Design of Discrete Event Control System for IECl131-3 Compatible PLCs. In: IFAC Workshop on Manufacturing Systems: Manufacturing Modelling, Management and Control (MIM97), Vienna, Feb 3-5, 105-110. Murata, Tadao (1989). Petri Nets: Properties, Analysis and Applications. In: Proceedings of the IEEE, Vol. 77, No. 4, 541 - 580. Valette, R (1987). Nets in Production Systems. In: Advances in petri nets, Spinger-Verlag, 255, 191-217.

This algorithm has been implemented in the C++ programming language and run on a PC platfonn to control a number of moderately fast and complex agile manufacturing systems. It will be readily appreciated that as the speed and complexity of the systems to be controlled increase the burden on the processing platform increases until a point is reached where the loop execution time is inadequate for the system speed. This is true for all centralised sequential control strategies, but because for this method the loop time is approximately proportional to the number of a APNC transition multiplied by the number of a APNC places, perhaps this point is reached more rapidly than for other strategies.

1336