View
226
Download
0
Tags:
Embed Size (px)
Citation preview
Modeling Worldviews
• Activity Scanning – Petri Nets and Event Graphs
• Event Scheduling – Event Graphs
State Machines
• Process Interaction –Block Flow Diagrams and Event Graphs
Petri Nets: Definition and BehaviorBipartite Directed Graph with Place (balls) and
Transition (bars) Nodes
Marking: Multiple Tokens at Places
(Indicate State of Resident Entities)
Petri Nets: Definition and Behavior
Firing Rule: A transition “fires” when ALL of its input places are marked. A token is removed from each input place and added to each output place.
Petri Nets: Definition and Behavior
How might we keep Net Alive?
PN Enrichments for Simulation
• Non-Zero (Random) Firing Times: Random process indices
• Colored Tokens: Different classes of transient entities - change colors?
• Input and Output Counts: Analytical and aggregation production
• Inhibitor arcs:Prevents firing...resource priorities
When a transition is enabled, a timer starts. After it times out, the transition fires.
Remove on Fire rule = remove and deposit tokens when the transition fires.
Remove on Enable rule = remove tokens when timer starts, deposit tokens when it times out (used here to save space).
Non-Zero (Random) Firing Times: Random process indices
PN Example: G/G/1 Queue
sTaT
(Random Firing Times)
Number in Queue
Number of Idle Servers
Petri Nets Example: Tandem queue with limited input
t21tQA
100
Activity Modeling View
Time = Duration of Activity
. . .
Things needed to STARTActivity
What you get when FINISHActivity
Activity
sT
Q
2sT
S S
Q
B
Tandem Queue with Buffer – Production Blocking
What about Communication Blocking?
Ta
T1 T2
2
3
PN Enrichments for Simulation Transition Input and Output Counts
PN Enrichments for Simulation
• Inhibitor Arcs (Fail/Repair Model)
tfrt
Working Machines
Failed Machines
Time Bound Sequence
1 2
T1 T2
Tc
Job must start step 2 within TC of finishing step 1.
Give a Petri Net for this system?
Ta between arrivals
Time Bound Sequence...Error?
Ta
(timer running)
Tc
(timer expired)
T1 T2
(scrap)
Time Bound Sequence...Error?
Ta
(timer running)
Tc
(timer expired)
T1 T2
(scrap)
(kill timer)
Time Bound Sequence...Error?
Ta
(timer running)
Tc
(timer expired)
T1 T2
(scrap)
(kill timer)
What if there are no tokens at Q2 and 1 active transition in Tc? (“Timer expired” place may grab next part from Q2 early!)
Q2
Time Bound Sequence...
Ta
(timer terminator)
Tc
(timer expired)
T1 T2
(scrap)
(kill timer)
(zero-timetransition)
(inhibitorarc)
Q1 Q2
R2R1
Note: need to set transition priorities to make killing the timer have priority if resource R2 becomes idle simultaneously with the timer expiring.
Petri Nets - Summary
• Modeling: Concurrency and contention (Simultaneous
Resource Usage)
• Analysis: Reachability tree, CTMC Analysis, and
much more!
Mapping Petri Netsinto
Event Graphs
Alternative ImplementationsActivity World View
Petri Net Formalism: Simple fundamental elements and behaviorConcurrent resource usage and contention
Event Scheduling ViewEvent Graph Formalism:
Simple fundamental element and behaviorConcurrency and contention - large model
representations
Transitions become timed edges
Places become conditional edges
PN->EG MAPPING
PN->EG Mapping: eg. G/G/s queue
PN:
Q
sTaT
S
A
PN->EG Mapping: eg. G/G/s queue
PN:
EG:
Q
sTaT
S
A
{A--} {A++, Q++}
{Q--, S--}
{S++}
TsaT
PN->EG Mapping: eg. G/G/s queue
PN:
EG:
Q
sTaT
S
A
(S&Q)(A)
(S&Q)
{A--} {A++, Q++}
{Q--, S--}
{S++}
TsaT
PN->EG Mapping: eg. G/G/s queue
(S&Q)(A)
(S&Q)
{A--} {A++, Q++}
{Q--, S--}
{S++}
TsaT
Variable A is unnecessary!
PN->EG Mapping: eg. G/G/s queue
(S&Q)
(S&Q)
{ Q++} {Q--, S--}
{S++}
TsaT
Empty Vertex is unnecessary!
PN->EG Mapping: eg. G/G/s queue
(S&Q)
(S&Q)
{ Q++} {Q--, S--}
{S++}
TsaT
S&Q conditions redundant too...
PN->EG Mapping: eg. G/G/s queue
(Q)
(S)
{ Q++} {Q--, S--}
{S++}
Ts
aT
Result: a conventional G/G/s queue EG model
P = set of Places, T = set of transitions in PN d(t) = delay time (RV) for transition tT {Ip(t),Op(t)}= Set of Input and Output Places for tT {It(p),Ot(p)}= Set of Input and Output Transitions for pP
Step 0. pP: define an integer state variable, X(p). Step 1. tT: create an edge (O(t), D(t)) with delay d(t). Step 2. pP with unique (It(p),Ot(p)) pair: create the edge
(D(It(p)),O(Ot(p))) with the condition that all pIp(Ot(p)) are marked. (For inhibitor arcs these places must not be marked.)
Step 3. Add State changes: for O(t), decrement X(p) pIp(t); for D(t), increment X(p) pOp(t).
PNEG MAPPING
Advanced homework: Confirm this or find a counter example.
Analytical Methods and Conditions
• PNsReachabilty, decidability, liveness, and
deadlock
• EGsState definition, event reduction, priorities,
equivalence, boundary conditions, resource deadlock, MIP representations
COMMUNICATIONS BLOCKING(R1 needs empty buffer to Start)
R1,R2 = Number of idle resources
Q1,Q2 = Number of waiting jobs
B = Number of empty buffer spaces
......
ta,ts1,ts2 = Arrival and processing times
...
COMMUNICATIONS BLOCKING: Petri Net
A Q1
R1
ta ts1
Q2
R2
Bts20
W
Q1 = number of jobs waiting in queue 1Q2 = number waiting in queue 2R1 = idle resources for step 1R2 = idle resources for step 2B = available buffer slots
Each transition becomes a timed edge...
ta
A Q1
R1
ta ts1
Q2
R2
Bts20
W
ts1 0 ts2
Next, each place becomes a conditional edge...(ALL input places marked is condition)
A Q1
R1
ta ts1
Q2
R2
Bts20
W
(A)
(Q1&R1&B)
ta ts1 0 ts2
~
~
~
~
~~
~
(Q1&R1&B)
(Q1&R1&B)
(Q2&R2)
(Q2&R2)
(W)
ta
Mapping Petri Net to Event GraphFinally, increment and decrement tokens as state changes
{A++,Q1++}
{Q1--,R1--.B--}
{A--} {R1++,Q2++}
{R2--Q2--}
{R2++}
A Q1ta ts1
Q2
Bts20
W
ta ts1 0 ts2
~
~
~
~
~~
~(Q1&R1&B)
(Q1&R1&B)
(Q2&R2)
(Q2&R2)
(W)
R1 R2
{W++B++}
{W--}
(Q1&R1&B)
(A)
{A++,Q1++}
{Q1--,R1--.B--}
{A--} {R1++,Q2++}
{R2--Q2--}
{R2++}
ta ts1 0 ts2
~
~
~
~
~~
~
(Q1&R1&B)
(Q1&R1&B)
(Q2&R2)
(Q2&R2)
(W)
{W++B++}
{W--}
(Q1&R1&B)
(A)
Final Event Graph: How can this be simplified? (ref: Seila, et. al. Text)
{Q1++} {Q1--,R1--.B--}
{R1++,Q2++}
{R2--Q2--B++}
{R2++}
ta ts1ts2~
~
~
~
~
(R1&B)
(Q1&B)
(R2)
(Q2)
(Q1&R1)
A Simplified Event Relationship Graph
ImplicationsPN analysis of Event Graphs
State reachability LivenessDeadlock
EG analysis of Petri NetsState spaceModel reductionEquivalenceBoundary ConditionsResource Deadlock
Petri Net Simulator
EG -> PN Mapping
Remove-on-Fire Rule
Remove-on-Enable Rule
Ref: Peter Haas’ book on Stochastic Petri Nets – resets all timers each scan, prob. depositRemove on Fire rule – vs Remove on enable (Ref: Fishwick)Simulation – Activity Scanning algorithm. (Cancel if transition is disabled!)
Inhibitor arc
Examples of Petri Net Models – Activity Scanning Models
Multiple server queues?
Note: is an “event graph” – one out-transition per placeState dep deposit to d11 or d12...
tFM B “failing” – need “new” machine get broken machine
M,R R,BtR “fixing” – need broken machine
and repairman get good machine and repairman
“Modeling Activities with ERGs”
“Implied ERG”
tFM B
R,M B,RtR
{M--} {B++}M = “new” machinesB = broken machines waitingR = idle repairmen
{R--,B--}
{R++,M++}
~
~
(B)
(R)
“Implied ERG”tF
M B
R,M B,RtR
{M--} {B++}M = “new” machinesB = broken machinesR = idle repairmen
{R--,B--}
{R++,M++}
~
~
(B)
(R)
“Reduced ERG – M is not tested”
tF
B
R B,RtR
{B++}
{R--,B--}
{R++}
~~
(B)
(R)
Exercise: can you further reduce this? hint: assume more machines than repairmen. Define new variable(s).
tF
B
R B,RtR
{B++}
{R--,B--}
{R++}
~
~
(B)
(R)
tF
tR
{B++}
{B--}
~(B<=R)
Fix~(B>=R)
Fail
R = total number of repairmen (const.)B = number of broken machines (incl in rep.)
Colored Petri Nets (transitions are enabled by color or tokens)
d1,i,j = part i waitingOr processing on mach j
GSMP->EGM Mapping (Computer Network)
Prop.
Prop.Reset
NewPacket
Clear
EndTrans
Obs.End Tran.
Start Tran
Need Pg 397….
e1 depositsin d2 or d5with equal probabilty
Transition has two times – e3 or e5 with 50/50 probs.
NEED PAGE 137 for this example
1
Inhibitor arcs are note strictly necessary (but very convenient!)
Add d2 had token iff d1 emptyAnd no tokens if d1 has any.
Measuring DelaysNeed Example 1.4 of Chapter 2
Need figure 9.2 of section 2.6 without colors