PETRINETSPETRINETS DEFINITION : DEFINITION :
PETRINET (place/ transition net): a PETRINET (place/ transition net): a formalformal, , graphicalgraphical, , executableexecutable technique for the technique for the specificationspecification and and analysisanalysis of of concurrentconcurrent, , discrete-discrete-event dynamic systemsevent dynamic systems; a technique undergoing ; a technique undergoing standardization. standardization.
Petri nets derive their name from the Petri nets derive their name from the inventor of this tool: inventor of this tool: Prof. Carl Adam PetriProf. Carl Adam Petri
Formal Formal GraphicalGraphicalExecutableExecutableSpecificationSpecificationAnalysisAnalysisConcurrentConcurrentDiscreetDiscreet
APPLICATIONS OF PETRINETAPPLICATIONS OF PETRINET Software designSoftware design Workflow managementWorkflow management Data AnalysisData Analysis Concurrent ProgrammingConcurrent Programming Readability EngineeringReadability Engineering Diagnosis Diagnosis for finding the original error in the for finding the original error in the
line of error -> error state -> visible errorline of error -> error state -> visible error
A simple PN is a 5-tuple: (P,T,IN,OUT,Mo)A simple PN is a 5-tuple: (P,T,IN,OUT,Mo) P,P, finite number of Places: {p1,p2….,p} finite number of Places: {p1,p2….,p} TT, finite set of transitions: {t1,t2….tm}, finite set of transitions: {t1,t2….tm} Input function: Defines directed arcs from Input function: Defines directed arcs from
places to transitions.places to transitions. Output function: Defines directed arcs from Output function: Defines directed arcs from
transition to placestransition to places Mo : P ->N initial markingMo : P ->N initial marking
Various attributes of PNVarious attributes of PN► ► Safeness: Number of tokens in each place cannot exceed Safeness: Number of tokens in each place cannot exceed
oneone► ► Boundedness: The number of tokens in each place cannot Boundedness: The number of tokens in each place cannot
exceed some threshold exceed some threshold kk► ► Conservation: Total number of tokens in the system is Conservation: Total number of tokens in the system is
invariant.invariant.► ► Dead transition: A transition that can never be fired in Dead transition: A transition that can never be fired in
future.future.► ► Live Transitions: transitions that can be enabledLive Transitions: transitions that can be enabled► ► Deadlock: No transition can fireDeadlock: No transition can fire► ► Live PN: Every transition is liveLive PN: Every transition is live► ► Reachable markings: A marking M obtained by firing a Reachable markings: A marking M obtained by firing a
sequence of transitions from initial marking .sequence of transitions from initial marking .
FIRINGFIRING RULESRULES A transition is enabled if each of its input places contains A transition is enabled if each of its input places contains
a number of tokens that is greater than or equal to the a number of tokens that is greater than or equal to the weight of the arrow connecting the input place to the weight of the arrow connecting the input place to the transitiontransition
An enabled transition may fireAn enabled transition may fire Firing of a transition T removes from each input place Pi Firing of a transition T removes from each input place Pi
the number of token equal to the weight of arrow from Pi the number of token equal to the weight of arrow from Pi to T and then inserts into each output place Pj the to T and then inserts into each output place Pj the number of tokens equal to the weight of arrow from T to number of tokens equal to the weight of arrow from T to PjPj
EG1:WAREHOUSEEG1:WAREHOUSE Requirements Requirements 1>Truck arrives at a loading dock1>Truck arrives at a loading dock
2>Paper is processed and inventory chequed2>Paper is processed and inventory chequed
3>Conveyor belts move from the loading dock to 3>Conveyor belts move from the loading dock to the warehouse transporting peoplethe warehouse transporting people
4>Conveyor belt moves back from the warehouse 4>Conveyor belt moves back from the warehouse to loading dock with merchandiseto loading dock with merchandise
5>Goods are loaded in the truck5>Goods are loaded in the truck
V1 = k1xyV1 = k1xy V2 = k2zV2 = k2z dz /dt = V1 – V2 = k1xy – k2zdz /dt = V1 – V2 = k1xy – k2z dy /dz = 2V2 – V1 = 2k2z – k1xydy /dz = 2V2 – V1 = 2k2z – k1xy dx /dt = -V1 = -k1xydx /dt = -V1 = -k1xy
Non-DeterminismNon-DeterminismAny of the enabled transitions may fire
Model does not specify which fires, nor when it fires
Starvation (i.e., a process never gets a resource)
StarvationStarvation
DeadlockDeadlockPetri net reaches a state inwhich no transition is enabled i.e., a Deadlock State
Why Other Types of Petri-Nets?Why Other Types of Petri-Nets?
Token of PN’s do not carry informationToken of PN’s do not carry information no data concept nor manipulationno data concept nor manipulation
PN’s for simple systems get very complexPN’s for simple systems get very complex loss of usabilityloss of usability
No hierarchical structures with PN’sNo hierarchical structures with PN’s reusable modulesreusable modules
What is a Colored Petri-nets What is a Colored Petri-nets (CPN)?(CPN)?
Combination of Petri-Nets and a Combination of Petri-Nets and a programming languageprogramming language
Control structures, synchronization, Control structures, synchronization, communication and resource sharing communication and resource sharing described by PN’sdescribed by PN’s
Data and data manipulation described by Data and data manipulation described by functional programming language functional programming language
Extensions in CPN’sExtensions in CPN’s
Tokens Tokens (Each (Each placeplace contains a set of markers called contains a set of markers called tokentokenss)) carry data value of different typescarry data value of different types no longer shown as plain blank dotsno longer shown as plain blank dots
Extensions in CPN’sExtensions in CPN’s
Places Places (The (The ellipsesellipses and the circles are called and the circles are called placeplacess)) Color set: specifies the type of tokens the Color set: specifies the type of tokens the
place can holdplace can hold Initial Marking: multi-set of token colorsInitial Marking: multi-set of token colors
Multi-set for identical token colorsMulti-set for identical token colors
Token color describe different objectToken color describe different object
Extensions in CPN’sExtensions in CPN’s
Transitions (Transitions (The The rectanglesrectangles are called are called transitiontransitionss)) Inspect token colorsInspect token colors Guard-function decides if transition is enable Guard-function decides if transition is enable
or notor not
Arcs Arcs (The (The arrowsarrows are called are called arcarcss)) describe how the state describe how the state
of the CP-net changesof the CP-net changes
when the transitions occur.when the transitions occur.
Why Colored Petri-Nets?Why Colored Petri-Nets?
CP-nets have a graphical representationCP-nets have a graphical representation CP-nets are very general and can be used to describe a CP-nets are very general and can be used to describe a
large variety of different systemslarge variety of different systems CP-nets have an explicit description of both states and CP-nets have an explicit description of both states and
actionsactions CP-nets have a semantics which builds upon true CP-nets have a semantics which builds upon true
concurrency, instead of interleavingconcurrency, instead of interleaving CP-nets offer hierarchical descriptionsCP-nets offer hierarchical descriptions CP-nets offer interactive simulations where the results CP-nets offer interactive simulations where the results
are presented directly on the CPN diagramare presented directly on the CPN diagram CP-nets have computer tools supporting their drawing, CP-nets have computer tools supporting their drawing,
simulation and formal analysissimulation and formal analysis
Stochastic Petri NetsStochastic Petri Nets
Introduced by the computer science Introduced by the computer science community in the early 1980s.community in the early 1980s.
SPNs are a probabilistic extension of the SPNs are a probabilistic extension of the original nets introduced by Carl Adam original nets introduced by Carl Adam Petri in his 1962 Ph.D. dissertation.Petri in his 1962 Ph.D. dissertation.
Why SPN?Why SPN?
It has the same modelling power as It has the same modelling power as GSMPs.GSMPs. (Generalized semi-Markov process) (Generalized semi-Markov process)
Graphically oriented (user friendly)Graphically oriented (user friendly) Solid mathematical foundationSolid mathematical foundation Popular and enduringPopular and enduring Useful to describe more or less complex Useful to describe more or less complex
systemssystems
Graphical representation of an SPN Graphical representation of an SPN
PlacesPlaces are drawn as are drawn as circlescircles ImmediateImmediate transitions transitions as as thin barsthin bars Timed Timed transitions as transitions as thick barsthick bars Directed arcsDirected arcs connect connect transitions to output places and normal input transitions to output places and normal input
places to transitions; arcs terminating in open places to transitions; arcs terminating in open dots connect inhibitor input places to transitions.dots connect inhibitor input places to transitions.
TokensTokens are drawn as are drawn as black dotsblack dots
ContinueContinue A transition is A transition is enabledenabled whenever there is at least one whenever there is at least one
token in each of its normal input places and no tokens in token in each of its normal input places and no tokens in any of its inhibitor input places; otherwise, it is any of its inhibitor input places; otherwise, it is disableddisabled
An enabled transition An enabled transition firesfires by removing one token per by removing one token per place from a random subset of its normal input places place from a random subset of its normal input places and depositing one token per place in a random subset and depositing one token per place in a random subset of its output places. of its output places.
AnAn immediateimmediate transition fires transition fires the instant it becomes enabled, the instant it becomes enabled, whereas a whereas a timedtimed transition fires transition fires after a positive after a positive (and usually random)(and usually random) amount of time amount of time
AdvantageAdvantage
Graphical format for system design and Graphical format for system design and specification specification
The possibility and existing rich theory for The possibility and existing rich theory for functional analysis with Petri nets functional analysis with Petri nets
The facility to describe synchronization The facility to describe synchronization The natural way in which time can be The natural way in which time can be
added to determine quantitative properties added to determine quantitative properties of the specified system of the specified system
DisadvantageDisadvantage
The disappointing thing about SPN’s is that the The disappointing thing about SPN’s is that the integration of time changes the behavior of the integration of time changes the behavior of the PN significantly PN significantly
So properties proven for the PN might not hold So properties proven for the PN might not hold for the corresponding time-augmented PN for the corresponding time-augmented PN E.g., a live PN might become deadlocked or a non-live E.g., a live PN might become deadlocked or a non-live
PN might become livePN might become live..
Using SPN’s to specify the sharing of resources Using SPN’s to specify the sharing of resources controlled by specific scheduling strategies is controlled by specific scheduling strategies is very cumbersome very cumbersome
Time Petri nets (TPN’s) Time Petri nets (TPN’s)
First introduced by Merlin and Farber First introduced by Merlin and Farber TPN is a 6-tuple (P, T, I, O, Mo, SI)TPN is a 6-tuple (P, T, I, O, Mo, SI) (P, T, In, Out, Mo) is a Petri net(P, T, In, Out, Mo) is a Petri net SI is mapping called SI is mapping called static intervalstatic interval
SI: T SI: T → Q * (Q U ∞)→ Q * (Q U ∞) Q is the set of rational numbersQ is the set of rational numbers
ContinueContinue
In a TPN, two time values are defined for each transition, In a TPN, two time values are defined for each transition, a and b, a and b,
where a is the minimum time the transition must wait for where a is the minimum time the transition must wait for after it is enabled and before it is fired, after it is enabled and before it is fired,
b is the maximum time the transition can wait for before b is the maximum time the transition can wait for before firing if it is still enabledfiring if it is still enabled
Time a and b, for transition t are relative to the moment Time a and b, for transition t are relative to the moment
at which transition t is enabledat which transition t is enabled Transition t enable at time &, then t, cannot fire before Transition t enable at time &, then t, cannot fire before
time & + a and must fire before or at time & + b, time & + a and must fire before or at time & + b, otherwise disabledotherwise disabled
Time Petri nets: syntaxTime Petri nets: syntax
Places: logical part of the state Tokens: current value of the logical part of the state Transitions: events, actions, … Labels: observable behavior Arcs: Pre and Post (logical) conditions of events occurrence Time (closed) intervals: temporal conditions of events
occurrence
Time Petri nets:Time Petri nets:transitions occurrencetransitions occurrence
Logical part The logical part of a state is a marking, i.e. a number
of tokensper place. A transition is enabled if the tokens required by the
pre conditions are present in the marking.
Timed part There is an implicit clock per enabled transition and
its value defines the timed part of the state. An enabled transition is fireable if its clock value lies
in its interval.
Time Petri nets:Time Petri nets:changes of statechanges of state
Time elapsing The marking is unchanged. Time may elapse (with updates of clocks) if every
clock value does not go beyond the corresponding interval.
Transition firing Tokens required by the pre condition are consumed
and tokens specified by the post condition are produced.
Clocks values of newly enabled transitions are reset.
Why Time Petri Nets?Why Time Petri Nets?
Basic Petri nets lack a temporal description and fail to represent any timing constraints for time-dependent
systems. Time Petri nets (TPN) is a concise model for managing
simultaneously concurrency and time TPNs are most widely used for real-time system
specification and verification
ReferencesReferences http://en.wikipedia.org/wiki/Petri_nethttp://en.wikipedia.org/wiki/Petri_net http://www.cs.arizona.edu/http://www.cs.arizona.edu/ http://www.ento.vt.edu/~sharov/PopEcol/lec1/petrinet.hthttp://www.ento.vt.edu/~sharov/PopEcol/lec1/petrinet.ht
mlml http://ieeexplore.ieee.org/iel5/3477/18734/00865173.pdfhttp://ieeexplore.ieee.org/iel5/3477/18734/00865173.pdf
?arnumber=865173?arnumber=865173 http://www.mfn.unipmn.it/~bobbio/BIBLIO/PAPERS/ANNO90/kluwerhttp://www.mfn.unipmn.it/~bobbio/BIBLIO/PAPERS/ANNO90/kluwer
petrinet.pdfpetrinet.pdf
http://www.informs-sim.org/wsc04papers/013.pdfhttp://www.informs-sim.org/wsc04papers/013.pdf http://http://www.daimi.au.dk/CPnets/introwww.daimi.au.dk/CPnets/intro