egms with edge conditions old way

Download Report

Transcript egms with edge conditions old way

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 Behavior
Bipartite 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
Non-Zero (Random) Firing Times:
Random process indices
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).
PN Example: G/G/1 Queue
Number of
Idle Servers
Ta
Number
T
in Queue s
(Random Firing Times)
Petri Nets
Example: Tandem queue with limited input
A
100
Q
t1
t2
Activity Modeling View
Things
needed to
START
Activity
Activity
...
Time = Duration of Activity
What you
get when
FINISH
Activity
Tandem Queue with Buffer – Production Blocking
B
Ts
2
Ts
Q
Q
S
What about Communication Blocking?
S
PN Enrichments for Simulation

Transition Input and Output Counts
T
a
2
T
1
T2
3
PN Enrichments for Simulation
• Inhibitor Arcs (Fail/Repair Model)
Working Machines
tf
Failed Machines
tr
Time Bound Sequence
Tc
Ta between arrivals
1
2
T1
T2
Job must start step 2 within TC of finishing step 1.
Give a Petri Net for this system?
Time Bound Sequence...Error?
Ta
T1
T2
(timer running)
(scrap)
(timer expired)
Tc
Time Bound Sequence...Error?
Ta
T1
T2
(timer running)
(scrap)
(timer expired)
Tc
(kill timer)
Time Bound Sequence...Error?
Q2
Ta
T1
T2
(timer running)
(scrap)
(timer expired)
Tc
What if there are no tokens at Q2 and 1 active transition in Tc?
(“Timer expired” place may grab next part from Q2 early!)
(kill timer)
Time Bound Sequence...
R2
R1
Q1
Ta
Q2
T1
T2
(scrap)
(timer
terminator)
(timer expired)
Tc
(zero-time
transition)
(inhibitor
arc)
(kill timer)
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 Nets
into
Event Graphs
Alternative Implementations
Activity World View
Petri Net Formalism:
Simple fundamental elements and behavior
Concurrent resource usage and contention
Event Scheduling View
Event Graph Formalism:
Simple fundamental element and behavior
Concurrency and contention - large model
representations
PN->EG MAPPING
Transitions become timed edges
Places become conditional edges
PN->EG Mapping: eg. G/G/s queue
S
PN:
Q
A
Ta
T
s
PN->EG Mapping: eg. G/G/s queue
S
PN:
Q
A
T
s
Ta
EG:
Ta
{A--}
Ts
{A++,
Q++}
{Q--,
S--}
{S++}
PN->EG Mapping: eg. G/G/s queue
S
PN:
Q
A
T
s
Ta
EG:
(A)
Ta
{A--}
(S&Q)
(S&Q)
{A++,
Q++}
{Q--,
S--}
Ts
{S++}
PN->EG Mapping: eg. G/G/s queue
Variable A is unnecessary!
(A)
Ta
{A--}
(S&Q)
(S&Q)
{A++,
Q++}
{Q--,
S--}
Ts
{S++}
PN->EG Mapping: eg. G/G/s queue
Empty Vertex is unnecessary!
Ta
(S&Q)
{ Q++}
{Q--,
S--}
(S&Q)
Ts
{S++}
PN->EG Mapping: eg. G/G/s queue
S&Q conditions redundant too...
(S&Q)
Ta
(S&Q)
{ Q++}
{Q--,
S--}
Ts
{S++}
PN->EG Mapping: eg. G/G/s queue
Result: a conventional G/G/s queue EG model
(Q)
Ta
(S)
{ Q++}
Ts
{Q--,
S--}
{S++}
PNEG MAPPING
P = set of Places, T = set of transitions in PN
d(t) = delay time (RV) for transition tT
{Ip(t),Op(t)}= Set of Input and Output Places for tT
{It(p),Ot(p)}= Set of Input and Output Transitions for pP
Step 0.  pP: define an integer state variable, X(p).
Step 1.  tT: create an edge (O(t), D(t)) with delay d(t).
Step 2.  pP with unique (It(p),Ot(p)) pair: create the edge
(D(It(p)),O(Ot(p))) with the condition that all pIp(Ot(p)) are
marked. (For inhibitor arcs these places must not be marked.)
Step 3. Add State changes:
for O(t), decrement X(p)  pIp(t);
for D(t), increment X(p)  pOp(t).
Advanced homework: Confirm this or find a counter example.
Analytical Methods and Conditions
• PNs
Reachabilty, decidability, liveness, and
deadlock
• EGs
State 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
R1
A
Q1
ta
R2
Q2
ts1
0
B
Q1 = number of jobs waiting in queue 1
Q2 = number waiting in queue 2
R1 = idle resources for step 1
R2 = idle resources for step 2
B = available buffer slots
W
ts2
Each transition becomes a timed edge...
R1
A
Q1
R2
Q2
ta
ts1
W
0
ts2
B
ta
ts1
0
ts2
Next, each place becomes a conditional edge...
(ALL input places marked is condition)
R1
A
R2
Q1
Q2
ta
ts1
W
0
ts2
B
(A)
(Q1&R1&B)
ta
(Q2&R2)
(Q1&R1&B)
ts1
(Q2&R2)
0
ts2
(W)
(Q1&R1&B)
Mapping Petri Net to Event Graph
Finally, increment and decrement tokens as state changes
R1
A
Q1
Q2
ta
ta
(A)
ts1
(Q1&R1&B)
(Q1&R1&B)
ta
{A--}
R2
ts1
{A++, {Q1--,
Q1++} R1--.
B--}
W
ts2
0
B
(Q2&R2)
(Q2&R2)
0
{R1++, {R2-Q2++} Q2--}
(Q1&R1&B)
(W)
{W++
B++}
{W--}
ts2
{R2++}
Final Event Graph: How can this be simplified?
(ref: Seila, et. al. Text)
(A)
(Q1&R1&B)
ta
{A--}
(Q2&R2)
(Q1&R1&B)
ts1
{A++, {Q1--,
Q1++} R1--.
B--}
(Q2&R2)
0
{R1++, {R2-Q2++} Q2--}
(Q1&R1&B)
(W)
{W++
B++}
{W--}
ts2
{R2++}
A Simplified Event Relationship Graph
(Q2)
(Q1&B)
ta
{Q1++}
(R1&B)
ts1
{Q1--,
R1--.
B--}
(R2)
{R1++,
Q2++}
(Q1&R1)
ts2
{R2-Q2-B++}
{R2++}
Implications
 PN analysis of Event Graphs
State reachability
Liveness
Deadlock
 EG analysis of Petri Nets
State space
Model reduction
Equivalence
Boundary Conditions
Resource Deadlock
Petri Net Simulator
EG -> PN Mapping
Remove-on-Fire Rule
Remove-on-Enable Rule
Examples of Petri Net Models – Activity Scanning Models
Inhibitor arc
Ref: Peter Haas’ book on Stochastic Petri Nets – resets all timers each scan, prob. deposit
Remove on Fire rule – vs Remove on enable (Ref: Fishwick)
Simulation – Activity Scanning algorithm. (Cancel if transition is disabled!)
Multiple server queues?
Note: is an “event graph” – one out-transition per place
State dep deposit to d11 or d12...
“Modeling Activities with ERGs”
M
tF
“failing” – need “new” machine
get broken machine
B
tR
M,R
“fixing” – need broken machine
and repairman
get good machine
and repairman
R,B
“Implied ERG”
M
tF
B
{M--}
{B++}
(R)~
tR
R,M
~
{R++,
M++}
(B)
B,R
{R--,
B--}
M = “new” machines
B = broken machines waiting
R = idle repairmen
“Implied ERG”
M
tF
B
{M--}
{B++}
(R)~
R,M
tR
B,R
~
{R++,
M++}
(B)
“Reduced ERG – M is not tested”
tR
Exercise: can you further reduce this?
hint: assume more machines
than repairmen. Define new
B
variable(s).
{B++}
B,R
~
{R++}
{R--,
B--}
(R)~
tF
R
M = “new” machines
B = broken machines
R = idle repairmen
(B)
{R--,
B--}
B
{B++}
(R)~
tF
R
B,R
{R--,
B--}
~
{R++}
tR
(B)
R = total number of
repairmen (const.)
B = number of broken
machines (incl in rep.)
tR
(B<=R)
Fail
~
{B++}
(B>=R)
~
Fix
{B--}
tF
Colored Petri Nets (transitions are enabled by color or tokens)
d1,i,j = part i waiting
Or processing on mach j
GSMP->EGM Mapping (Computer Network)
End
Trans
New
Packet
Obs.
End Tran.
Prop.
Clear
Start
Tran
Prop.
Reset
Need Pg 397….
Transition has two times – e3 or e5 with 50/50 probs.
e1 deposits
in d2 or d5
with equal
probabilty
NEED PAGE 137 for this example
Inhibitor arcs are note strictly necessary (but very convenient!)
1
Add d2 had token iff d1 empty
And no tokens if d1 has any.
Need Example 1.4 of Chapter 2
Measuring Delays
Need figure 9.2 of section 2.6 without colors