10.07.2015 Views

System Modelling: from DFA to Coloured Petri Nets - MegaByte

System Modelling: from DFA to Coloured Petri Nets - MegaByte

System Modelling: from DFA to Coloured Petri Nets - MegaByte

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>System</strong> <strong>Modelling</strong>: <strong>from</strong> <strong>DFA</strong> <strong>to</strong> <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong>Dragan Mihaita, Ing. Sis. Drd., University of BucharestABSTRACTIn this paper we present some advantages and disadvantages offered by the classical theory of <strong>Petri</strong> <strong>Nets</strong><strong>to</strong>gether with a generalized class, <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong> used in modeling and simulation of the systems.Because by modeling and simulation can be obtained valuable information on real systems, informationswhich bring about major contributions <strong>to</strong> the development and enhancement of these systems, and knowing newways of modeling and simulation can be made comparative tests which provide results much close <strong>to</strong> the evolutionof systems real.Thus, starting with the modelling <strong>from</strong> a finite state machine and using the facilities offered by <strong>Petri</strong> <strong>Nets</strong>Location / Transition <strong>to</strong>gether with their extensions, we demonstrate the usefulness of using <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong> inthe modeling and simulation of the systems.Keywords: finite state machine, state, transition, action, deterministic finite state au<strong>to</strong>ma<strong>to</strong>n, modeling, simulation,<strong>Petri</strong> <strong>Nets</strong> location / transition, <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong>.1 INTRODUCTIONThere are subclasses of the class <strong>Petri</strong> <strong>Nets</strong> Location / Transition such as : Machine State, Graphs oftiming, <strong>Petri</strong> <strong>Nets</strong> with Free Choice, <strong>Petri</strong> <strong>Nets</strong> with Free Choice Extended, <strong>Petri</strong> <strong>Nets</strong> Simple which have the samepower of modeling with Deterministic Finite Au<strong>to</strong>mata. To the systems (phenomena) that can not be modeled by<strong>Petri</strong> <strong>Nets</strong> Location/Transition classes appeared the need for extend this class, which leaded at obtaining newclasses of <strong>Petri</strong> <strong>Nets</strong>:‣ <strong>Petri</strong> <strong>Nets</strong> with Priorities, <strong>Petri</strong> <strong>Nets</strong> with Inhibitions, <strong>Petri</strong> <strong>Nets</strong> with Reset, <strong>Petri</strong> <strong>Nets</strong>Controlled with Au<strong>to</strong>matic, which having superior power of the modelling compared with <strong>Petri</strong> <strong>Nets</strong> Location /Transition.Was searched a unified theory of <strong>Petri</strong> nets by introducing a class in which are included <strong>Petri</strong> nets Location/ Trazitie and their extensions, the class with power by modeling upper all the classes previously introduced, whatleaded <strong>to</strong> obtain the class <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong>.2 PRELIMINARIESFor develop this paper we have needed of several definitions and theoretical results.Definition 2.1[6,7] Is called finite-state machine (FSM) or finite-state au<strong>to</strong>ma<strong>to</strong>n (FA) or „machine with a finitenumber of states " a model of behavior composed of states, transitions and actions. Ie a finite state au<strong>to</strong>ma<strong>to</strong>n is amathematical object form FA = (S, T, m, s 0 , F) where :‣ S is the finite set of states;‣ T is the finite set, called input alphabet;‣ m : S x (T {})P(S) is the partial function of the next state;‣ s 0 S is a state called state of starting or the initially state ;‣ F S is a set of state called the set of the final states ( of acceptance).In such a model:State is determined by past states of the system. As such, it can be said <strong>to</strong> record information about thepast, i.e., it reflects the input changes <strong>from</strong> the system start <strong>to</strong> the present moment.Transition indicates a state change and is described by a condition that would need <strong>to</strong> be fulfilled <strong>to</strong> enablethe transition..Action is a description of an activity that is <strong>to</strong> be performed at a given momen.There are several types of actions, such as : Entry action which is performed when entering the state . Exit action which is performed when exiting the state. Input action which is performed depending on present state and input conditions. Transition action which is performed when performing a certain transition.Definition 2.2.[6,7] A deterministic finite state machine or deterministic finite au<strong>to</strong>ma<strong>to</strong>n (<strong>DFA</strong>) is called amathematical object expressed by a tuple of the form DFF = (S, T, m, s 0 , F) and represents a special case of finiteau<strong>to</strong>mata, in which:‣ S is a finite, non-empty set of states;‣ T is the input alphabet (a finite, non-empty set of symbols);‣ m : S x T S is the state-transition function;1


‣ s 0 S is a state called state of starting or an initial state;‣ F S is the set of final states, a (possibly empty) subset of S ( or state of acceptance).Definition 2.3.[4, 5] The modelling is a method used in science and technique, that involving the reproduction of anobject or system schematic form a system similar or analogous <strong>to</strong> studying the properties and transformations of theoriginal system. It can also be defined as a representation of a relationship by mathematical symbolism.Definition 2.4.[4, 5] The simulation is action <strong>to</strong> simulate a real system and results production its, the simulation hasthe purpose <strong>to</strong> find "something" about the mod of functioning of the system.Definition 2.5. [3] Is called <strong>Petri</strong> <strong>Nets</strong> a tuple S , T,Fin which :S T S T F (SxT) (TxS)so that : domF Im F S T.Elements of the set "S" are called places, elements of the set "T" are usually called transitions, and F iscalled flow relationship of the network . By here the name of the class of <strong>Petri</strong> <strong>Nets</strong> location-transition.Definition 2.6.[1, 2] Is called <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong> a tuple CPN = (P,T,A, ,V,C,G,E, I) where :1. S – represent a finite set, whose elements are called locations ( place ).2. T – represent a finite set, whose elements are called transition.The two sets must satisfy condition S T = .3. A S×T T ×S – represent the set of the arcs that connecting the locations at transitions and transitions atlocations.4. - represent a finite set of colors sets, different of set empty.5. V – represent a finite set of types of variables so that Type[v] for all variables vV.6. C : S→ - represent the function set of color, that assigns a set of color <strong>to</strong> each location.7. G : T →EXPRV – represent guard function that assign a guard <strong>to</strong> each transition t so that Type[G(t)] = Bool.8. E : A→EXPRV - represent function of the expression arc, that assign an expression of arc <strong>to</strong> every arc so thatType[E(a)] =C(s) MS , where s is location connected <strong>to</strong> the arc “a”.9. I : P→EXPR – represent initialization function that assign an initialization expression <strong>to</strong> each location s so thatType[I(s)] =C(s) MS .3 PRESENTATION OF THE MODEL.In the presentation the model we start <strong>from</strong> a deterministic finite state machine given, exemplified by asystem of activities which objects get the same type in two stages.We suppose there are two people A and B, the objects being processed of these persons. Person "A" <strong>to</strong>perform the first stage, and Person "B" executes the second stage. The objects obtained after the first stage are s<strong>to</strong>red<strong>to</strong> be processed by the second person B.We suppose that the person "A" can take a break at any time, while Person B can take a break only if thereare not objects at process of work..A first modeling of this system can be seen in the table given :| t t1 21 2 t2t2_ ssss123s0f||||||_sssss1ffffThis modeling of the system can be interpreted more easily by viewing the DAF <strong>from</strong> Figure 1._sssssf22t 1 t 2ff_sssssff3ff_sssssfff2fs 1s { t 1 , t 1 2 2s 0 2 , t 2 } t 22


{ t 2 , t 2 1 , t 2 2 }{ t 1 , t 2 2 } t 22t 21s f s 3{t 1 , t 2 , t 2 1 , t 2 2 } {t 1 , t 2 }Fig 1.Finite state machine starts <strong>from</strong> state s 0 and by producing action t 1 this passes in<strong>to</strong> state s 1 , otherwise said isconsidered that the objects were processed by actions t 1 objects that are s<strong>to</strong>red in the state s 1 , i.e. the person "A"performing the first stage and the objects resulting are deposited in the state s 1 (DAF passes in state s 1 byproducing action t 1 ). Also, <strong>from</strong> state s 1 by producing one of the actions { t 1 , t 1 22 , t 2 } DAF can pass in the finalstate.By producing action t 2 the objects passing in state s 2 , the objects at this state include two posibilities:1) Person B can process objects – action t 2 enter loop. At this stage of work if it are produces one of theactions { t 1 , t 2 2 } DAF passes in the final state.2) Person B can take a break – which means that DAF passing in the state s 3 . At state s 3 either person Bresume work, by producing action t 2 2 , either DAF passes in the final state by producing one of the actions {t 1 , t 2 }.We note that DAF can reach the final state when are processed the sequences of instructions {t 1 , t 2 , t 1 2 , t 2 2 },but can't exactly surprise when the person can work and when the person can take a break.To highlight this situation we perform a new modeling of the system.This modeling of the system can be achieved by <strong>Petri</strong> network <strong>from</strong> Figure 2, where transitions and locationshave specifications given below.t22s 0 t 1 s 1 t 2s 2 s 3n• •In the location s 0 there are a number n of <strong>to</strong>kens. Conducting transition t 1 leads <strong>to</strong> processing of the objectsand their s<strong>to</strong>rage in the location s 1 . By producing transition t 2 , the second stage of work, objects are processed ands<strong>to</strong>red in the location s 2 .Existence of a point in the location s 2 says that person B can do processing the objects, or <strong>to</strong> take a break.If occurs the transition t 1 2= persoa B enters the break.Existence of a point in the location s 3 says that person B enters the break (in this time person "A" canprocess objects). If the transition occurs t 2 2= person B return <strong>to</strong> work.Under the assumption that the person B may enter the break only if no objects <strong>to</strong> be processed, it followsthat the transition t 1 2must be permitted only at markings for which (s 1) =0. But, this can be achievedusing the classical rules of transition, because s 1 isn’t entry of the transition t 1 2 .Following this modeling we see the same situation encountered at modeling with the DAF. To avoid thissituation we make a new modeling, modeling made by <strong>Petri</strong> <strong>Nets</strong> with inhibi<strong>to</strong>rs.To achieve this new modelling is necessary <strong>to</strong> define these networks and their rules of operation.Definition 3.1[3] We call <strong>Petri</strong> <strong>Nets</strong> with inhibi<strong>to</strong>rs, abbreviated iPTN, the pair =( Σ,I) in which we have thesystem Σ’ =(S,T,F, ) that represent a <strong>Petri</strong> <strong>Nets</strong>, PN, iar I ⊂ S x T so that F∩i= , that specific the locations areattached <strong>to</strong> each transition.By marking of the network means any marking of the structure Σ and the sets markings of the network denoted by N S .Definition 3.2[3] Let Net =(Σ,I ) be a <strong>Petri</strong> <strong>Nets</strong> with inhibi<strong>to</strong>rs, iPTN, a marking own and t∈T.Fig 21t23


1) We say that transition t is enabled at the marking , we note [t> ia) [t > b) (s) = 0, ∀s∈S so that (s,t) ∈i.2) We say that marking ’ of the network is i- obtained by production trasition t at the marking , wea)[t inote [t> i ’ b)' (,t)We observe that at the classical rule by allow of the transition was attached a new rule of restriction and weobtained the rule de i-affordability, while the new rule of computing of the marking was not changed.When network is sub-unders<strong>to</strong>od we will use notations [t> i and [t> i ’ .Condition F∩i = <strong>from</strong> definition of <strong>Petri</strong> nets with inhibi<strong>to</strong>rs, iPN, is necessary because otherwise, if∃(s,t) ∈ F∩ i then t could not be i– possible at any marking of the network for that on of a side (s) =0and on of another side <strong>from</strong> [t> Σ ⇒ (s) ≥Pre (•,t)≥1, for that (s,t) ∈F what obviously is not possible.Let be <strong>Nets</strong> =(Σ,i), a <strong>Petri</strong> <strong>Nets</strong> with inhibi<strong>to</strong>rs, iPN, and ∈N S a marking own.Notions of :i sequence of transitions enabled at markingmarking i enabled <strong>from</strong> ⇔are defined as in the classicalcase. We obtained such the sets T( , ),TS( , ) and RM( , )which are equivalent <strong>to</strong> those of theclassic case.These networks are plotted as : , is represented as if classical,‣ Σ,0‣ M will be listed separately,‣ i is represented by draw <strong>to</strong> each (s,t) ∈i, an arc <strong>from</strong> s at t of form:| | ; s t.With those remarks the system of activities described above is shaped by miPN as in Figure 3.2t2s 0 t 1 s 1 t 2s 2 s 3n• •| |Fig. 3This network is equivalent with <strong>Petri</strong> <strong>Nets</strong> location / transition, which means that activities that occurringwithin its network are identical <strong>to</strong> those performed previously, but more than shows an inhibi<strong>to</strong>ry arc that allowsexecution of prioritized transitions and such the person "B" may s<strong>to</strong>p the work or resume the work in a wellcontrolled manner..However, network evolution can not be seen in all her amplitude. Thus for a better view and observation of theevolution of the whole network we use a new class of <strong>Petri</strong> <strong>Nets</strong>, Colored <strong>Petri</strong> Net class, which shows multiplefacilities for modeling, validation and simulation of the systems.Using a <strong>to</strong>ol provided by this class, CPN-Tools [8], whose license is provided by the CPN group at AarhusUniversity in Denmark, we construct a equivalent network <strong>to</strong> <strong>Petri</strong> <strong>Nets</strong> above.1t24


Fig. 4Network is composed of locations, transitions and arcs which have the following meanings:Locations :PROD – location of s<strong>to</strong>rage in which there are objects of the processed.A – location in which the person "A", puts the objects processed.BL – location in which the person B puts objects processed by it.BP – location in which the person B, if has not are objects of processed can take a break..Transitions :t 1 – action by which objects are processed by the person A and s<strong>to</strong>red in location PROD.t 2 – action by which objects are processed by the person B and s<strong>to</strong>red in location BL.t 3 – action by which person B can resume work.The arcs do connecting between transitions and locations or between locations and locations and can be printed withexpressions of arc.Evolution of the network can be interpreted thus:In the location PROD we have initial mark 20` 0e, otherwise said, here there are 20 objects ofprocessed. The first stage of processing is done by producing transition t 1 , objects processed are s<strong>to</strong>red in thelocation A and at this moment is allowed and the transition t 2 , as can be seen in Figure 5.Fig. 5According with the hypothesis at this moment of the evolution of the network, the person "A" and the person "B"can handle objects. Stage two of processing of the objects is based on making transition t 2 that move objectsprocessed in the location BL. After making transition t 2 person B has two possibilities:a ) can enter the break, because in the location "A" there are not objects of processed.b) may resume work by producing transition t 3 , so how very easy can be seen <strong>from</strong> Fig. 6.5


Fig. 6At this stage modeling of the system is apparent that all requirements of the problem are easily observed.Presentation modeling the system by the four forms comes <strong>to</strong> show that using Colored <strong>Petri</strong> <strong>Nets</strong> in modeling,validation and simulation of the systems can be made quite easy, with low cost and remarkable results.CONCLUSIONS.This paper aims <strong>to</strong> highlight the dynamics development of the IT domain, as well as the latest news tha<strong>to</strong>ccur every day in this area, which if known in time can facilitate substantially the activities in all fields.Besides multiple opportunities for modeling, simulation and validation provided by <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong>class, this class generalized of the <strong>Petri</strong> <strong>Nets</strong>, provides a new software known as CPN-Tools, which by the useproper can provide vital informations about the system modeled, such as : references about the properties ofreachability, liveness, boundedness, fairness, deadlock, etc.REFERENCES[1].K. Jensen, “<strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong>”, Vol 1,2,3 Spinger-Verlag Berlin Heidelberg, 1992.[2].K. Jensen, L. M. Kristensen,“ <strong>Coloured</strong> <strong>Petri</strong> <strong>Nets</strong>-<strong>Modelling</strong> and Validation of Concurrent <strong>System</strong>s”,Spinger-Verlag Berlin Heidelberg, 2009.[3]. M. Popa, “Note de curs”, Bucuresti, 2008.[4].E. Gutuleac, “Modelarea si Evaluarea Performantelor Sistemelor de Calcul prin Retele <strong>Petri</strong>”, Dep. Ed.Poligrafic al UTM, Chisinau, 1997.[5]. Dictionar Encicopedic, Editura Enciclopedica Bucuresti, Bucuresti, 2007.[6]. C.Cassandras, S.Lafortune, "Introduction <strong>to</strong> Discrete Event <strong>System</strong>s". Kluwer, 1999.[7]. T. Kam, “Synthesis of Finite State Machines: Functional Optimization.” Kluwer Academic Publishers,Bos<strong>to</strong>n 1997.[8]. http://www.cs.au.dk/CPnets/CPN-Tools, 2009.6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!