Beruflich Dokumente
Kultur Dokumente
1 Introduction
The Petri net formalism was first introduced by Carl
Adam Petri in 1962 for modeling and visualization
of concurrency, parallelism, synchronization, re-
source sharing, and non-determinism [1]. A Petri net
is a graph with two different kinds of nodes, called
transitions and places; thereby, places and transi-
tions are connected by arcs. Every place in a Petri
net can contain a non-negative integer number of
tokens. These tokens initiate transitions to fire ac-
cording to specific conditions. These firings lead to
changes of the tokens in the places.
In the recent years, Petri nets with their various Figure 1: Relationships between the different formalisms
extensions are becoming increasingly popular. They There are already three Petri net libraries availa-
have been proven to be a universal graphical model- ble on the Modelica homepage (www.modelica.org).
ing concept for representing different systems in The first was developed by Mosterman et al. and
nearly all degrees of abstraction. They support the enables the modeling of a restricted class of discrete
Petri nets, called normal Petri nets [4]. The places of se fixed delays can be replaced by exponentially dis-
normal Petri nets can only contain zero or one token. tributed random variables, then, the corresponding
Additionally, all arcs have the weight one and exter- transition is called stochastic transition. Thereby,
nal signals initiate the firing of transitions. If a con- the characteristic parameter λ of the exponential dis-
flict occurs between two or more transitions, the tribution can depend functionally on the markings of
transition with the highest priority fires. Hence, only several places and is recalculated at each point in
deterministic behavior is represented by this kind of time when the respective transition becomes active
Petri net. or when one or more markings of involved places
The second Petri net library is an extension of the change. Based on the characteristic parameter, the
previous one and was developed by Fabricius [5]. next putative firing time of the
The places are able to contain a non-negative integer transition can be evaluated and it fires when this
number of tokens and can be provided with non- point in time is reached.
negative integer minimum and maximum capacities.
xHPN: Extended Hybrid Petri Nets
Furthermore, the transitions are timed with fixed or
Places
stochastic delays.
Transitions
The third library, called StateGraph, is based on (time-)discrete state
(time-)discrete process (integer quantity)
Grafcharts which combines the function chart for-
(event)
malism of Grafcet with the hierarchical states of continuous state
stochastic process (real quantity)
Statecharts [6]. The StateGraph library is part of the
(random event) Arcs
Modelica standard library and was developed by Ot- „normal“ arc
ter et al. [7]. continuous process
(flow) inhibitor arc
The relationships between the mentioned con- test arc
cepts are displayed in Figure 1. To enable modeling read arc
of different systems with Petri nets in Modelica, the
existing libraries have to be extended by the follow- Figure 2: Icons of the xHPN formalism
ing aspects: Both - discrete and stochastic transitions - fire by
Transfer of the discrete Petri net concept to a con- removing the arc weight from all input places and
tinuous one, adding the arc weight to all output places. On the
Support of edges with (functional) weightings, contrary, the firing of continuous transitions takes
Support of test-, inhibitor, and read arcs, place as a continuous flow determined by the firing
Support of (different) conflict resolutions (ran- speed which can depend functionally on markings
dom decisions), and/or time.
Combination of discrete and continuous Petri net Places and transitions are connected by normal
elements to hybrid Petri nets. arcs which are weighted by non-negative integers
and real numbers, respectively. But also functions
can be written at the arcs depending on the current
2 Extended Hybrid Petri Nets markings of the places and/or time. Places can also
be connected to transitions by test, inhibitor, and
The extended Hybrid Petri Net (xHPN) formalism read arcs. Then their markings do not change during
comprises three different processes, called transi- the firing process. In the case of test and inhibitor
tions: discrete, stochastic, and continuous transition, arcs, the markings are only read to influence the time
two different states, called places: discrete and con- of firing while read arcs only indicate the usage of
tinuous places, and four different arcs: normal, in- the marking in the transition, e.g. for firing condi-
hibitor, test, and read arcs. The icons of the formal- tions or speed functions. If a place is connected to a
ism are shown in Figure 2. transition by a test arc, the marking of the place must
Discrete places contain a non-negative integer quan- be greater than the arc weight to enable firing. If a
tity, called tokens or marks, while continuous plac- place is connected to a transition by an inhibitor arc,
es contain a non-negative real quantity. These marks the marking of the place must be less than the arc
initiate transitions to fire according to specific condi- weight to enable firing. In both cases the markings of
tions and the firings lead to changes of the marks in the places are not changed by firing.
the connected places. The conversion of a discrete to a continuous
Discrete transitions are provided with delays and marking is realized by connecting a discrete transi-
firing conditions and fire first when the associated tion to a continuous place and the conversion from a
delay is passed and the conditions are fulfilled. The- continuous to a discrete marking is realized by con-
necting a continuous place to a discrete transition.
T1 1 P2
However, the conversion process is always per- 1
formed by discrete transitions, discrete places can
only influence the time when continuous transitions P1
fire but their marking cannot be changed during the
2
continuous firing process. Figure 3 shows examples T2 1 P3
of these two basic principles:
T1 can only fire when P1 has more than zero
Figure 4: Example of a type-1-conflict; P1 has not enough
marks and P3 has at least one mark (influence), tokens to fire T1 and T2 simultaneously.
T2 can only fire when P4 has at least one mark
and P6 has at least 5.4 marks (influence), This can be either done by providing the transi-
T3 fires by removing one mark from P7 and add- tions with priorities or probabilities. In the first case,
ing 1.8 marks to P8 (conversion), a deterministic process decides which place enables
T4 fires by removing 0.8 marks from P9 and add- which transition and in the second case the enabling
ing one mark to P10 (conversion). is performed at random; thereby transitions assigned
with a high probability are chosen preferentially.
P1 P2
1 T1 1 P4 1 T2 1 P5
8.6 1.8
P1 P1
T1 1 T1 1
0 0
1 1 5.4 5.4
v1=3 1 v1=3 1
P6
P3
8.9
P2 P2
T2 1 3 T5 T2 1 3 T5
0 0
1 1
v2=10.5 v5=3 v2=7.5 v5=3
P8 P9
P7 1 T3 1.8 0.8 T4 1 P10
0.0 3.4
2 2
P3 P3
T3 1 3 T6 T3 1 3 T6
P7 P8 0 0
3.6
3.2
v3=11.7 v6=2 v3=6 v6=2
2.8 2 2
2.4
P4 P4
T4 1 T4 1
0 0
Marks
2.0
1.6
0.4
Figure 5: Example of a type-2-conflict; the input speed of
0.0 P2 and P3 is not sufficient to fire T5 and T6 with the de-
0.0 0.5 1.0 1.5 2.0 2.5 3.0
Time termined speed.
Figure 3: Basic concepts of hybrid Petri nets and marking Another conflict can occur between a continuous
evolution of places and achieved by firing with place and two or more continuous transitions when
a delay of 1 of the bottom left Petri net.
the input speed is not sufficient to fire all output
It is important to mention that a discrete transition transitions with the respective speed or when the
fires always in a discrete manner by removing and output speed is not sufficient to fire all input transi-
adding marks after a delay is passed regardless of tions with the respective speed (type-2-conflict, see
whether a discrete or a continuous place is connected Figure 5). This conflict is solved by sharing the
to it. However, a continuous transition fires always speeds proportional to the assigned maximum speeds
by a continuous flow so that a discrete place can only (cf. [8]).
be connected to continuous transition if it is input as
P1 P2
well as output of the transition with arcs of same 8.6
1 T1 1
1.8
a discrete place or a continuous place connected to Figure 6: Example of a type-3-conflict; at time 0, T1 be-
discrete transitions has not enough marks to enable comes active and fires continuously. At time 2, the delay
all discrete output transitions simultaneously or can- of T2 is passed and it becomes firable. At this point in
not receive marks from all active input transitions time, P3 has a conflict because it cannot fire tokens in T1
due to the maximum capacity. Then a conflict arises and T2, simultaneously. Hence, T2 takes priority over T1
that has to be resolved (type-1-conflict, see Figure and fires.
4).
If a conflict occurs between a place and continu- valve flapper ( ). Then the water can flow ( )
ous as well as discrete/stochastic transitions, the dis- from the tank ( ) to the bowl ( ) and afterwards
crete/stochastic transitions take always priority over to the sewer ( ). When the water flows to the bowl,
the continuous transitions (type-3-conflict, see Fig- the float ( ) sinks in the toilet tank. If the float falls
ure 6). below a specific level (inhibitory arc), the tank fill-
v1=2 valve ( is opened ( ) and new water can flow
P1
1 T1 1
P2 ( ) into the tank. This causes also that the float ris-
8.6 1.8
es and when a specific level is reached (test arc), the
1 1 tank fill-valve is closed ( ). If the lever has re-
turned to its starting position, the flush valve flapper
P3 sinks back to the bottom ( ) and no water can flow
into the bowl anymore.
1 1
P4 P5
8.6
1 T2 1
1.8 3 PNlib
v2=3
The advanced Petri Net library, called PNlib, enables
Figure 7: Example of a type-4-conflict; at time 0, P3 can the modeling of extended hybrid Petri Nets (xHPN).
either enable T1 or T2 but not both simultaneously. This
It comprises
conflict can be solved by prioritization of the transitions.
a discrete (PD) and a continuous place (PC),
A last conflict can occur when a discrete place a discrete (TD), a stochastic (TS), and a continu-
has not enough marks to enable all connected con- ous transitions (TC), and
tinuous transitions. This is solved by prioritization of a test (TA), an inhibitor (IA), and a read arc (RA).
the involved transitions (type-4-conflict, see Figure
7).
Visitor enters
toilet
T1
P1 Visitor
T2 Push lever
P2 Lever
T9
Sink
T4 Lift flapper T3
water
flows
flapper
lowing sub-packages:
T5
Water
flows
Level of
float
Tank fill-
valve Interfaces: contains the connectors of the Petri net
component models.
close
P6 P7
P5 Water in
bowl
Blocks: contains blocks with specific procedures
T8
that are used in the Petri net component models.
T6 Sewer
Functions: contains functions with specific algo-
rithmic procedures which are used in the Petri net
Figure 8: Hybrid modeling of a flush toilet with the aid of component models.
xHPN formalism
Constants: contains constants which are used in
Figure 8 shows an example of hybrid modeling the Petri net component models.
by the xHPN formalism. The model represents a Models: contains several examples and offers the
flush toilet. A visitor enters the toilet; thereby, the possibility to structure further Petri net models.
time between two visitors is not exactly known so Additionally, the package contains the component
that it is modeled by a stochastic transition with an settings which enables the setting of global parame-
exponentially distributed delay ( ). The visitor ters for the display and the animation of Petri net
( ) pushes ( ) the lever ( ) which lifts the flush models.
Places, transitions, and arcs are represented by the signed to connections according to the Modelica
icons depicted in Figure 9. Thereby, the discrete Specification 3.2.
place is represented by a circle and the continuous Table 1: Parameters and modification possibilities of dis-
place by a double circle. The transitions are boxes crete (d) and continuous (c) places
which are black for discrete transitions, black with a
white triangle for stochastic transitions, and white for Name Type Default
continuous transitions. The test arc is represented by Description
startTokens/ scalar 0
a dashed arc, the inhibitor arc by an arc with a white startMarks
circle at its end, and the read arc by an arc with a Marking at the beginning
black square at its end. of the simulation
minTokens/ scalar 0
3.1 Connectors minMarks
Minimum capacity
maxTokens/ scalar infinite
The PNlib contains four different connectors: maxMarks
PlaceOut, PlaceIn, TransitionOut, and Tran- Maximum capacity
sitionIn. The connectors PlaceOut and PlaceIn enablingType choice/ Priority
are part of place models and connect them to output Type of enabling if type- scalar
and input transitions, respectively. Similar, Transi- 1-conflicts occur; the
tionOut and TransitionIn are connectors of the priorities are defined by
transition model and connect them to output and in- the connection indices
put places, respectively. Figure 10 shows which con- and the probabilities by
the variables ena-
nector belongs to which Petri net component model.
blingProbIn/Out
TransitionIn PlaceIn enablingProbIn vector fill(1/nIn,nIn)
Enabling probabilities of
input transitions
enablingProbOut vector fill(1/nOut,nOut)
Enabling probabilities of
output transitions
PlaceOut TransitionOut
N scalar settings1.N
Figure 10: Connectors of the PNlib. Amount of levels for sto-
chastic simulation
The connectors of the Petri net component models restart condition false
are vectors to enable the connection to an arbitrary Condition for resetting expres-
number of input and output components. Therefore, the marking to sion
the dimension parameters nIn and nOut are declared reStartTokens/Marks
reStartTokens/ scalar 0
in the place and transition models with the con- reStartMarks
nectorSizing annotation. When the reStart condi-
tion is fulfilled, the mark-
3.2 Places ing is set to reStartTo-
kens/Marks
The parameters of places are summarized in Table 1.
The input of enabling probabilities as vector is
If the type-1-conflict is resolved by priorities, the
demonstrated by Figure 11. Place P1 is connected to
corresponding priorities of the transitions are given
the transitions T1, T2, and T3 and the connection to
by the indices of the connections, i.e. the transition
T1 is indexed by 1, the connection to T2 is indexed
connected to the place with the index 1 has also the
by 2, and the connection to T3 is indexed by 3. Thus,
priority 1, the transition connected to the place with
the corresponding connect-equations are
the index 2 has also the priority 2 etc. Otherwise, if
connect(P1.outTransition[1],
the probabilistic enabling type is chosen, the corre- T1.inPlaces[1]);
sponding probabilities for the transitions have to be connect(P1.outTransition[2],
entered as a vector. Thereby, the first vector element T2.inPlaces[1]);
corresponds to the connection with the index 1, the connect(P1.outTransition[3],
T3.inPlaces[1]);
second to the connection with the index 2 etc. The
input of enabling probabilities as vectors in the place The enabling probabilities 0.3 for T1, 0.25 for T2,
model, and not at the corresponding arcs, is neces- and 0.45 for T3 have to be entered by the parameter
sary due to the fact that properties cannot be as- vector
enablingProbOut={0.3,0.25,0.45}.
that connections cannot be provided with properties
T1
according to the Modelica Specification 3.2.
[1]; 0.3 Table 2: Parameters and modification possibilities of dis-
crete (d), stochastic (s), and continuous (c) transitions
P1 [2]; 0.25 T2
Name Type Part Default
[3]; 0.45 Description of Allowed
delay scalar d 1
T3 Delay of timed non-negative
transitions real values
Figure 11: Input of enabling probabilities. h scalar or s 1
Hazard function scalar non-negative
The main process in the place model is the recal- to determine the function real values
culation of the marking after firing a connected tran- characteristic
sition. In the case of the discrete place model, this is value of exponen-
realized by the discrete equation tial distribution
when tokeninout or pre(reStart) then maximumSpeed scalar or c 1
t=if tokeninout then pre(t)+ Maximum speed scalar non-negative
firingSumIn - firingSumOut else function real values
reStartTokens;
end when; arcWeightIn vector or d,s,c 1
Weights of input vector non-negative
whereby pre(t) accesses the marking t immediate- arcs function integers (d,s),
ly before the transitions fire. To this amount, the arc non-negative
weight sum of all firing input transitions is added real values (c)
and the arc weight sum of all firing output transitions arcWeightOut vector or d,s,c 1
is subtracted from it. Additionally, the tokens are Weights of output vector non-negative
reset to reStartTokens when the user-defined arcs function integers (d,s),
condition reStart becomes true. non-negative
The marking of continuous places can change real values (c)
continuously as well as discretely. This is imple- firingCon condition d,s,c true
Firing condition expression Boolean con-
mented by the following construct
dition expres-
der(t)=conMarkChange;
when disMarksInOut then sion
reinit(t,t+disMarkChange); The input is demonstrated by the following ex-
end when;
when reStart then amples. Figure 12 shows a discrete Petri net. The
reinit(t,reStartMarks); indices of the connections are written at the arcs
end when; within square brackets, e.g. the connection
whereby the der-operator access the derivative of has the input index [1] and has the
the marking t according to time. The continuous output index [3]. The input of the arc weights dis-
mark change is performed by a differential equation played after the indices to property dialog or as mod-
while the discrete mark change is performed by the ification equation is performed by the vector func-
reinit-operator within a discrete equation. This tions
operator causes a re-initialization of the continuous arcWeightIn = {2*P1.t,4} and
marking every time when a connected discrete tran- arcWeightOut = {2,1,5*P1.t},
sition fires. Additionally, the marking is re-initialized whereby the expression P1.t accesses the current
by reStartMarks when the condition reStart marking of P1. Thus, the weights of the arcs
becomes true. and are functions which de-
pend on the marking of P1.
3.3 Transitions
P3
3
T1
P3_t
P6_t
2
T1
P3_t
P6_t 5 Application
11.43 T2 3.83 T2
P1 P1
4
2.0 P5_t
14.34
4.30
T3
P6
4
2.0 P5_t
3.34
4.30
T3
P6
The PNlib is so powerful but also so universal and
P2
T4
P4
1.20 P7
14.23
P2
T4
P4
1.20 P7
29.08
generic that it is an ideal all-round-tool for model-
ing and simulation of nearly all kinds of processes,
SETTINGS 0.0 SETTINGS 0.0
1.0 1.0
d=5.5 P5 d=5.5 P5
P3_t
P6_t
P3_t
P6_t
logistic processes, work flows, traffic flows, data
P1
1
T1
2.22 T2
P1
0
T1
3.22 T2
flows, multi-processor systems, communication pro-
d=1.8 P3
4.30 P6
8.23 d=1.8 P3
4.30 P6
8.23
tocols, and functional principals. This section gives
4 4
P2
2.0
T4
P5_t
P4
0.0
T3
29.94
P2
2.0
T4
P5_t
P4
0.0
T3
29.94
an overview of the different application fields using
SETTINGS 0.0
1.0
1.20 P7
SETTINGS 1.0
1.0
1.20 P7
the PNlib. Three selected examples
Modeling a Senseo coffee machine,
d=5.5 P5 d=5.5 P5
pad_in
0 0
on
d=1
T1
0
puffer
Cups Total
Temperature heating cooling
11
0
20
start
Insert Pad
77
pumping TW
water_hc 0.25
starting
d=1
T9
Start T2 d=0
d=1 one_cup d=1
0
next_coffee
T5 T3
stop
scalding 0 0
d=1 two_cups d=1 decision1
Water Tank
0
d=1
d=1
T7
T8
T6 T4
Refill Stop/Next
coffee_cup 0
counting stop_or_next
d=0
0
0
decision2
40 0.80 0.65
0.60
0 36 0.50
0.70 0.45
0.40
32 0.65 0.35
Amount of Coffee Cups
0.30
amount_cups 0.60
0.25
Water in Tank [l]
28 0.20
0.15
24 0.50
refilling1 refilling2 20 0.45
0.40
16
0.35
0 12 0.30
8 0.25
0.20
4
d=1 puffer d=30 0.5 0.15
0 0.10
0.00E0 2.50E3 5.00E3 7.50E3 1.00E4 1.25E4 1.50E4 1.75E4 0.00E0 2.50E3 5.00E3 7.50E3 1.00E4 1.25E4 1.50E4 1.75E4
Time [s] Time [s]
95
water_tank 0.26
90
Water Temperature in Heating Camber [°C]
85
Water Temperature in Heating Camber [°C]
0.24 80
0.30 0.22
0.20
100 75
70
0.28 0.18 95 65
60
Coffee in Cup [l]
0.16
0.14 90 55
0.26 0.12
85
50
45
40
0.10
0.24 0.08
80
35
30
0.06 25
0.22 0.04
75 20
0.02 1.33E4 1.34E4 1.35E4 1.36E4 1.37E4 1.38E4 1.39E4 1.40E4 1.41E4
0.20 0.00
7000 7025 7050 7075
Time [s]
7100 7125 7150 70 Time [s]
0.18 65
60
0.16 55
0.14 50
0.12 45
0.10 40
0.08 35
30
0.06 25
0.04 20
0.02 15
0.00 10
0.00E0 2.50E3 5.00E3 7.50E3 1.00E4 1.25E4 1.50E4 1.75E4 0.00E0 2.50E3 5.00E3 7.50E3 1.00E4 1.25E4 1.50E4 1.75E4
Time [s] Time [s]
Figure 16: Hierarchical model of a Senseo coffee machine and simulation results.
A model of a Senseo coffee machine is presented. The heated at 90°C and then pressed with a pressure of about
main feature of a Senseo coffee machine is that the coffee 1.4 bar within 40 seconds through the pad. In contrast to a
is placed in the machine in a pre-portioned form by so- normal coffee machine that boils the water continuously
called coffee pads. One pad is generally used to make one and transports it by its own buoyancy (hot bubbles) up
cup of coffee (125°ml) and two pads reach for two cups at into the filter, the Senseo machine heats a portion of water
125 ml or one big cup at 250 ml. After a warm-up time of completely in a heating chamber and pumps it then
about 60 seconds and the insertion of a coffee pad, the through the pad. To ensure that the heating chamber in the
coffee can be made. In this warm-up phase, the water is machine is always filled with water, a float is placed in the
removable water tank which allows measuring the mini- vides a compact and clear view of the processes on
mal capacity. If the minimum level is exceeded, the heater the highest level, and (2) the simulation and anima-
is turned off. If there is sufficient water level, the next tion option which enable analyzing and optimizing
portion of water is heated directly after the scalding and of the processes. A possible question may arise in
filling. These functional principles are represented by the
this juncture is, how much employees are needed to
hierarchically structured model shown in
accomplish the requests and orders of the customers
Figure 16 and also some simulation results. Addi- or simple how the profit can be maximized. All ques-
tionally, a detailed description of the model can be tions of this kind can be answered by simulating the
found in the PNlib. model with different parameter settings.
The applicability of the PNlib for modeling pro-
Consultants
duction processes is shown by a model of a printing 203
2
162
XOR
0.8
response resulting?
XOR
0.5
0.5
order T1
d=40 0.2
also called maculation, could occur due to several d=8 offer at customer
waiting time
over
T1
calling?
XOR
0.2
0.8
d=0
d=0