tr pn-dae model

simulation of a gas storage unit. The model is ... associated in order to represent the significant laws of ... us see how Pr/Tr PN-DAE is used to model the gas stor-.
98KB taille 42 téléchargements 317 vues
MODELING AND SIMULATION OF A HYBRID SYSTEM THROUGH PR/TR PN-DAE MODEL  

 



Ronan CHAMPAGNAT , Philippe ESTEBAN , Herv´e PINGAUD , Robert VALETTE  

: LAAS-CNRS UPR 8001, 7 avenue du colonel Roche, F-31077 Toulouse C´edex 4, France  : Universit´e Paul Sabatier, 118 Route de Narbonne, F-31062 Toulouse C´edex, France : Laboratoire de G´enie Chimique UMR CNRS 5503, ENSIGC, chemin de la loge, F-31078 Toulouse C´edex, France Tel: +33 (0) 561 336 416; Fax: +33 (0) 561 336 936; E-mail: [email protected]

Abstract This paper deals with the modeling and simulation of a gas storage unit. The model is based on a combination of Petri nets and differential algebraic equations. The interaction between the Pr/Tr Petri nets and the equations is formally defined by means of enabling and junction functions which are attached to the Pr/Tr Petri net transitions. After introducing the modeling technique and illustrating it on the gas storage unit, a simulation algorithm is described.

dustry and fine chemistry processes are the most common examples [PIN 96, JAL 90]. The supervisory control of such processes requires hybrid modeling techniques. Actually, the modeling of the state of the material through the process requires a continuous representation, when that of the sequences of configurations implies finite state-machines or Petri nets. Various approaches have been developed to model hybrid systems [ALL 95, AND 95, AUD 95, CHA 96, DAV 87, DEM 96, GOM 96, VAL 95]. Some introduce boolean ´ Titre MODELISATION ET SIMULATION D’UN variables in continuous models, other ones start from discrete models and add continuous aspects to them. ` ` L’AIDE D’UN MODELE ` SYSTEME HYBRIDE A It is also possible to combine the use of two wellRdP Pr/Tr - EAD established models: Petri nets and differential algebraic equations. R´esum´e Cet article traite la mod´elisation et la simA model combining Predicate/Transitions Petri nets ulation d’une unit´e de stockage de gaz. Le mod`ele est bas´e sur la combinaison de r´eseaux de Petri et (Pr/Tr PN) and differential algebraic equations (DAE) d’´equations alg´ebro-diff´erencielles. L’interaction entre has been developed [CHA 97]. The PN represents the les RdP Pr/Tr et les e´ quations est formellement d´efinie different configurations of the system. With each cona` l’aide des fonctions de sensibilisation et de jonction figuration, a set of differential algebraic equations is qui sont associ´ees aux transitions du RdP Pr/Tr. Apr`es associated in order to represent the significant laws of avoir introduit la technique de mod´elisation a` travers physics in this specific context. Data structures are asl’exemple de l’unit´e de stockage de gaz, un algorithme sociated with Tokens. They are fragments of the state variables. Two functions are associated with the transide simulation sera pr´esent´e. tions. The first one, the enabling function, determines an extra enabling condition. Generally it expresses that some state variables reach a significant threshold (the 1 INTRODUCTION first solution of an equation

 , where is a Hybrid systems cover a wide area. The kind of hybrid fragment of the state vector and  is the current time). systems we are interested in are systems which deals The second one, the junction function [BAR 94], comwith a continuous raw material. This material goes putes the initial values of the unknown components of through continuous equipments as separation equip- the state vector according to the next configuration. It ment, and discrete ones as batch reactor. Food in- operates on the state variables stored on the tokens in-

volved by the transition firing. The paper will present a Pr/Tr PN - DAE model of the gas storage example defined by [CHA 98] using exactly the same notations. The storage is used as a buffer between a production unit and a customer unit. The material stored is continuous (gas). And the configuration of the process depends of the input flow rate and of the output flow rate. This paper will underline the description of the junction function and the enabling function. In a last part the simulation algorithm will be described, and simulation results will be presented.

Pl10

T9 T10

Pl9

T13

T15

Pl11

T14 T17

GAS STORAGE MODELING

T21 T18

T20 Pl13

Pl12

In this section the storage is described. It is the most important part of the unit. The description underlines the PN and DAE interactions. The model defined by [CHA 97] introduces differential algebraic equations, a set of variables and enabling and junction functions. Let us see how Pr/Tr PN-DAE is used to model the gas storage. On one hand there is a discrete model which is commonly used to define discrete states of a process. On the other hand there is a continuous model which is used to model the behavior of a process in one configuration. The discrete model has a more abstract view of the process than the continuous one. The Pr/Tr PNDAE model, which combines the two views, is based on the following principle: a PN monitors a set of DAE. The gas storage has five discrete states. The four configurations presented in [CHA 98] and a break-down state. As a consequence, the PN model has five places (figure 1). Small icons are attached to the places. They represent the corresponding configurations of the storage. Place  ! corresponds to the first configuration, place to  " the second configuration, place to the third con $# figuration and place to the fourth one. The system can go from one configuration to any other ones. It is  # represented by transitions % to % . Only the third and the fourth configurations can lead to the break-down  '& state (represented by place ), through transitions #" # % and % .

T22

Figure 1: Pr/Tr PN-DAE of the gas storage

crete state, the set of marked places gives the set of active equations. This set of equations has to be consistent and homogeneous in order to have a solution. The equations represent the behavior of the storage in the different configurations. In the fist configuration, the storage is by-passed, so there is no associated equa '& tions. Place ditto. The equations are given in table 1. They comprise a differential equation ( +-,/.01+324 ...) and a non-linear algebraic one ( 56.7 ...). $ "  * *

*

2.1 Description of the associated equations )(

T12 T16

T19

2

T11

$#



 & 

98

 &  . :;=<  :?> @  +BADCE+GF  .B5H.IJ,/.KL% #  P  5H.MN ? .OC  QRB1?S"T I P Q U1VGUHWYX7Q .  & 98   &  . :;=<  :?> ZC+GF  .B5H.IJ,/.KL% #  P  5H.MN ? .OC  QRB1?S"T I P Q U1VGUHWYX7Q .

Table 1: Associated equations

(

When a token is put into a place , the equations * , associated with this place, are activated. At each dis2

 !   !# '&  8

2.2 Data structure and token

The PN model of one equipment is composed of a unique P-invariant: the finite state-machine of all its states. The process which is composed of a set of equipments, is modeled by a set of state-machines because the modeling strategy is based on modules. The combination of all the state-machines (considered as sub-nets) produces the PN model.



The number of tokens in a subnet representing an equipment (there can be more than one token in a Pinvariant, if there is a pool of equipments) remains constant. Each token carries the variables which are involved in the equations associated with the places of the corresponding P-invariant (one token and one instance of the equations for each equipment in a pool).





!Sj !l 'm !  # #  ##

+ A Cb+ FMc  + ACb+GFIZ B +BACb+GFMd@ and +BA c  +BACb+GF c  +BACb+GFIZ + A Cb+ F d@ and + A c    +BAe@ or .fCbX1gh or V ALC  + A Cb+ FMc  and . CEXGXkd@ +BACb+GFMd@ and +BA c  +BAe@ +BACb+GFIZ +BAe@    V A C . dn or . CbVoedn pG   .4C FMdq or .4CrVoed@ 

.id@

Table 2: Storage enabling functions

The gas storage requires seven variables ([ .?\]  ^  & 9  8   _   .   , . 5 . ?%M ) and one global parameter ^ _ ` K ). These variables represent the storage ( \] 

2.4 Presentation of the junction functions

in one configuration. Based on the law of physics it is possible to write equations. Generally the number of equations is less than the number of variables (for the storage there is 7 variables and 5 equations). The aim of this model is to allow direct simulation. As a consequence the system must be homogeneous (it must involve the same number of unknown variables and equations) for each configuration. Variables are partitioned into a set of unknown variables (which are computed by the equations) and a set of parameters (whose derivate is equal to zero). Every configuration of the storage must be described by an homogeneous system of equations, but variables partitioning may differ from one configuration to another.

The second function attached to the transitions is the junction function ( s ) [BAR 94]. It computes the initial values of the variables for the next configuration (that of the marking resulting from the firing). It also de termines the variable partitioning ([ . t[vu ) into unknown variables and parameters. Table 3 gives the junction functions of the gas storage model. w ! wH'& w !

 &   & 9   & 

8

 

 8   8 

A



 

A A

Table 3: Storage junction functions

3

2.3 Presentation of the enabling functions The representation of the interactions between the discrete and the continuous views is achieved by two functions associated with the transitions. The first one is the enabling function a which is an extra enabling condition for the transition. This means that transition % will only be fired if its inputs places have at least one token and if aI % is true. It expresses that the value of the continuous variables carried by the tokens, has reached a significant threshold inducing a configuration change.

MODELING OF THE OTHER EQUIPMENTS OF THE UNIT

The previous section describes the modeling technique through the gas storage description. This section presents the modeling of the other equipments of the process.

3.1 Input compressor modeling

The input compressor (IC) has two different states. EiTable 2 gives the enabling functions associated with ther it is on or off. The Petri net model is given in figthe storage model. ure 2. Table 4 gives the associated equations, the en3

 8

abling and the junction functions. The variables carried ^1y P#  _ by the token are: [ . \ x  F'z{  A .

& %

#  %

%

 & #

Figure 4: Pr/Tr PN-DAE model of the OC

 

7 gives the associated equations, the enabling and the junction functions. The variables carried by the token ^Gy~‚„   _ …   F ?% . are: [ .?\ˆ 

Figure 2: Pr/Tr PN-DAE model of the IC  * # *





# wH w #

8 %

S

 #  hV A  # P   A  &L| AC   & AC c  y~} zZHW o€g1g y } zZ

 m %

l %

m

 l

Figure 5: Pr/Tr PN-DAE model of the OD Table 4:

4

3.2 Input dissipator modeling

PRODUCTION STRAINTS

CON-

The input dissipator (ID) has two different states. Either it is on or off. The PN model is given by figure 3. Table The production and consumption constraints are mod5 gives the associated equations, the enabling and the eled by a sequential PN. There are no equations assojunction functions. variables carried by the token ^1yƒ‚„ The  #  & _ ciated with the places because the production and conx   ?% . are: [ .!\  sumption flow rates are assumed constant during each  j time interval. These constraints are thus simple parameters whose values jump from one value to another at j % % pre-determined time points as it is specified by the corS responding junction functions.  The model of the production constraints (PC) (predeS fined production policy) is given by figure 6. Table 8 gives the enabling and the junction functions. Note that Figure 3: Pr/Tr PN-DAE model of the ID the enabling functions only depend of the time. The ^  _ variables carried by the token are: [‰. \Š  A‡+BA . They are parameters (no unknown variables). 3.3 Output compressor modeling The consumption constraints (CC) (customer deThe output compressor (OC) has two different states. mand) are represented by figure 7. Table 9 gives the Either it is on or off. The PN model is given by figure 4. Table 6 gives the associated equations, the enabling and y ‚ „  j x h * KL%Œ‹)ŽH …‘ ’ the junction functions. The variables carried by the to^1y }‡† 8  _   #  &   ken are: [ .!\…  . C c  S



3.4 Output dissipator modeling The output dissipator (OD) has two different states. Either it is on or off. The model is given by figure 5. Table

jS

w€j

P# C y ‚ „

9&

h x Z

Table 5: 4

# 8 %

# %

 &B

% S

  8

#j

 

%

#l %

 $j

#!m

 !l

%

#"

 'm

 !

S

Figure 6: Pr/Tr PN-DAE model of the production constraints

8 *

&



 &

*

8 w1& w 8

p198   S  8  S |@ 98 F  8  F c yƒ} † p1pG“ ZHW yƒ} † Z

#jS # l #?m #  w€# 8 w€# w #"jS w€#"l w #!m w #"

Table 6: m *

l



m w m

† KL%”‹)•ŽH ]3‘‰’    c F  S   F y~S ‚„ … h y

‚ „

… Z

24hg 24NRGR 24NRBU 24NRBg 24NRB˜  p Ak  Ak™R  A Z  Ak™R  p A   p A 

p G11G1G  , +BAk p , +BAk™R—G11G1G , + A @ p , +BAk™R—G11G1G  , + A ™R—G11G1G p  ,+ A  G11G1G

Table 8: plicated on various tokens. The values of these variables may be modified at the discrete time points by the discrete simulator and have to be computed along continuous time by the continuous simulator. There are two representations of the variables, one for the discrete part and one for the continuous part. They are synchronized each time the algorithm enter a part. Let us look at the algorithm just after an event has been detected. The first step consist in computing the variables at the exact time that the event occurred. Then the variables, carried by the discrete part, receive the value of the variables carried by the continuous part. Then the transition is fired. The tokens are moved, the active equations are removed from the continuous part, the enabling functions are desactivated and the junction functions are computed. The variables of the discrete part can be modified by them. So, the following step consist in updating the continuous part variables with the discrete part ones. The system entered in a new state. The enabling functions are activated. If one is enabled, the corresponding transition must be fired, and the algorithm goes to step one. Otherwise it goes to the next sampled time point, the new value of ,/. is computed from the derivate  equation. Then . is computed by the Newton algo-

Table 7: enabling and the junction functions. The variables car^  _ F—+GF . ried by the token are: [ . \– 

5 SIMULATION MODEL

#

OF

THE

The simulation of such a model requires to combine a token player algorithm and a DAE model simulation. This section deals with a simulation algorithm that computes Pr/Tr PN - DAE model. The token player algorithm monitors the continuous simulation. The token player algorithm corresponds to the one of a high-level Petri net, because the tokens carry data structures, and there are functions associated to the places. The continuous simulation is based on Newton algorithm, the time is sampled in discrete intervals. At each discrete time point the non-linear equation is computed by the Newton algorithm. The diagram (figure 8) presents the simulation algorithm. The algorithm is based on the combination of two algorithms, a discrete one and a continuous one. Variables are carried by the tokens. Some variables are du5

&š %

 &#

%

&B

 #

%

&#

 #

%

&&

 ##

%  #?&

& 8 %  # 8

& % S  #

&j %  #j

&šl %  #l

&m %  #?m

&š %  #

8

 &š

S

Figure 7: Pr/Tr PN-DAE model of the customer constraints &B &# && & 8 & &jS &l &m & 8 w & w1&B w1&# w1&& w & 8 w1& w &jS w &l w1&m w & w 8

2I 2 2 ZU I 2I›o 2IZV 2IZX 2IZg “ 2I 2I™Ro 2I™R—V 2I™R—X  p p  ,+ F  V1G11G F  +GFIZV1G1G11 +GFI›o{G1G11 +GFIZV1G1G11 + F ™R—XG1G11G “ +GFI™R 1G11G + F ™R—˜G1G11G p + F  G1G11G “ +GFI™R 1G11G + F ™R—˜G1G11G +GFI™R—G1G11G

introducing enabling and junction functions, and deals with the state variables distribution. Hence a simulation algorithm of this model is described. The gas storage is a hybrid system. It requires discrete and continuous variables to be modeled. Discrete variables represent the state of the equipments and some decision. It is less complex than the continuous representation. The discrete part is described by a set of simple state variables. Furthermore the system is simplified and only the case with one input compressor is considered. A pool of compressor, in this representation will be represented by adding tokens in the model of input compressor. Each token will instantiate a set of equations of its corresponding place. The continuous part is more complex, and is entirely represented by the model. However the way state variables are distributed and the domain definition of variables involved by the set of equations and the enabling functions is not well represented. As a consequence, the homogeneity of the set of equations (with respect to the size) is not easy to guarantee. All the states and the events that lead to these states must be checked. A perspective of this work will be to develop the model analysis and design rules to deal with this problem. The advantage of Pr/Tr PN - DAE is that a model of a hybrid system has been derived using a single model description. Discrete and continuous parts are represented within a unique integrated description. In addition it can be directly used for the supervisory control. This model can also be used for detection/diagnosis purpose. It can be simulated concurrently with the real system. It can detect abnormal discrete state changes (the system does not go into the desired state, or remains a too long time in one state), and detect deviation of continuous variables (by the way of enabling functions).

Table 9:  

rithm. The function œ . is derived from the combi nation of equation # .5H. ,/.KL% and equation 5H.   P 

! .kC QR—1?ST QžUGV1UHWYXŸQ . in order to elimi    nate 56. . +'œ is the derivated of œ by . . œ is calcu  lated, !if¤ œ is greater than¤ the desired precision, +'œ and ¤ x   < e ¢¡£ ‰ ¢¡   . . C@: ¥ x   P¦Y< §!¨ ¤ are calculated. When œ ."   ¦ §?¨

¥ is less than the precision, the other variables are calculated. At this moment the extra enabling conditions must be watched as described in the previous paragraph.

6 CONCLUSION ACKNOWLEDGMENT This paper presents the Pr/Tr PN-DAE model through an example of a hydraulic subterranean gas storage. It This work has been partially supported by the underlines the interactions between PN and DAE by MENESR project “Modeling of event driven industrial 6

processes”.

[GOM 96] M.M. Gomaa and S. Gentil. Hybrid industrial dynamical system supervision via hybrid continuous causal Petri nets (HC2PNS). In P. Borne, J.C. Gentina, E. Craye, and S. El Khattabi, editors, Proceedings of CESA’96, pages 285–290, Lille (France), July 1996. IEEE-SMC.

References

[ALL 95] H. Alla. Modelling and simulation of event driven systems by Petri nets. In Proceedings of [JAL 90] C. Jallut and G. Gilles. Automatique, producADEDOPS, London (England), April 1995. Impetique et proc´ed´es chimiques discontinus. RGE, (6), rial College. June 1990.

[AUD 95] N. Audry and F. Prunet. Comparison of ex- [PIN 96] H. Pingaud and R. Valette. L’approche tended Petri nets for high throughput production r´eseau de Petri dans le cadre de la simulation, lines accurate modelling and simulation. In Prode l’optimisation et de la conduite des proc´ed´es ceedings of ADEDOPS, London (England), April batchs. In X. Joulia, editor, SIMO’96, volume 1995. Imperial College. 10-1996, pages 39–68, Toulouse (France), October 1996. Groupe Francais de G´enie des Proc´ed´es. [AND 95] D. Andreu, J.-C. Pascal, H. Pingaud, and R. Valette. Batch process modelling using Petri [VAL 95] C. Valentin-Roubinet. Modelling and simulation of sequential hybrid dynamic systems. In nets. pages 314–319, San Antonio (USA), October Proceedings of ADEDOPS’95, London (England), 1995. IEEE-SMC. April 1995. Imperial College. [BAR 94] P.I. Barton and C.C. Pantelides. Modeling of combined discrete/continuous processes. AIChE journal, 40(6):966–979, June 1994. [CHA 96] R. Champagnat, P. Esteban, H. Pingaud, and R. Valette. Petri net based modeling of hybrid systems. In Proceedings of ASI’96, pages 53–60, Toulouse (France), June 1996. LAAS-CNRS. [CHA 97] R. Champagnat, P. Esteban, H. Pingaud, and R. Valette. Modeling hybrid systems by means of high-level Petri nets: Benefits and limitations. In M. Ferney P. Borne, A. El Moudni and L. Gruji´c, editors, Proceedings of CIS’97, volume 1, pages 469–474, Belfort (France), May 1997. ENIBeLMP, IFAC, IFIP, IMACS. [CHA 98] R. Champagnat, H. Pingaud, H. Alla, C. Valentin-Roubinet, and J.-M. Flaus. A gas storage example as a benchmark for hybrid modeling. In Proceedings of ADPM’98, Reims (France), March 1998. [DAV 87] R. David and H. Alla. Continuous Petri nets. In Proceedings of the eighth European Workshop on Application and Theory of Petri Nets, pages 275–294, Zaragoza (Spain), June 1987. [DEM 96] I. Demongodin and N.T. Koussoulas. Modeling dynamic systems through Petri nets. In P. Borne, J.C. Gentina, E. Craye, and S. El Khattabi, editors, Proceedings of CESA’96, pages 279– 284, Lille (France), July 1996. IEEE-SMC. 7

Synchronize the integrator to the exact event occurence date if necessary Update the token variables from the integrator variables Fire transition Ti Compute the junction function Ji Update the integrator variables from the token variables Activate the enabling functions

Ei enable ?

t = t + dt Compute Us Compute f1

|f1| < precision ?

Compute df1 and Ps Compute the other variables

Figure 8: Simulator algorithm

8