Home
User Manual - Automatic Control Group
Contents
1. Transition in real conflict int g conf1 int app it int app ic int x xgrConflict endContr true k 3 Ln 23 Co2 30 DOS READ REC COL OP 7 Fig 63 Control algorithm writing You must always write the control algorithm both in the file Controller cpp and in the predetermined method controller of the C class Controller You must never modify the name and the position of this file so that the simulator can correctly run You can access to several information about the Petri Net state during the simulation to write a control algorithm you can also disable transitions and add remove tokens from places You can perform these using these following C functions 51 int m char p i intmatInc int i int j intnPosti intnTrans intcompToken char p i intcompToken intp i int i int i int j ep n Input place name p i Output number of tokens of the place pj Input indexi of the place pj Output number of tokens of the place pj Input indexi and index j of the Petri Net incidence matrix 1xixnumber of places x3xnumber of transitions Output element cu of the incidence matrix Input none Output number of places of the Petri Net Input none Output number of transitions of the Petri Net Input place name p i index token i index element j Output element j of the token i of the place pj Input place index p i index token i index el
2. to obtain the logical operators NAND and NOR You must use the C C syntax also for the following relational operators gt V gt ces gt lA 22 Arc function The output input arc function that connects a place p with a transition f it describes the tokens that have to be moved added from to the place Guard function The transition guard function describes the condition that enables the transition it is a Boolean function or a combination of several Boolean functions You can use the functions defined in Table 1 or other functions defined by user Firing time The transition firing time is a positive real number It is the delay time from enabling to firing of a transition For CPNs with guard the firing time can be also a function Firing rate The transition firing rate is a positive integer number If the firing rate is equal to 0 the transition fires immediately Examples Coloured Petri Net without guard This example shows how to set the parameters for a coloured Petri Net without guard You can find the file Example pnml in the directory PNetLab Examples col without guard The net is shown Fig 24 23 PNetLab _ eG mE je BES ia EI Je PetriNet Example pnml Fig 24 Petri Net Example draw net Let suppose Place pl colour 1 with 10 tokens colour 2 with 8 tokens colour 3 with 5 tokens Place p2 colour with 0 tokens colour 3 with 0 tokens
3. pQX5 12 Meminit iX t5 EMEN Fired transitions t7 0 3 0 0 2 0 0 1 0 Fig 70 Step 6 the conflict among the transitions t6 and t7 is solved by using guard functions 60 PNetLab PetriNet Example2 pnml ps cone pr6 2 48 4 1 t ti AII 1 pi 5 1 2 3 E3 Wee Fired transitions 1 2 3 4 p3 10 3 0 0 2 0 0 1 0 Fig 71 Step 7 the firing time of the transition t8 is a user function written in the file F user cpp The user defines this following function in the file F_user cpp KK KK Kk Kk kk kk kk Kk Kk KK Kk Kk Kk KK KK kk Ck Ck kk kk kCk ck ck ck ck ck kck kck kck ck k kc kok kk function double traveltime int x int y it calculate the necessary time to reach the position x y in accordance with the function max x Vx y Vy double traveltime int x int y double Vx 50 5 double Vy 75 8 double tx x Vx double ty y Vy if tx gt ty return cx else return ty In this function the firing time of the transition t8 depends on the token colour of the place p8 The following header of this function is written in the file F_user h double traveltime int x int y 61
4. EI el PetriNet1 Fig 35 Petri Net Example draw net Let suppose Discrete places Place pl 2 colours token number of colour 1 token number of colour 2 1 Place p2 2 colours token number of colour 1 0 token number of colour 2 0 Continuous place Place pcl 2 coloured marking with 2 attributes values of attributes for colour 1 2 0 5 0 3 gt values of attributes for colour 2 0 8 0 9 Discrete Transitions Transition t1 2 colours Transition t2 2 colours Continuous Transitions Transition tcl 2 colours linear firing speed Ax4 Bu with 0 1 0 A j B u 08 Discrete Arcs Are p1 212 F ch Arc t22 p2 F A l 32 Arc p2 tl F d 1 ArctlDpl F I Continuous Arcs Arc pel gt tel lt B al Arpt S 2445 Arc tcl pl D lt e By double click on the Place pl a window appears and you must write in Token color the string 1 2 as shown in Fig 31 F4 PNetLab File Insert Analysis Settings Help Be EJ PetriNet1 75 100 125 150 Delete place Fig 36 insert token colour for discrete places Subsequently by clicking on nsert tokens you can insert the number of the tokens for every colour Fig 37 33 FA PNetLab File Insert Analysis Settings Help pi EISIERER SES fA PetriNet1 Appearance parameters Place color ER WS WR Black Red Yellow Green M
5. I D clude Funzioni h clude F user h I A include mat lib h include prog lint h Se dE db db db o db zb dB dE eg I ls Jo 5 include xprs h extern bool endContr End control algorithm extern Rete r Petri Net extern int CV Vector transitions enabled extern int runtimeConflict Structural conflict transitions extern bool realConflict Real conflict transitions void Controller controller 1 intnrow ncol nvgmec 1 i J nrow nPosti Number of places ncol nTrans Number of transitions Define the incidence matrix C and initialize it int C NULL C dmat_int nrow ncol 0 Define the constraint matrix Lgmec and initialize it int Lgmec NULL Lgmec dmat_int nvgmec nrow 0 Build the incidence matrix C by using the PNetLab function matInc for i 0 i lt nrow i for j 0 j lt ncol j C i j matInc i 1 J 1 Build the constraint matrix Lgmec Lgmec 0 0 1 Define vector Kgmec intkgmec 2 In this example GMEC is m 1 lt 1 Definition of the vector utran which specifies the controllable and uncontrollable transitions utran i 1 1 means that transition ti int utran NULL utran dvet_int ncol 0 utran OJ 1 utran 5 1 utran 6 1 utran 7 1 is uncontrollable Load the current PN marking by using function m i int marcatura NULL marcatura dvet_int nrow 0 for i l i lt nrowg i marc
6. i i 1 0 0 0 0 0 S P Invariants txt win32pad File Edit Search Tools Help oot ti gt mi i t3 gt m2 0 t4 gt m3 0 ti3 gt m4 0 100001 O nev t2 gt m0 0 1000 t7 gt m3 0 0100 ti3 gt m5 10 0 0 O O 1 Ojnew 0 0 0 0 t6 gt m0 0 100000 ijold ti3 gt m6 0 00100 1 O nev tS gt m2 0 00100 0 ijold t8 gt mi 1 000000 ijold ti3 gt m7 0 010001 Ojnew tl gt ES gt t4 gt 9 gt Fig 57 Coverability tree 1D oo X SB Ho Q w o eg Fig 58 P Invarinats 48 E T Invariants txt win32pad File Edit Search Tools Help iD a Ei amp X Bel c Q oe w lag 9 10 11 12 OO OO Ok OO CO OO OO OO OO kA 1 i 0 0 0 0 0 0 0 OO OO OO kA kO OO OO OO OO OO OO kA O OO kA OO Ok O OO OO kb GA O O H OO k oO CH OO k OO OO OO Oh OOOOOO OH Ok OO OO OO OO CO H oooooooo kA OO OO OO CO k OO OO OO OO OO OH CH CH Fig 59 T Invarinats S Siphons txt win32pad File Edit Search Tools Help er Ed X Bel e lwlDge Fig 60 Siphons 49 E Traps txt win32pad File Edit Search Tools Help D did X ioo hl aS Fig 61 Traps E Incidence matrixes txt win32pad File Edit Search Tools Help Ima E amp X 85 o w PLoS Pre incidence matrix t t t GA OO OH CH OO CH k CO kb OO OO OO OO OO kA N Ga Ga EG GA Ga k GO ka ct LA CH t GA OO OO OO OO oF CO amp O O O O O kA O O n Oooo Ob O O
7. Analysis Settings Help ES BES E mE iaa S PetriNet Example pnml Appearance parameters Orientation a on colo CW WR WWW Black Red Yellow Green Magenta Cyan Blue Transition size 450 75 100 125 150 Delete transition Ok Cancel Fig 28 Petri Net Example insert transition colures 26 Likewise for transition t2 To insert the arc matrix you must to do a double click on one of the middle points A window appears that contains a matrix of zeros and you must insert there the correspondently arc matrix The following figure shows as insert the arc matrix for the Arc p1Jtl PNetLab BSCR II S Be PetriNet Example pnml Are color CW WR WE Black Red Yellow Green Magenta Cyan Blue ee SS Fig 29 Petri Net Example insert arc matrix This operation has to be done for every arc of the net Only after you have set the parameters for the whole net you can compile and you can execute the simulation These operation are shown in the next sessions 21 Coloured Petri Net with guard This example shows how to set the parameters for a coloured Petri Net with guard You can find the file Examplel pnml in the directory PNetLab Examples col_with_guard The net 1s PNetLab File Insert Analysis Settings Help x fi em s tis E Se Aji 5 tie EE LA NN PetriNet Example1 pnml Fig 30 Petri Net Example1 draw net
8. Firing time Type SE Appearance parameters Appearance parameters Orientation Ee ar Orientation Ug Transition color Transition color Ca ks E ERR HIE WS mma Black Red Yellow Green Magenta Cyan Blue Black Red Yellow Green Magenta Cyan Blue Transition size Transition size 50 75 100 125 150 50 75 100 125 150 Delete transition Delete transition Set Velocity Cancel Fig 21 Transition parameters setting a discrete transition b continuous transition 19 Set Linear Velocity Set Velocity m Matrix A Vector B Place Component 3 Fig 22 Firing speed setting a speed depending by the place marking b linear speed You can set the following parameters for both discrete and continuous arcs Fig 23 only after you have set the parameters of the place and of the transition which the arc links You must to press enter after you have insert each element of the arc matrix arc matrix colour of line that represent the arc Arc p1 gt t1 parameters transition t1 Arc matrix Arc color gm m mm m Black Red Yellow Green Magenta Cyan Blue Ca Ca Fig 23 Arc parameters setting 20 Parameters and function syntax of PNetLab simulator Since the simulator has not a syntactic interpreter you must respect some simple rules to correctly write the parameters of the drawn places transitions and arc
9. buttons and File Insert Analysis Settings Help oe Fig 3 PNetLab toolbar You can set the graphical properties of Petri Net nodes this operations are available from the menus Settings 2Place Settings DTransition and Settings 2Arc Fig 4 and the background colour this operation is available from the menu Settings 2Background Fig 5 Place parameters setting Ej Transition parameters setting E Arc parameters setting Ej E m E E E Em E E m E E E E E Define personalized colors Fig 5 Background colour setting Drawing a Petri Net Selecting the menu File 2New or clicking on the correspondent button a window that contains a void drawing area is opened Fig 6 The menus 4 nsertDiscrete Place Insert 2Continuous Place Insert gt Discrete Transition Insert 2ContinuousTransition Insert 2Discrete Arc and Insert 2Continuous rc and the correspondent buttons ES are activated Also the area selection button BL the graphical object selection button the opening text editor window button to write C code for an eventual controller are activated It is now possible to draw a Petri Net PNetLab aag File Insert Analysis Settings Help DIR KIT B PetriNet1 d z Ii Fig 6 Petri Net drawing area You can insert a discrete place by selecting the menu Insert Discrete Place or selecting this button te clicking in the position on the drawing area in which you want to draw t
10. end simulation button 43 PNetLab Fig 52 Simulation in sequential step by step mode For both place transition and Coloured Petri Nets with guard you can choose which transition to be fired simply by click for the Coloured Petri Nets without guard you must choose the colour under which the transition fires Clicking on the transition you will see a windows showing the enabled colours Fig 53 You can choose one of the enabled colours by click on the button Ok Transition t1 Enabled colors Select colors Fig 53 Select colours in sequential step by step mode The simulator calculates the new Petri Net state it visualizes the state and the new enabled transitions are coloured in orange This procedure is repeated till the end of the simulation The simulation can terminate if you click the end simulation button if the maximum number of simulation steps 1s reached if no transition can fire In any case at the end of the simulation the initial Petri Net state 1s restored and it is visualized 44 Simulation in concurrent Step by Step mode The simulation in concurrent Step by Step mode allows the user to interact with the simulator This mode is not available with the hybrid nets It is possible that more transitions can fire simultaneously and a transitions can fire under more colours simultaneously The simulator takes the simulation parameters and it starts an interactive simu
11. insert only the Number of token elements After you must insert the transition guard function by double clicking on the transition tl a window appear 29 ERIE PetriNet Example1 pnml PNetLab bj wl Insert Analysis Settings Help Appearance parameters Orientation EENN WWW Black Red Yellow Green Magenta Cyan Blue Transition size 50 75 100 125 150 Las Il Lo Fig 33 transition t1 guard function Likewise for transition t2 Finally to insert the arc function you must to do a double click on the middle point of an arc and a window appear In this window you can write the appropriate function The following figure shows as insert the arc matrix for the Arc t2 pl z EH TBI Banna e PetriNet Example1 pnml Arc t1 gt p2 parameters i Are function Arc color gm mmm m Black Red Yellow Green Magenta Cyan Blue Fees me sene pict prt 217 1xpr 1 2 Fig 34 insert arc function 30 This operation has to be done for every arc of the net The arc function is displayed next to the middle point of the arc Only after you have set the parameters for the whole net you can compile and you can execute the simulation These operation are shown in the next sessions 3 Coloured Modified Hybrid Petri Net This example shows how to set the parameters for a Coloured Modified Hybrid Petri Net The net is P PNetLab File Insert Analysis Settings Help Eller
12. 1 Color 1 1 0 place p1 Color 2 Are color EN WS WR Black Red Yellow Green Magenta Cyan Blue 4 a Fig 40 Petri Net Example insert discrete arc matrix This operation has to be done for every arc of the net 35 By double click on the Place pcl a window appears and you must write in the first field of Token color the number of colours 2 and in the second filed the number of attributes 2 as shown in Fig 31 P PNetLab g E File Insert Analysis Settings Help ER EE nrm Hg 5 B PetriNet1 mn Appearance parameters Place color Black Red Yellow Green Magenta Cyan Blue Place size Osos 75 100 125 150 4 gt Fig 41 Petri Net Example setting continuous place colours and attributes number Subsequently by clicking on nsert tokens you can insert the value of tokens attributes for every colour Fig 37 FA pNetLab aiu File Insert Analysis Settings Help DIS Angore JE See E E B PetriNet1 a Place pc1 parameters Place name pe1 Token colors 2 2 Number of tokens x Appearance parameters Place color os Black Red Yellow Green Magenta Cyan Blue Place size Osos 75 100 125 150 4 gt B Fig 42 Petri Net Example setting continuous place attributes values The marking of the continuous place is displayed near the place as shown in Fig 38 36 FA PNetLab File Ins
13. H CH On oooqcoqoo 0d F e ON OO OO OO k OO OO oo GA k OO OO OH CO CH CH w GO OO kW OO OO CH CH Aa AGO k EA EA EA E Post incidence matrix t t t GA OO CHOCO OH CH CH k kW OOOO OOF ON OO OO Ob OO OO W Incidence matrix ct n e ct LA LA t GO OO OO OO k OO OO A OO OO OO OO A 3 COOC CH k CA On OO OO O O kA O O J oo OO OO OO OO CO k OO F O OO OO O O W EA EA EN ba EH EH EA E GA OO kW OO OO OH CH CH Fig 62 Pre Post and Incidence matrices ct LA N GA O H OO OH OO CH CH ct LA N kA OO OO OO CO CH ct LA LA kW OO OCH OO CH CH CH ct LA LA A k OO CH OO OH CH CH ct LA M OO k OO OO OO CH CH ct n M OO Ok OO OO CH 50 Including a control algorithm PNetLab simulator allows you to execute a supervisory control policy of the Petri Net by a controller that is a control algorithm that disables several enabled transitions in accordance with a control politics You must write this algorithm in C in the file Controller cpp You can visualize it by clicking this button Fig 63 Ei File Edit Search View Document Tools Macros Window Help D c 7 MO GR X Se oo 5 BDAlwYienr 74 1 Controller cpp kitinclude Controller hr include Functions hi itinclude Rete H int CU Control array Rete r Petri Net bool endContr Termination control algotithm int xstructConflict Transition group in structural conflict bool realConflict
14. Let suppose Place pl 2 tokens with 3 elements in particular token 1 1 7 8 and token 2 2 7 8 Place p2 0 tokens with 2 elements Transition guard tl pr 1 1 2 2 Transition guard t2 pr 2 2 7 Arc function pl2 tl 1 Arc function t1 p2 conc pr 1 1 pr 1 2 Arc function p27t2 1 Arc function t2 pl conc pr 2 1 pr 2 2 8 By double click on the Place pl a window appears and you must write in Number of token elements the number 3 and in Number of tokens the number as shown in Fig 31 28 PNetLab PetriNet Example1 pnml Place p1 parameters Place name Number of token elements Number of tokens Token elements Appearance parameters Place color gm WS WER Black Red Yellow Green Magenta Cyan Blue Place size 50 75 100 125 150 Delete place Ok Cancel Fig 31 insert number of token elements and number of tokens Subsequently by clicking on Token elements you can insert all elements of each token Fig 32 PNetLab PetriNet Example1 pnml Place p1 parameters Place name Number of token elements 3 Token elements Number of tokens 2 Ton temene e 1 7 Appearance parameters Place color gm ml EE mE Black Red Yellow Green Magenta Cyan Blue Place size Osos 75 100 125 150 Delete place Ok Cancel Fig 32 insert token elements For the Place p2 you must
15. Magenta Cyan Blue Transition size Osos 75 100 125 150 ead Fig 17 Transition parameters setting You can set the following parameters for an arc Fig 18 only after you have set the parameters of the place and of the transition which the arc links You must to press enter after you have insert each element of the arc matrix arc matrix colour of line that represent the arc Arc color WII WWII m Black Red Yellow Green Magenta Cyan Blue Fig 18 Arc parameters setting Parameters for Coloured Modified Hybrid Petri Nets As before You can set the following parameters for both discrete and continuous places Fig 19 name token colors of the place As more for a continuous place you can set the number of attributes in the marking using the windows circled in red in Fig 19 b You can modify the place appearance by setting Fig 19 Place parameters setting a discrete place b continuous place colour of border of circle that represent the place size of circle that represent the place Place p1 parameters Place name Token colors Insert tokens RRR RARARARARAARARAARR Appearance parameters Place color CW WW WWW Black Red Yellow Green Magenta Cyan Blue Place size 75 100 125 150 Ca ema 2 50 Place name Token colors Insert tokens Appearance parameters Place color Bl
16. Transition tl colour and colour 2 Transition t2 colour 1 2 Arc matrix pl2tl 1 0 2 0 1 Arc matrix t1 p2 o 1 Arc matrix p2 gt t2 bl 3 Arc matrix t22pl 41 l By double click on the Place p1 a window appears and you must write in the Token colours the string 1 2 3 as shown in Fig 25 24 Pet ab E III BRS sis Ce PetriNet Example pnml Place p1 parameters Place name a I ER Insert tokens Appearance parameters Place color CW Wa WER Black Red Yellow Green Magenta Cyan Blue Place size 50 75 100 125 150 mc ES x Fig 25 Petri Net Example insert token colors Subsequently by clicking on nsert tokens you can insert the number of the tokens for every colour Fig 26 PNetLab cJ PetriNet Example pnml Token colors Insert tokens Appearance parameters Place color gm ml mmm Black Red Yellow Green Magenta Cyan Blue Place size 50 75 100 125 150 Ss eae Fig 26 Petri Net Example insert tokens 25 Likewise for the Place p2 The colours and the number of the tokens for every colour are displayed on the places Fig 27 PNetLab PetriNet Example pnml Fig 27 Petri Net Example For insert the colours of the transition similarly by double click on the transition tl a window appear You must insert in the Transition colours the string 1 2 Fig 28 CERN
17. User Manual SUMMARY breed e esters eats TM ETE 3 SOPDTWare SEFUC 161 ican eae eet dni oe cd ee A Ree ee ee eee 4 ee eene 5 Punetionality or TEE ee E 6 Static KE Ee EE 7 ID Sesh abi e E TEE 9 EE Ee 11 Parameters for place transition Petri Nets uoo Peto EE 11 Parameters for Coloured Petri Nets with guard cccccccccccccssssssseeccceeeceaeensesecceeeeeeaeaeeeeeeeeseeeaaas 13 Parameters for Coloured Petri Nets without guard ccccccccssssssseecccecceeeeeeeecceeeeeaaaeeeeseeeeeeeeaaas 16 Parameters for Coloured Modified Hybrid Petri Net 18 Parameters and function syntax of PNetLab smulator 21 Example S d etn ne ee CCE Po Pee CEE ese CCRT ERNE Sind uM dE CRN UOT eT MEE 23 Comp ape pg Ne oso tea ota omui De nO sein naan eres enn TNS MrT trea Tener se fete RRS mene ato 40 GEIER Ee 4 ZAfialysiscoE d PetriNet RE 47 medine d control Al Orit DEDE digo Seton td orti tete Cdi qoo eene natu sae une iaa de orat eau dco re ada 51 eene 57 lir re ONUL ETO i ats ta sect OT mme 3 SOWAS UCO nean e Tt ODE Sm 4 hr D e EE 5 Functionality ol PlNetl ab simulatof EE 6 Stactime PINEPDAD simula e 7 EE ca wuchs C 9 EECHER 11 Parameters tor place transiiom EE e E 11 Parameters for Coloured Petri Nets with guard cccccccccccccsssssseececceeceaeeeseeecceeeesaaaaseeeeeeeeeeaaas 13 Parameters for Coloured Petri Nets without guard cccccccssssseseccccecceeeseeeeeeceeeeee
18. ack Red Yellow Green Magenta Cyan Blue Place size O 150 75 9 100 125 Delete place Ok Cancel Fig 19 Place parameters setting a discrete place b continuous place By clicking on nsert tokens a windows will appear It allows you to specify the number of tokens for each colour Fig 20 You must insert the number of tokens for each colour and you must to press enter For marking of continuous places having more than one attribute values of 66 99 attribute have to be separated with a coma Number of tokens Fig 20 Number of tokens 18 You can set the following parameters both for discrete and continuous transitions Fig 21 name occurrence colours of the transition For discrete transition you also can set the firing time Fig 21 a As more for continuous transitions you can set type of the firing speed 0 depending by continuous place marking 1 in the linear form Ax Bu where x is the marking of the place having an arc entering in the transition u is an input value A and B are matrices inserted by the user Fig 22 b You can modify the transition appearance by setting Fig 21 orientation horizontal or vertical colour of filling for a logical transition or colour of border for a timed transition of rectangle that represent the transition size of rectangle that represent the transition Transition t1 parameters Occurrence Colors
19. aeseesseeeeeeeenaas 16 Parameters for Coloured Modified Hybrid Petri Net 18 Parameters and function syntax of PNetLab smulator 2 Example E 23 Compre e ssi rdiet eer emer ee oer mere te ree ar name nee Dee pee dict MED eae pert 40 SEET EE E POTENT oreet or eec iecit totem acu dd telas a eee ep 4 ZAnalysits or a PetetlvNet PEO Pelle 0 et eiae da Roa b do uh eh 47 IMeCNIGINS a control Al CON MM E 51 DEIN TS tees RR RI CE SEI Introduction PNetLab is a software for Petri Nets PN simulation analysis and supervision PNetLab allows modelling and analysis of Coloured Modified Hybrid Petri Nets CMHPNs Coloured Petri Nets CPNs place transition nets timed untimed The simulation engine has been developed in C it works in cooperation with a graphical user interface and provides interactive simulation with graphical animation of the model and movement of the tokens step by step and off line simulations forward and backward time progression It allows drawing of timed untimed PN CPN CMHPN plant models by means a Java graphical user interface For PN models not for CPNs neither for CMHPNs the computation of T P invariant minimal siphons and traps pre incidence post incidence and incidence matrixes and coverability tree is available PNetLab allows the integration of a PN CPN CMHPN model with a standard C C control algorithm thus allowing closed loop analysis and simulation of supervised system
20. agenta Cyan Blue Place size 50 75 100 125 150 Delete place Fig 37 Petri Net Example insert discrete places tokens Likewise for the Place p2 The colours and the number of the tokens for every colour are displayed on the places Fig 38 FA PNetLab File Insert Analysis Settings Help z prm 68 hooge BIER FA PetriNet1 Fig 38 Petri Net Example 1 Ed E CJ For insert the colours of the transition similarly by double click on the transition tl a window appear You must insert in the Transition colours the number 2 Fig 39 34 FA PNetLab File Insert Analysis Settings Help _ 68 mies P PetriNet1 a Occurrence Colors 12 o H Appearance parameters Transition color EW M NM NN Black Red Yellow Green Magenta Cyan Blue Transition size 50 75 100 125 150 Delete transition DS nnns Fig 39 Petri Net Example discrete transition colours Likewise for transition t2 To insert the arc matrix you must to do a double click on one of the middle points A window appears that contains a matrix of zeros and you must insert there the correspondently arc matrix The following figure shows as insert the arc matrix for the Arc p17 tl FA PNetLab File Insert Analysis Settings Help gt BS obainn or E B PetriNet1 Arc p1 gt t1 parameters transition t1 Are matrix Color
21. an select the following operation Move Cut Copy Paste and Delete Fig 7 For example to execute the operation Move you must drag the black small squares at the vertices of the selected area FA PNetLab File Insert Analysis Settings Help DIS J Jr Esel L7 7 5n ai PetriNet1 CIE Fig 7 Selecting part of Petri Net 10 Setting parameters After drawing the net it is possible to set the parameters for Place Transition and Arc These parameters are different in relation of the type of net you are analysing Parameters for place transition Petri Nets You can set the parameters of the places transitions and arcs by selecting button and using double click on the object that you want to set a window will appear in which you can execute this operations You can set the following parameters for a place Fig 8 name number of tokens You can modify the place appearance by setting Fig 8 colour of border of circle that represent the place size of circle that represent the place Place p1 parameters Place name Number of tokens Appearance parameters Place color EW E WWW Black Red Yellow Green Magenta Cyan Blue Place size 75 9 100 125 150 Le pss Fig 8 Place parameters setting You can set this parameters for a transition Fig 9 name firing time firing rate 11 You can modify the transition appe
22. arance by setting Fig 9 orientation horizontal or vertical colour of filling for a logical transition or colour of border for a timed transition of rectangle that represent the transition size of rectangle that represent the transition Transition t1 parameters Transition name Appearance parameters Orientation o ar Transition color CW WE mmi m Black Red Yellow Green Magenta Cyan Blue Transition size Osso 75 9 100 125 150 Loe lem Fig 9 Transition parameters setting You can also modify the transition orientation by selecting the transition insertion button and clicking on the transition that you want to rotate It is possible set the following parameters for an arc Fig 10 arc weight colour of line that represent the arc Arc color gm mmm m Black Red Yellow Green Magenta Cyan Blue onl C Fig 10 Arc parameters setting 12 Parameters for Coloured Petri Nets with guard As before by selecting button and using double click You can set the following parameters for a place Fig 11 name number of token elements number of tokens token elements You can modify the place appearance by setting Fig 11 colour of border of circle that represent the place size of circle that represent the place Place p1 parameters Place name Number of token elements Number of tokens Appearance parameters Place color g
23. atura i 1 m i Call extern Xpress function mpli that solve GMEC constraint mpli C nrow ncol marcatura Lgmec kgmec nvgmec utran CV endContr true 56 Example In the following example the simulation of a coloured timed Petri Net with guard is shown Fig 64 You can find the file Example2 pnml in the directory PNetLab Examples col with guard PNetLab File Insert Analysis Settings Help koad PetriNet Example2 pnml conc pi5 2 8 1 t pr5 1 2 3 0 3 0 0 2 0 0 1 0 Fig 64 Petri Net Example2 57 PNetLab x Transition t1 parameters Appearance parameters EN Transition color Emil WER Black Red Yellow Green Magenta Cyan Blue Transition size sos 75 100 125 150 Le l eg EI 1 2 3 4 p3 EST x ps eonclbup Zut 11 t pi5 1 2 3 t5 Off Line simulation E Mee Fired transitions 0 3 0 0 2 0 0 1 0 Fig 65 Step 1 the guard function of the transition t1 selects the first and the third token of the place p1 PNetLab File Insert Analysis Settings Help PetriNet Example2 pnml 1 2 3 4 p3 dir me insert Ate Settings Hep IEEE MMEA BIS EIER e x ps conc pr 5 2 8 1 t pi5 1 2 3 Off Line simulation E REI wm transitions t5 10 3 0 0 2 0 0 1 07 Fig 66 Step 2 two tokens are removed from the places p2 and the token 1 2 3 4 is added to the pla
24. ccurrence transition colour has to be moved added from to the place Syntax for arc guard functions for coloured Petri Net with guard There are many functions defined in the PNetLab simulator Zen CN It builds the token c1 cn pra cy Ck Function projection from the first reversed token t of the place p it builds a new token that contains only the elements c1 Ck of the token lt t gt conc lt t gt lt ty gt Function link it builds a new token that contains all the elements of the tokens t4 tw All i It selects all the tokens of the place pj ntoken i It returns the number of tokens of the place pj BW k It builds k decolourated tokens that contain only one element equals to 1 Table 1 Syntax for arc functions and guard functions You can build an arc guard function by combining the functions in Table 1 or using several mathematical functions in accordance with the C C syntax or using C C functions written by user In the last case the C C code for this function must be written in the file F_user ccp and the headers of this function must be written in the file F user h Both files are in the directoryEngine SimEngine of the simulator You must use the C C syntax to combine more Boolean functions so you must use the following syntax for the logical operators AND 2 amp amp OR gt II NOT gt You can use and the round parenthesis
25. ce p3 58 PNetLab PetriNet Example2 pnml 1 2 3 3 p3 LEE Fig 67 Step 3 the token 1 2 3 4 is removed from the place p3 and three tokens are added to the place p4 PNetLab Transition t4 parameters Transition name Guard Firing time Firing rate Appearance parameters en Transition color CW WW WWW Black 50 Red Yellow Green Magenta Cyan Blue Transition size 75 100 125 150 Cal 99 1 2 3 4 p3 pa6 1 2 3 t6 ps conc pr b 2 8k 1 t pi5 1 2 3 t5 Off Line simulation fx Goo Fired transitions 10 3 0 0 2 0 0 1 07 ps conc pr5 2 8y 1 t Off Line simulation Step ED Fired transitions t4 10 3 0 0 2 0 0 1 0 Fig 68 Step 4 the arc function 0 3 0 0 2 0 0 1 0 adds three token to the place p5 if his token number of token elements is equal to three 59 PNetLab PetriNet Example2 pnml t AII 1 1 2 3 4 p3 Firing time Firing rate Transition name Guard pr 5 2 3 Firing time Firing rate Black Red Yellow Appearance parameters Tra Orientation Le bu Transition color E E WWW Black Red Yellow Green Magenta Cyan Blue Q sow 75 Transition size 50 75 100 125 150 Delete transition Cal Co ps conc pi5 2 8 1 t pi 5 1 2 3 t5 10 3 0 0 2 0 0 1 0 h conc pr5 2 8k 1 t
26. click the end simulation button if the maximum number of simulation steps is reached if no transition can fire In any case at the end of the simulation the initial Petri Net state 1s restored and visualized 46 Analysis of a Petri Net properties This analysis of properties is not available neither for coloured Petri Nets without guard nor for Hybrid petri Nets Selecting one of this following menus Analysis 2Coverability tree Analysis 2P invariants Analysis 2T invariants Analysis 2Siphons Analysis 2Traps or one of this buttons you can define how to calculate the Petri Net properties The result of this calculation is visualized in textual form in a separate window of a text editor You can analyse this following properties e coverability tree e P invariants e T invariants e siphons e traps You can also visualize the Petri Net matrixes by selecting the menu Analysis 2Incidence matrixes or clicking this button i The next example shows some Petri Net properties for the net in Fig 56 You can find this file Cat_Mouse pnml in the directory PNetLab Examples P T_net PNetLab PetriNet Cat_Mouse pnml p3 Room 3 p4 Room 4 p5 Room 1 p6 Room 2 p Room 3 p8 Room 4 Fig 56 Petri Net properties 47 For example you can visualize El Coverability Tree txt win32pad File Edit Search Tools Help D a E db B5 i o ow ES Liz 1 1 1 1 i i i 1 1
27. ctory different from C Program Files PNetLab Please refer to readme txt file to obtain more details instruction about the installation of PNetLab simulator Functionality of PNetLab simulator PNetLab simulator allows you to execute the following operations e draw a Petri Net e simulate a Petri Net o in Off Line mode for any Petri Net o in Step by Step mode only for not timed Petri Nets e analysis of Petri Net not available for CPNs neither for CMHPNSs by means of o coverability tree o P invariants o T invariants o Siphons O traps Starting PNetLab simulator The simulator starts by launching the filePNetLab bat Firstly a program presentation window is opened Fig 1 it must be closed to use the simulator PNetLab PNetLab Universita degli Studi di Salerno on web www unisa it Automatic Control Group Fig 1 PnetLab presentation window Then the type of Petri Net has to be chose Fig 2 once operating and confirming a choice this window closes and the selected editor starts Petri Net type Choose type of Petri Net C Place Transition net C Colored with guard C Colored without guard amp Colored modified HPN Ca m Fig 2 Petri Net type selection window The main window is shown inFig 3 It allows both to open a previously saved file and to create a new one this operations are available from the menu File 2New and File 2Open or from this EN correspondent
28. e continuous arc matrix you must to do a double click on one of the middle points A window appears that contains a matrix of zeros and you must insert there the correspondently arc matrix as shown in FA PNetLab BAR fie Insert Analysis Settings Help DIS IIl es AJE B PetriNet1 a Arc pc1 gt tc1 parameters transition tc1 Arc matrix Color 1 Color 1 1 1 d 0 0 pc1 place bei Color 2 1 050 3 2 0 80 8 Arc color T e L M LL WW Black Red Yellow Green Magenta Cyan Blue Fig 46 Petri Net Example insert continuous arc matrix This operation has to be done for every arc of the net Finally you have to set the sample time value and you can do it clicking on the button In this way the following windows appears 38 Set Sample Time Sample Time Fig 47 Petri Net Example insert sample time Only after you have set the parameters for the whole net you can compile and you can execute the simulation These operation are shown in the next sessions 39 Compiling a Petri Net After drawn a Petri Net you must compile it to execute either simulation or analysis You can compile the drawn Petri Net if composed by one place and one transition at least You can run this operation by selecting the menu Analysis 2Compiling or clicking compile button IE all Analysis menu items and all correspondent buttons are activated not for Coloured Petri Net w
29. ement j Output element j of the token i of the place pj 32 Input place name p_iand tokent oken voidaddToken char p_i int token Output none It adds the token to the place Input place index p_i and token token voidaddToken intp_i int token Output none It adds the token to the place Inputi place name p_iand number idToken of the token intdelToken char p i intidToken Output 1 if token removing is successful otherwise 0 It removes the token from the place Inputi place index p_i and number idToken of the token intdelToken intp_i intidToken Output 1 if token removing is successful otherwise 0 It removes the token from the place Table 2 Usable C function to write a control algorithm You can call the functions in Table 2 in the control algorithm You can also e call functions that are written out of the predetermined method controller but in the file Controller cpp e call functions that are specified in the file F_user h and implemented in the fileF_user cpp e call functions that are specified in the file file_name h and implemented in the file file name cpp in this case you must add the line include file_name h in the file 53 Controller cpp You must also add the files file name handfile name cpp in the directory Engine SimEngine SimEngine new of simulator finally you must modify the file buildsim bat in the directory En
30. ert Analysis Settings Help pi mies Fe es B EA PetriNet1 aata LS wn Fig 43 Petri Net Example marking of continuous places By double click on the Transition tcl a window appears and you must write in the field Occurrence color the number of colours 2 and in the field Type the firing speed type 1 as shown in Fig 312 FA PNetLab eid File Insert Analysis Settings Help AAA p eh zar rm EISIEIRSEIlL2OEr F B PetriNet1 E A Transition tc1 parameters Transition name cl Occurrence Colors Type lt 1 0 5 0 3 gt pet Appearance parameters t1 lt 2 0 8 0 9 gt Orientation e Transition color SSI te Black Red Yellow Green Magenta Cyan Blue Transition size Osos O75 100 O 125 150 t2 Ca leg eg gt Fig 44 Petri Net Example setting continuous transition parameters Subsequently by clicking on Set Velocity you can insert the value of transition s firing speed for every colour Fig 373 37 F4 PNetLab File Insert Analysis Settings Help Be EISIEREIS JE B PetriNet1 Set Linear Velocity 1 0 5 0 3 gt Appearance parameters Matrix A lt 2 0 8 0 9 gt Transition color M m mm Black Red Yellow Green Magenta Cyan Blue Transition size Osos Casa 100 125 150 Delete transition Set Velocity RSC Fig 45 Petri Net Example setting continuous transition firing speed To insert th
31. eters for Coloured Petri Nets without guard As before You can set the following parameters for a place Fig 15 name token colours of the place You can modify the place appearance by setting Fig 15 colour of border of circle that represent the place size of circle that represent the place Place p1 parameters Place name Token colors Appearance parameters Place color CRW ae E m Black Red Yellow Green Magenta Cyan Blue Place size 50 075 100 125 150 oom Fig 15 Place parameters setting By clicking on nsert tokens a windows will appear It allows you to specify the number of tokens for each colour Fig 16 You must insert the number of tokens for each colour and you must to press enter Number of tokens Colors Color 1 Color 2 Colo 0 0 0 IA v Ok Fig 16 Number of tokens You can set the following parameters for a transition Fig 17 name occurrence colours of the transition firing time 16 You can modify the transition appearance by setting Fig 17 orientation horizontal or vertical colour of filling for a logical transition or colour of border for a timed transition of rectangle that represent the transition size of rectangle that represent the transition Transition t1 parameters Appearance parameters Orientation ve er Transition color Em mmm m Black Red Yellow Green
32. gine SimEngine SimEngine new of simulator in this Way EE cd Engine cd SimEngine SimEngine new tunz Arco guardie cl c file name cpp chc cuservcpo CIG COntroLller Cph cL eSSimulacorescoo link ZOUI Simulatore exe Samulatore obj Simula obJj JECO obj Ir us obj POStO Oob Rete obj eventlist obj FUNZIONI 5 F user ob RND obj file name obj Controller obj You must restore the original file buildsim bat if you don t want to include a control algorithm anymore You must always compile the Petri Net to activate the written control algorithm After closing the program the file Controller cpp 1s stored in the directory Engine SimEngine SimEngine new if you restart the simulator the precedent file Controller cpp is loaded when you compile a new Petri Net and the control algorithm is applied to the simulation and the analysis of the Petri Net It may cause several unexpected behaviours or mis functionalities of the simulator Then you must always verify that the file Controller cppis correct In the following example a control algorithm that uses the Xpress functions is shown You can find this contro algorithm file ControllerXpressExample cpp in the directory PNetLab Examples P T_net XpressExample this algorithm enforces the behaviour of the Petri Net XpressExample pnml that you can find in the same directory 54 Example include lt stdlib h gt include lt stdio h gt include Controller h clude Rete h
33. he place You can insert a discrete transition by selecting the menu nsert 2Discrete Transition or selecting this button cl clicking in the position on the drawing area in which you want to draw the transition You can insert a discrete arc by selecting the menu nsert 2Discrete Arc or selecting this button then you must click on Petri Net source node and on Petri Net destination node you can insert also an intermediate point of a arc by clicking on the drawing area before to arrive to destination node You can insert a continuous place by selecting the menu Insert 2Continuous Place or selecting this button clicking in the position on the drawing area in which you want to draw the place You can insert a continuous transition by selecting the menu nsert 2Continuous Transition or selecting this button ES clicking in the position on the drawing area in which you want to draw the transition You can insert a continuous arc by selecting the menu Insert PContinuous Arc or selecting this button then you must click on Petri Net source node and on Petri Net destination node you can insert also an intermediate point of a arc by clicking on the drawing area before to arrive to destination node You can move the Petri Net nodes or an arc intermediate points by selecting this button and dragging the object that you want to move You can select a part of the Petri Net by selecting this button Clicking on the selected area you c
34. ithout guard PNetLab Analysis Settings Help TSS Bai PetriNet Draw_example pnml Fig 48 A compiled Petri net If the compilation is not correctly execute you must verify the correct syntax of the parameters of the whole net because the simulator has not a syntax interpreter However you can visualize the output message of the compiler by selecting the menu Analysis Log file 40 Simulation of a Petri Net Before executing a simulation of a Petri Net you must set several parameters in an appropriate window opened by selecting the menu Analysis 2Simulation parameters Fig 49 You can set these following parameters e simulation mode e initial instant e final instant e maximum number of simulation steps e conflicts management It is possible to choose if you want to write the out files with the report of simulation or not At this point you can start the simulation by selecting the menu Analysis 2Simulation or clicking on simulation button D gt Simulation parameters Simulation modes Off Line simulation C sequential mode Step by Step simulation bac J concurrent mode Parameters Initial instant Final instant Maximum number of steps Conflicts management Predefined Scheduling order Same firing rate C Stocastic firing rates Controller v Out files writing Ok Cancel Fig 49 Simulation parameters setting PNetLab manages conflicts by
35. lation by colouring in orange the enabled transitions disabling all the active menus and all the active buttons and enabling only the start simulation button D gt and the end simulation button You can now choose which transitions has to fire by selecting them the simulator colours in red these transitions Fig 54 They fire when you click on the start simulation button You can disable the transitions selected by clicking again PNetLab File Insert Analysis Settings Help p S o Evie PetriNet Draw_example pnml Fig 54 Simulation in concurrent step by step mode As described before you must choose the colours under which the transitions fire for the coloured Petri Nets without guard also The transition becomes red only after you specify either the colour or the colours if more than one under which the transition fires You must select the colours under which a transition fires and write them on the appropriate field separated by line space Fig 55 This operation should be done for any transition you want fire simultaneously when you click on the start simulation button 45 Transition t1 Enabled colors Select colors Fig 55 Select colours in concurrent step by step mode The simulator calculates the new Petri Net state it visualizes the state it colours in orange the enabled transitions This procedure is repeated until the end of the simulation The simulation can terminate if you
36. m mm nm Black Red Yellow Green Magenta Cyan Blue Place size C 150 C 75 9e 100 125 S ES Fig 11 Place parameters setting By clicking on Token elements a windows will appear It allows you to define the elements of each token As shown in Fig 12the Number of token elements 1s 2 and the Number of tokens is 3 You must insert a single element and you must to press enter 13 Token elements Fig 12 Token elements You can set the following parameters for a transition Fig 13 name guard firing time firing rate You can modify the transition appearance by setting Fig 13 orientation horizontal or vertical colour of filling for a logical transition or colour of border for a timed transition of rectangle that represent the transition size of rectangle that represent the transition Transition t1 parameters Appearance parameters Orientation En EH ar Transition color CW Wa WWW Black Red Yellow Green Magenta Cyan Blue Transition size 50 75 9 100 125 150 ea Fig 13 Transition parameters setting 14 It is possible set the following parameters for an arc Fig 14 arc function colour of line that represent the arc Are color CW WU WW WS Black Red Yellow Green Magenta Cyan Blue a pcm Fig 14 Arc parameters setting In the next session you can find the syntax for the arc function 15 Param
37. r backward button to visualize on the drawing area all the states that the Petri Net assumes during the simulation In the same simulation window you can read several useful information such as the current simulation step the current simulation time and the transition fired in the precedent state Fig 50 42 PNetLab File Insert Analysis Settings Help Off Line simulation Step Time Fired transitions Fig 50 Simulation in Off Line mode For the Coloured Petri Nets without guard we have the same simulation window in the Off Line mode simulation It also shows the colours under which the transitions fire Off Line simulation Step Time Km Fired transitions Fig 51 Off Line simulation windows As shown in Fig 51 at the first step the transition f fires under the colourc and under colourc2 the transition t2fires under the colourc You must click on stop simulation button to terminate this simulation The initial state of Petri Net is restored and visualized Simulation in sequential Step by Step mode The simulation in sequential Step by Step mode allows the user to interact with the simulator This mode is not available with the hybrid nets The simulator takes the simulation parameters and it starts an interactive simulation by colouring in orange the enabled transitions Fig 52 disabling all the active menus and all the E active buttons and enabling only the
38. s It is also interfaced with Xpressby Dask Optimization a tool of linear programming The simulation engine without graphical interface can be linked to an external program This allows the integration of PNetLab simulation engine in a general purpose simulation loop Software structure PNetLab software consists of a directory called PNetLab and a set of sub directories e GUI it contains files related to the graphical user interface e Engine it contains files related to the simulation engine e win32pad it contains a text editor to visualize in textual form Petri Net properties that simulator can analyse e Examples it contains several demonstrative Petri Net models In PNetLab directory we can find the file PNetLab bat to start manually the simulator Installation The simulator runs under Microsoft Windows XP Windows Vista and Windows Seven operating system The installation program starts by launching the file setup_v4_0 exe The simulator requires the following freeware software installation to work correctly Java 2 SDK Standard Edition 1 4 1_01 or following versions www java sun j2se 1 4 2 Microsoft Visual C 2010 Express Crimson Editor You can download it from official web sitewww crimsoneditor com During the installation set C Program Files PNetLab Crimson Editor as destination directory or C name_of_directory_where_PNetLab_has_been_installed Crimson Editor if PNetLab has been installed in a dire
39. s the guard functions the arc functions Before analyse in detail all the parameters you can set it can be useful to list the main functions with a brief description of their operating mode and their syntax for a correct use Place transition name The place transition name is a simple text label so you must not follow any rule for it You can also associate a comment label to the place p transition tj in this case next to the place pi transition tj the following label is shown p abel t label Token colours of the place and occurrence colours of the transition Both token colours of the place and occurrence transition colour must be inserted as strings They allow to define both the token colours number and the occurrence colours themselves It 1s possible by simply writing the string of the colours separated by line space Colours must by integers Number of token elements The number of token elements is a natural integer number It defines the size of each token that stays in the place Number of tokens The number of tokens is a natural integer number Token elements The token elements are integer numbers They define the elements of each token Arc weight The arc weight is always a positive integer number 24 Arc matrix The arc matrix 1s a positive integer matrix For an output input arc that connect a place p with a transition f it describes how many tokens for each token colour and for each o
40. using the following resolution policies e Predefined Scheduling order PNetLab assigns a static priority to the transition in conflict based on the order in which they have been drawn e Same firing rate transition in conflict relation have the same firing probability 4 e Stochastic firing rate transition in conflict relation have a firing probability defined a priori by the user e Controller the subroutine Controller is called to solve the conflict the conflict resolution is charged to the user who has the responsibility of programming the proper conflict resolution policy If you don t set the simulation parameters you can start a simulation in Off Line mode that lasts maximum 1000 times units and maximum 100 simulation steps The conflicts management is in accordance with the Predefined Scheduling order and the output files will be written If you start a new simulation the parameters of the old simulation will be valid if you don t modify the simulation parameters You can execute a simulation in Off Line mode or in Step by Step mode You can also execute the second one in sequential mode or in concurrent mode In the next sub sessions you can find more information on the simulation mode Simulation in Off Line mode The Off Line mode simulation allows you to execute a simulation without interaction At the end a simulation window is opened by which you can observe the Petri Net evolution by clicking on forward button o
Download Pdf Manuals
Related Search
Related Contents
User Manual - Howard Computers Laboratório de Circuitos Lógicos 設置説明書 In-Fire TABLE DES MATIÈRES PoE Industrial Ethernet Extender IVC Manual do proprietário Controller ATyS C20 / C30 Copyright © All rights reserved.
Failed to retrieve file