Timed Discrete Event Modelling and Simulation
- extend State Automata with “time in state”
- equivalent to Event Graphs “time to transition”
schedule events
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 1/54
Timed Discrete Event Modelling and Simulation extend State Automata - - PowerPoint PPT Presentation
Timed Discrete Event Modelling and Simulation extend State Automata with time in state equivalent to Event Graphs time to transition schedule events Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 1/54
red 50 green 100 yellow 15 δ δ δ to_red to_yellow to_green
schedule in 15 schedule in 50 schedule in 100
yellow red green to_red to_green to_yellow to_red
states events t 50 100 15
state trajectory Finite State Automaton Event (Scheduling) Graph red green yellow to_green to_yellow to_red
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 2/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 3/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 4/54
Physical View Queue Cashier Departure Arrival Departure Queue Abstract View Cashier [ST distribution] [IAT distribution] Arrival Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 5/54
state= queue_length x cashier_state
queue_length T 1 2 10 20 30 40 50 cashier_state Busy Idle T 10 20 30 40 50 T Input Events Arrival 10 20 30 40 50
E1 E2
T Output Events Departure 10 20 30 40 50
E3 E4
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 6/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 7/54
Cust2 Process Cust1 Activity
Cust2 Arrival Cust2 Start Queueing Cust2 End pay cashier Cust2 Leave
t
Cust2 End Queueing Cust2 Start pay cashier
Cust2 Activity Event
Cust1 Arrival Cust1 Start pay cashier Cust1 End pay cashier Cust1 Leave
Cust1 Process Cust2 Activity queue pay cashier pay cashier
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 8/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 9/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 10/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 11/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 12/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 13/54
start initializations (schedule "start" event) time flow mechanism: select next event from event list event routine 1 event routine "end"
performance metrics; cleanup; ...
end event routine k event routine k+1 ... ... Event List: [(ev1,t1),(ev2,t2), ...] state variables; performance variables time
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 14/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 15/54
ARR 10 Current_event State set: queue_size x cashier_status time Event List ( 0 , Idle) ( 0 , Busy) 10 20 ( 1 , Busy) 30 ( 0 , Busy) Initialized to: empty queue idle cashier arrival pre-scheduled at time 10 Process current event: set time to current event time update state: cashier busy schedule next arrival at t+IAT() schedule departure at t+ST() remove current event from list Process current event: set time to current event time update state: cashier remains busy queue length increases schedule next arrival at t+IAT() remove current event from list Process current event: set time to current event time generate departure output update state: cashier remains busy (customer from queue) queue length decreases schedule departure at t+ST() remove current event from list DEP 50 ARR 100 Current_event DEP 30 ARR 100 Current_event ARR 20 DEP 30 Current_event
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 16/54
state= queue_length x cashier_state
queue_length T 1 2 10 20 30 40 50 cashier_state Busy Idle T 10 20 30 40 50 T Input Events Arrival 10 20 30 40 50
E1 E2
T Output Events Departure 10 20 30 40 50
E3 E4
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 17/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 18/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 19/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 20/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 21/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 22/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 23/54
start initializations time flow mechanism: discrete time step activity 1 activity "end" end activity k activity k+1 ... ... state variables; performance variables
condition actions condition actions condition actions condition
activity scan
phase 1 phase 2
performance metrics; cleanup; ...
discrete time variable
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 24/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 25/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 26/54
start initializations time flow mechanism: select earliest time on EL activity C"end" end state variables; performance variables
condition actions
A phase
Event List (EL): [(activityB1,t1),(activityB2,t2), ...] execute all B activities
B phase
activity B"end" ...
actions
performance metrics; cleanup; ...
time activity C1 activity Ck activity C(k+1) ... ...
condition actions condition actions condition actions
activity scan
C phase
activity B1 activity Bk activity B(k+1) ... ...
actions actions actions
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 27/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 28/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 29/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 30/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 31/54
Transaction Creation Transaction Destruction
IAT=0 CEL FEL
ADVANCE move time = clock time TERMINATE Y N Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 32/54
Initializations
performance metrics; cleanup; ...
FEL: [xact1,x1ct2, ...] CEL xact1’ xact2’ xact3’ . . .
increasing move-time increasing priority
start end Clock Update Phase Scan Phase
more xacts to move ? terminate simulation ?
current time = move time of first xact on Future Events List (FEL) transfer all xacts with move-time = current time to the Current Events List;
move next object on CEL through as far as possible through its process description Process Interaction model (e.g., GPSS block diagram)
GENERATE 10, 5 QUEUE wait SEIZE cashier DEPART wait ADVANCE 5, 3 RELEASE cashier TERMINATE 1
5,3 Q
Y N Y N
10,5
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 33/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 34/54
10,5 5,3
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 35/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 36/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 37/54
‘‘Discrete’’ Formalisms Discrete Event Formalisms Statecharts DEVS Event Scheduling Activity Scanning Process Interaction Discrete Time Formalisms Finite State Automata Difference Equations Three Phase Approach
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 38/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 39/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 40/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 41/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 42/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 43/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 44/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 45/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 46/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 47/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 48/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 49/54
idle busy t_b t_e t_start t_end t_b t_e 1 2 i N time
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 50/54
t_i t_i+1 t_start t_end t_b t_e time 2 4 6 n MAX i n_i
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 51/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 52/54
underflow zone
zone N intervals L L+∆ L+2∆ L+(N-1)∆ ∆
Lower Limit Upper Limit
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 53/54
Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 54/54