Object Hybrid Formalism for Modeling and Simulation of Chemical Processes

Object Hybrid Formalism for Modeling and Simulation of Chemical Processes

IFAC [:0(> Copyright I;) IFAC Analysis and Design of Hybrid Systems, Brittany, France. 2003 Publications www.elsevier.comllocatelifac OBJECT HYBRID...

741KB Sizes 1 Downloads 50 Views

IFAC [:0(>

Copyright I;) IFAC Analysis and Design of Hybrid Systems, Brittany, France. 2003

Publications www.elsevier.comllocatelifac

OBJECT HYBRID FORMALISM FOR MODELING AND SIMULATION OF CHEMICAL PROCESSES

J.Perret, G. Hetreux, J.M. Le Lann

Laboratoire de Genie Chimique (LGC - UMR 5503). department PSE. 5 Rue Pau/in Ta/abot. 31106 Toulouse Cedex 1. France E-mail: .focelvlle.Perret(l1)ensiacet.fi-.Gilles.HetreuxCplensiacet.fr. .feanMl1rc. LeLannCw.ensiacet. {i'.

Abstract: PrODHyS is an object-oriented environment for the dynamic simulation of chemical and para-chemical process engineering systems. It provides common and reusable components designed for the built and the management of dedicated simulators. This paper focuses on the "Object Differential Predicate- Transition Petri Net" (ODPTPN) formalism used to model hybrid processes. Copyright © 20031FAC Keywords: hybrid dynamic simulation, ODPTPN model, object-oriented approach, process system engineering.

aspects and their interaction have been defined or extended. We can mention: hybrid automata (Alur et aI., 1995). predicate-transition-differential Petri Nets (Champagnat et al.. 199R). hyhrid Petri Nets (Le Bail et al.. 1991). hybrid statecharts (Kesten and Pnueli. 1992). In the same way. PrODHyS is turned towards a hybrid modelling of processes. binding the continuous aspects (described by differential algebraic equations ) and discrete ones (described by Petri nets) . Another significant characteristic of PrODHyS is its object structuration. approach which emerges today as a concrete and efficient answer to extensibility. reutilisability and software quality needs. Thus. the simulation kernel was designed around the ohject differelltial predicate-transition Pelri net (ODPTPN) formalism which exploits the complementarity between object approach and hybrid formalism.

INTRODUCTION With the growth of the power of calculators, dynamic simulation becomes an essential study tool in process design and analysis. In this context, the research undertaken these last years within the Laboratoire de Genie Chimique (LGC) lead to the implementation of a development platform of processes simulators named PrODHyS (Process Object Dynamic Hybrid Simulator). Moreover. the evolution towards batch production processes confront modellers with operating modes. often difficult to manage with purely continuous or purely discrete dynamic models. For this reason. hybrid dynamic systems is a great field of interest for researchers (Zaytoon, 200 I) and many simulation tools have been developed to specify them. We can mention for instance gPROMS (Barton and Pantelides, 1994), Shiji (Deshpande et al. . 1998). Ol11sim (Andersson. 1994). Chi (Fabian et al.. 1998). BaSiP (Wollhaf ('( al.. 1996). In parallel. many models describing both discrete and continuous

The purpose of this paper is to present the formalism used to describe and manage this hybrid dynamic feature . First of all. a preliminary presentation of the platform is realised.

277

Discrete

Hybrid place

PrODHyS

FG=rilit >:;:5B,

{Moaet , }

¥riCI~i

{Moae/ , }

Fig. 2. Graphical representation of an ODPTPN

······} !f= ~'i; I

(Events) (Actions)

v

system. Each token is a generic entity which carries a class instance made up of both a set of attributes (including continuous variables) and a set of methods which deals with these data (including equations which can be added to the model relative to the place). So, the type of a token corresponds to the class of the carried object. The enabling function (or event) is a logical condition made up of attributes and methods carried by tokens enabling the transition and/or attributes and methods which come from the object that includes this Petri net. The junction functions (or actions) instantiate or delete tokens and perform the methods offered by tokens crossing the transition or methods belonging to the object including this Petri net. The aim of these actions not only consists in computing the initial values of the continuous variables, but also in modifying the state of the token. In addition, the input and output arcs are also explicitly typed. They carry an inscription specifying the type of objects allowed to forward through this arc. This mechanism with individualisation of the token makes the network more compact without information loss.

Rellctk~I'·t··. -=oii~~:n.~l p~~~ "COI""~} =1 . . u >.• .\.;....v.. . ..:. .....•.•i.••.•.•.•. •...•...••'.•.·.• ~ ·IIj!ij~IM

Fig. 1. Structure of the platform PrODHyS I. THE SIMULATION ENVIRONMENT

1.1 General structure of the platform The design of PrODHyS follows a life cycle software development process based on the use of UML and C++. The object technology allows a modular and hierarchical modelling of processes. So, the derivation of the general elements provided by PrODHyS enables the built of more complex specific entities via mechanisms such as composition, inheritance and polymorphism. Notc thet this platform constitutes the unification of works performed since several years (Moyse, 2000; Sargousse, 1999; Jourda et aI., 1996). Currently, PrOD~vS consists of more than one thousand classes distributed in six main packages. Figure 1 shows the global structure of the platform.

The exploitation of the object approach within PrODHvS is carried out in two ways. The first one is to intr;duce objects into Petri nets. The subjacent philosophy is to model a subsystem by a single Petri net which handles individualised tokens carrying information. The network thus models the control structure of the system whereas the tokens represent the associated data structure. The second one is to introduce Petri nets into objects in order to describe its internal behaviour. The marking of the network indicates the current state of the object: the crossing of a transition involves the execution of one of its methods and the global structure of the net specifies the legal execution sequences of the methods.

1.2 Hybridformalism considered The formalism ODPTPN. which rests on a mixed approach is characterised primarily by two aspects:

The dynamic and behavioural aspects: The ODPTPN model uses the predicate-transition difFerential Petri net model defined by Champagnat (Champagnat et aI., 1998). Within this model, a differential algebraic equations system (OAE) is associated with each hybrid place of the network. This one binds local continuous variables of a place and the variables carried by the tokens marking this place. A token put in a place initiates the resolution of the corresponding OAE system and then. involves the continuous evolution with time of variables. This constitutes the dynamic part of the model. Regarding the behavioural part. the solver guards at the same time the enabling functions of each transition below the marked place. When the condition is checked (occurrence of an event). the associated transition is crossed. A new marking is set up and activates the corresponding OAE system for which, the initial values of variables are given by the junction functions of the above transitions.

Figure 2 shows the adopted representation in order to describe the formalism ODPTPN.

1.3 The simulation kerl1e/ [n order to implement the formalism ODPTPN. the simulation kernel is break down into three modules: the discrete solver (player of Petri Net), the continuous solver (integrator based on the GEAR method (Le Lann. 1999» . and a simulation manager which manages the interactions between the two solvers. The operating cycle of the simulator is then the following: I. the discrete solver starts by solving the discrete part of the model until no more transition can be crossed 2. then. the simulation manager concatenates the OAE systems associated with each

The static and structural aspects : The integration of the object concepts (Sibertin-Blanc. 1985) allows to describe the static and structural aspects of the

278

marked hybrid place as well as the enabling functions of each enabled transition 3. the continuous solver realises the integration of the global resulting DAE system, involving the evolution of continuous variables; this one is stopped as soon as an event occurs 4. then, the control is given to the discrete solver; it performs the junction functions of fired transitions and set up a new marking (Qretum to I).

CLASS MA TERIAL

Liquc

h-mh(T,P,itJ -0

2. OBJECT MODELLING OF A PROCESS

H -mH{T,P,y} _ 0

y , -K,.x, ; -t.n

{MJ

i(x, -y,)-o ,.1 The problematic of the hybrid modelling lies primarily in the management of the legal sequences between the various possible configurations of the DAE system according to the effective state of the system. When the process becomes complex, the number of possible states can be significant. The object structuration of PrODHyS allows to get round this difficulty. Indeed, (Hetreux et aI., 2002) have shown that it was possible to build most of complex devices by composing and/or specialising a set of elementary devices. All the difficulty lies in the characterisation of these elementary devices which are not necessarily real devices, but rather abstract autonomous, and/or generic entities, having a simple and predefined functionality and communicating via an isomorphous interface. The following sections specify the modelling axes of an elementary device.

2. 1 Didactic example A didactic example (figure 3) based on the Rayleigh evaporation has been chosen in order to illustrate the concepts implemented within PrODHyS. This one consists of a tank provided with a level detector and a thermal system allowing the heating of the liqUid phase. According to operating conditions, the initial liquid phase may vaporise with a flow V. The mathematical model of this system at the thermodynamic equilibrium and in its maximal state (i .e., liquid/vapour) is shown on figure 3. The outlet vapour being open on the outside, the pressure P is supposed to be constant and the vapour retention Uv is neglected. Equations (6). (7), (8) are the models used for the liquid/vapour equilibrium constant Ki and the liquid and vapour enthalpies h et H. (4) and (5) are the liquid/vapour equilibrium equations. (I), (2), (3) are the material and enthalpic balances. Command system

~,'_ t- :l ~Ntll'llJlll-Hk Vapour Outlet M t

Level

.'

dU, --v dt ~(U,. x, ) _ -V.y , dt d(U, .h) _ -V.H +0 dt

i-l,n

{2J

y , -K;.x ,

i -1 ,n

(4J

~(Xi

(1)'): bi/lOl)/lOken

K i -mK,(T,p,x.y) _ 0 i -I,n h-mh(T,p,itJ - 0 H -mH(T,P,y} - O

Fig. 4. Material Petri net

2.2 Modelling of the material. A material system is described by a b' · . n 0 ~ect class .. owmng several attributes sueh as va . bl 'fi ' f . na es lor the specI Icatlon 0 Its phYSical state and P . " . a etn net for the descnptlon of Its behaviour. Figure 4 illu the adopted model. strates Moreover, in PrODHvS . . ' , materl'al I'S s I'Ig ht IY coupled with the deVice which contains 't ( '. · . I associatIOn relationship). Indeed, rather than J'oin' th . · . mg e matenal be haVlOur with the device one the d' . , Y are escnbed separately by speCific networks Ho . . .. . . wever, matenal behavlOur IS mtegrated m the device d I h · mo e tanks to a Matenal token (m) which moves on th d ' . · h e eVlce Petn net. F Igure 5 sows a fragment of ea h P ' ' . c etn net. On the nght, Material Petri net allows t · 0 models a phYSical change of the material from th I' . · , e Iquld state to the hqUld/vapour state. On the left T k P . · , an etn net I he automatic activation of th mod est e output port when the vapour phase appear Materl'al t k . · . 0 en carnes a matenal system that owns itself a Mat . I P . ena etn net . . ThiS Matenal token can then mark a I f h : . pace 0 t e Petn net of the associated device The con t . . . ca enatlOn of the DAE system associated with the cur t . . ren state of the matenal with the DAE system relaf h . Ive to t e deVice , a Ilows to obtain the global continuous model.

{IJ

{3J

-y,j-O

(5)

/.1

K i - mK,(T,P,X,y) -0 i h -mh(T,P,x) - O H - mH{T. P, y) = 0

=

I,n

{6J {7J {8J

Fig. 3. Didactic example: Rayleigh evaporation

c1ass aN, :

port

g,)

.,

: ",..., fTHI~ r : autoActl v;JOonO r;;;:;~::--c"'--~....J /l'Wt1aJis.()

me"'".

Fig. 5. Objcct structuration

Dwlce 1 .. . ..

QJIDuI port

. •. Input port

'"'1{!;lli1!1i!!llm _ _ ·· ·k>·.

~_,:~~~ ~!ii Q

first one consists in defining the whole possible states of the process as well as the state transitions and the intrinsic events. The second one consists in writing the mathematical models (one by hybrid place) which describe the continuous behaviour of the device. Let us take the example shown on figure 3. Only the balance equations « I), (2) and (3» are taken into account. In those, flow variables (provided by transport ports) are the only variables relative to the device. By construction, a device can own a various number of ports, with different type and whose flow value depends on the current state of the device. For instance, the simulation of the overflow of a storage tank requires an output liquid port but the liquid output flow exists only if the maximal level is reached. In the same way, considering a vapour outlet has interest only when material state is diphasic . These kinds of situation can be managed in two ways. The first one consists in not taking into account the flow F within the OAE system (the variable F is removed from the global OAE system). The second one consists in writing a OAE system by adding the equation F=O. In PrODHyS, the first solution is used. To implement it, the ports are associated with tokens (named Port token). The Petri net of a device owns as many Port tokens as the device owns ports. The flow variable associated with a port is taken into account within the OAE system only if the corresponding token stands in an active hybrid place. Figure 7 shows the simplified model of an elementary device owning two ports. The activation or the deactivation of a port consists in putting on or in removing the port token from the hybrid place. This is ensured either automatically (figure 5) or by specific places named ActivateOPort, ActivatelPort, DeactivateOPort and DeactivatelPort. !hes~ places emit Information tokens which carry mscnptIOns such as the identifier of a port. A Port token, located on Ports place, and an Information token, located on ActivateOPort place (for instance) enable the below transition and fire it if the associated condition (Port token is compared with the identifier carried by the Information token) is true. Figure 7 emphasises the different views such a system offers. The intt'rnal view is the one of the designer. The moving of tokens remains transparent for an external IIser of this object, for which, only some specific places (thick line) are accessible.

Dwlce2

with data noI 800essible from the _ _

OwIce 1

·>

with data

Q

accessilie from the outside

Dwlce 2

Fig. 6. Representation of ports

2.3 Modelling of an elementary device In PrODHyS, an elementary device is defined according to three principal axes: its topology, its model and its configuration.

Topology of a device . In a general way, a device is defined as an enclosure which can exchange material , energy or infonnation. In order to fonnalise these exchanges, an interface element named port is Introduced. The establishment of an exchange between the inner part of the device and the outside (environment or another device) corresponds to a data share (figure 6). Any variable associated with an output port is made potentially accessible . To reach this variable, an input port has to be connected to it. Thus, an output port contains the exchanged variable, an Input port only contains a reference on this variable. The advantage of such a mechanism is to avoid the writing of equations of connection such as F 1ou,=F2in. Regarding the nature of the exchanges, two kinds of port exist: communication ports (information exchange) and trampart ports (material or energy exchange). In this last case, the transfer is characterised by allow and a potential. Modelling of the device . In a general way, the establishment of a model according to the ODPTPN formalism is performed by following two stages. The ~m~m;lj

view

V~rvir:w

Ports

~AdM"

\!..) o..n

Configuration 0/ the device. The application of a configuration finalises the construction of a device . For example. it allows to specify the value of constitutive and geometrical parameters (tank diameter, volume. maximal capacity. etc) , the choice of models (retention and pressure model. etc), the initial marking of the device. etc.

O

2.4 Modelling o/connections

O O d(~.xj )

.. -V'YI

I ...

' ,n

MM" IPon

oIPort ..ctJvat.

0 <0""'·0

Activate

Connected Pon

0 ..

Connected Pon

O.divate OPon

d (U,.h) _ -V.H .Q
[n order to keep the coherence of the model. the activation (respectively the deactivation) of an output

Fig. 7. Modelling of a device

280

Composition : A composite device is defined as a device made up of several elementary or composite devices. The composition requires the creation of a connection Petri net in order to bind the networks and makes some places invisible from the outside. For instance, the storage tank shown on figure 3 is provided with a thermal system. In PrODHyS, this set constitutes a composite device named HeatTank. Encapsulatiun : Figure 6 has emphasised the different views the ODPTPN formalism offers. Private and public parts are defined in order to implement a controlled access to the model. This brings to the fore the advantages of the object paradigm and primarily denotes the interest of the encapsulation principle.

Fig. 8. Modelling of a connection port has to involve the activation (respectively the deactivation) of the input port to which it is connected. Thus. the transfer of a token carrying an output port from the Ports place to the hybrid place must involve the transfer of the token carrying the input port to which it is connected from the Ports place to the hybrid place within its own network. This synchronisation is ensured by a specific Petri net named ConnectionPN. Such a network is created as soon as a connection is established between an output port and an input port. So, there are as many ConnectionPN-type Petri nets as there are couples of ports connected between them. Figure 8 shows how this connection is carried out. The establishment of a connection between two ports implies a data share (section 2.3) as well as the creation of a ConnectionPN-type network. This one consists of a pair arc/transition/arc which connects the places ActivateConnectedPort and ActivatelPort on the one hand and DeactivateConnectedPort and DeactivatelPort on the other hand. Thus, when the transition t1 (allowing the transfer of the Port token into the hybrid place (figure 7» is fired. the Information token carrying the identifier of the output port is deleted and a new Information token carrying this time the identifier of the input port to which it is connected, is created and put on the place named ActivateConnectedPort. This one crosses the transition of ConnectionPN Petri net and is put on ActivelPort place of the Petri net of the device 2 (figure87). Then. this token involves the transfer of the Port token carrying the input port into the hybrid place (as in device).

4. ODPTPN FORMALISM An ODPTPN with an initial marking is a n-tuple: N= (PN,C.J.AJc,AAC,Pre,Post,Ev,Ac,X,F,AT) with: • PN is an "ordinary" Petri net: PN = (P,T,A,Mo): - P is a finite set of places. P set consists of two subsets PH and PD: PH is a finite set of hybrid places and PD is a finite set of discrete places; - T is a finite set of transitions; - A is a finite set of arcs; - Mo is the initial marking; • C is a finite set of object classes (types);

• J is a finite set of instances of object classes defined in C set (tokens). This set can be break down into disjointed subsets JPk of tokens associated with Pk places. Besides, every token J k of J set is a 2-tuple (AttJk, Meth Jk ) where: - Att Jk is a finite set of attributes of J k token: furthermore, X Jk is a subset of AttJk set and contains the set of unknown variables carried by J k token: - Meth Jk is a finite set of methods of J k token: • AJc: J ~ C is a mapping which associates with a token a type as a class defined by an element of C; • AAC: A ~ Cm is a mapping which associates with every arc a formal sum of elements of C set such as its module is equal to the weight of the arc; • Pre: P x T ~ Cm is the forward incidence mapping that defines input arcs of transitions; • Post: P x T ~ Cm is the backward incidence mapping that defines output arcs of transitions; • Ev is a tinite set of events. Ev set consists of two subsets EVD and Evc: EVD is a finite set of discrete events and Evc is a finite set of continuous events:

3. OBJECT STRUCTUTRA nON OF THE MODEL Section I has shown that the aim of PrODHyS is to provide general elements which allow to build more complex specific entities by exploiting object derivation mechanisms. These principles are widely used through the description of the topology and the configuration of devices (Moyse. 2000). The following sections show the integration of these concepts through the establishment of models.

Specialisation: In PrODHyS. the complexity of the equipment behaviour remains at several levels. At the lowest level. Petri nets groups together common characteristics. As the model refines. some elements (places, transitions. events. etc. ) are added.

• Ac is a finite set of actions; • X is a finite set of variables. This set consists of non-necessarily disjointed subsets XG of global

281

variables belonging to the Petri net and

Xk

REFERENCE

of

variables associated with hybrid places Pk; • F is a finite set of functions . This set consists of disjointed subsets

Fpk

of functions associated with

hybrid places Pk : Fpl

F= [

()(f\

Alur R., Courcoubetis c., Halbwachs N., Henzinger T.A. , Ho P.H., Nicollin X., A. Olivero, Sifakis J. and Yovine S. (1995). The algorithmic analysis of hybrid systems. Theoretical Computer Science, Vo1.l38, p.3-34. Andersson M. (1994). Object-Oriented Modelling and Simulation of Hybrid Systems. Ph.D thesis, Lund Institute of Technology, Sweden. Barton P.!' and Pantelides c.c. (1994). The Modelling of Combined Discrete/Continuous Processes. AIChE Journal, 40:966-979. Champagnat R., Esteban P., Pingaud H. and Valette R. (1998). Modeling and simulation of a hybrid system through Pr-Tr PN-DAE model. In : ADPMWJ, p. \31-137 . Reims. Deshpande A., GolIu A. and Semenzato L. (1998) . The shift programming language for dynamic networks of hybrid systems. IEEE Trans. Automatic Control special issue on Hybrid Svstems. Fabi~n G., van Beek D.A. and Rooda J.E. (1998). Integration of the Discrete and the Continuous Behaviour in the Hybrid Chi Simulator, European Simulation Multicon(erence, Manchester. Hetreux G., Thery R., · Perret J., Le Lann J.M. and Joulia X. (2002). Bibliotheque orientee-objet pour la simulation dynamique des procedes : architecture et mise en a:uvre, Congres SIMO '200:!, Toulouse, France. Jourda L., Joulia X. and Koehret B. (1996) . Introducing ATOM, the Applied Thermodynamic Object-Oriented Model. In : Computer & Chemical Engineering, 20A, SI57-SI64. Kesten Y. and Pnueli A. (1992) Timed and hybrid statecharts and their textual representation. Lee/ure Notes in Computer Seien/:e, VoI.N°S71 . Le Bail L Alia H. and David R. (1991). Hybrid Petri Nets. Proceedings of the European Control Conj'erence, p. 1472-1477, GrenobIc. Le La~n J.M. (1999). Des mathematiques a la simulation dynamique robuste des procedes: le traitement algebro-differentiel des equations EDA. Habilitation, INP, Toulouse, France. Moyse A. (2000) . Odysseo. plate-forme orienteeobjet pour la simulation dynamique des procedes PhD thesis. INPT, France. Sargousse A. (1999). Noyau numerique orienteeobjet dedie a la simulation des systemes dynamiques hybrides. PhD thesis. INPT. France. Sibertin-Blanc C. (\ (85). High-level Petri nets with Data structure. 6th European workshop on Petri nets amI applications. Espoo (Finland). Wollhaf K., Fritz M., Schulz C. and Engell S. (1996). ilaSiP ilatch Process Simulation With Dynamically Rcconfigurcd Process Dynamics. Supplement to Computers and Chemical EngineC'ring, 20(972), p. 1281-12g6. Zaytoon J. (200 I). Sl'stl!mes dl'lwmiqul's Ill ·brides. HERMES Sciences publications.

'~f\ ,bf\' t) :

1

where:

Fp' ()(p. ,Xp' ,bp' ' t ) ~.

.

~.

~.

FF!.(XF!.,XF!.,~,t)=

"
[fF!.l(XF!.'~F!.,~,t) ] .:

.

ffl."< (Xfl. ,Xfl. ,bpk ' t )

fD'k 1 ." fRknlr. define differential algebraic constraints on the evolution of continuous variables; • AT is the annotation of

N: AT

Jin(Tj ). Attin(Tj ), Methin(Tj ),

(AttG' Meth G, ATE, A TA ) where : =

- AttG is a finite set of global attributes belonging to the Petri net; - Meth G is a finite set of global methods belonging to the Petri net; - Jin(Tj ) is finite set of input tokens of T j transition; - Att in ( T j ) is the union of the sets of attributes of input tokens belonging to Jin(Tj ) set; - Methin(Tj ) is the union of the sets of methods of input tokens belonging to Jin(Tj ) set; - ATE: T - t Attin X Meth,n x AttG x Meth G is a mapping which associates with a transition a condition as a conjunction of events by using elements of Meth in , Methc;, Attin et At~ sets; - AT"' : T - t Attin X Meth in x AttG x Meth G is a mapping which associates with a transition action(s) as a succession of treatments performed by elements of Meth,n and Meth G sets and operated on elements of A ttin and Att G sets.

CONCLUSION The modelling of most industrial processes requires to take into account of hybrid phenomena. The use of a high level model associated with powerful nume;ical integration methods allows to build a robust hybrid dynamic simulator. Designed according to an object approach. PrODHl'S provides a library of autonomous software components that may be gathered or specialised to develop a specific device . For a developer, the exploitation of these elementary components allows to speed up the design and implementation of a new device. For a user. the exploitation of the predefined devices offered as "black boxes" makes easier the setting up of si mulation campaigns. Thcsc elements make PrODI/.rS an operational and evolutive tool.

282