timed discrete event modelling and simulation
play

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


  1. � � ✁ 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

  2. (timed) Discrete Event Models state trajectory states green red yellow 50 100 15 t events to_red to_green to_yellow to_red Finite State Automaton Event (Scheduling) Graph δ schedule schedule in 15 in 50 green to_green to_red to_green to_yellow 100 green red red 50 to_yellow δ to_red yellow δ schedule 15 in 100 yellow Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 2/54

  3. � � � � Discrete Event Modelling and Simulation Model : objects and relationships among objects Object : characterized by attributes to which values can be assigned Attributes: – indicative – relational Values: of a type Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 3/54

  4. � � � � � � Time and State Relationships Indexing Attribute: enables state transitions Time is most common. Instant: value of System Time at which the value of at least one attribute of an object can be assigned. Interval: duration between two successive instants. Span: contiguous succession of one or more intervals. State of an object: enumeration of all attribute values at a particular instant. State of the system: all object states at a particular instant. Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 4/54

  5. Single Server Queueing System Departure Arrival Cashier Queue Physical View Departure Arrival Cashier Queue [IAT distribution] [ST distribution] Abstract View Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 5/54

  6. Queueing System State Trajectory Input Events Arrival 10 20 30 40 50 T E1 E2 queue_length 2 1 0 10 20 30 40 50 T state= queue_length x cashier_state cashier_state Busy Idle 10 20 30 40 50 T Output Events Departure 10 20 30 40 50 T E3 E4 Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 6/54

  7. � � � � Time and State Relationships Activity: state of an object over an interval Event: change in object state, occurring at an instant. Initiates an activity – Determined: occurrence based on time (“time event”) – Contingent: based on system conditions (“state event”) Object activity: state of object between two events for that object Process: succession of states of object over a span Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 7/54

  8. Event/Object Activity/Process Cust2 Process Cust2 Activity Cust2 Activity queue pay cashier Cust1 Process Cust1 Activity pay cashier Cust1 Arrival Cust1 End pay cashier t Cust1 Start pay cashier Cust1 Leave Cust2 Arrival Cust2 End Queueing Cust2 End pay cashier Cust2 Start Queueing Cust2 Start pay cashier Cust2 Leave Event Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 8/54

  9. � � � � ✂ � ✄ � ☎ Event Scheduling Identify objects and their attributes Identify system attributes (global) Define what causes changes in attribute value as event Write event routine for each event: – modify state (attributes) – schedule event(s) at t ∆ t ∆ t 0 Priorities for tie-breaking Event scheduling logic Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 9/54

  10. Cashier-queue Event Scheduling Model Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 10/54

  11. declare variables: t : Time queue_length : PosInt cashier_state : {Idle, Busy} declare events: start, arrival, departure, end define events: start event: /* scheduled first automatically by simulator */ /* initializations */ queue_length = 0 cashier_state = Idle /* schedule end of simulation */ schedule end absolute end_time Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 11/54

  12. /* schedule first arrival */ schedule arrival relative 0 arrival event: schedule arrival relative Random(IATmean, IATspread) if (queue_length == 0) if (cashier_state == Idle) cashier_state = Busy schedule departure relative Random(SERVmean, SERVspread) else queue_length++ else /* queue_length != 0 */ queue_length++ departure event: if (queue_length == 0) cashier_state = Idle else /* queue_length != 0 */ queue_length-- schedule departure relative Random(SERVmean, SERVspread) Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 12/54

  13. end event: /* terminates simulation */ /* process/output performance metrics */ print time, queue_length /* current */ print average_queue_length Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 13/54

  14. Event Scheduling Kernel start time initializations (schedule "start" event) state variables; performance variables time flow mechanism: Event List: select next event [(ev1,t1),(ev2,t2), ...] from event list event event event event ... ... routine routine routine routine 1 k k+1 "end" output performance metrics; cleanup; ... end Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 14/54

  15. � � Input Generation A “model” of input (sequence of Inter Arrival Times): Trace driven Auto generating (bootstrapping) Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 15/54

  16. Cashier-queue Event List time Event List State set: queue_size x cashier_status Initialized to: empty queue idle cashier arrival pre-scheduled at time 10 ARR 10 0 ( 0 , Idle) Current_event 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 ARR DEP 20 30 10 ( 0 , Busy) Current_event 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 DEP ARR 30 100 20 ( 1 , Busy) Current_event 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 ARR 50 100 30 ( 0 , Busy) Current_event Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 16/54

  17. Queueing System State Trajectory Input Events Arrival 10 20 30 40 50 T E1 E2 queue_length 2 1 0 10 20 30 40 50 T state= queue_length x cashier_state cashier_state Busy Idle 10 20 30 40 50 T Output Events Departure 10 20 30 40 50 T E3 E4 Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 17/54

  18. ✆ � � ✆ � Termination Conditions Empty Event List Need to stop generating arrivals after t end when auto-generating arrivals Schedule Termination Event – process statistics – cleanup – stop – caveat : process all final events ! use reserved priority re-schedule Similarly: schedule initialization/setup Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 18/54

  19. � � Event Scheduling (dis)advantages advantage: run-time efficient disadvantage: hard to understand model Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 19/54

  20. � � � Activity Scanning (rule-based) Activity: condition: must be satisfied for activity to take place. Becomes true only at event times. actions: operations performed when condition becomes true Time-advance mechanism: fixed time-step Also known as Two Phase Approach Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 20/54

  21. Cashier-queue Activity Scanning Model Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 21/54

  22. declare (and initialize) variables: t : Time queue_length : PosInt = 0 cashier_state : {Idle, Busy} = Idle t_arrival : Time = 0 t_depart : Time = plusInf declare activities: queue_pay, depart, end queue_pay activity condition: t >= t_arrival actions: if (queue_length == 0) if (cashier_state == Idle) keep queue_length == 0 cashier_state = Busy t_depart = t + Random(SERVmean, SERVspread) /* service time */ else queue_length++ Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 22/54

  23. else /* queue_length != 0 */ queue_length++, keep cashier_state == Busy t_arrival = t + Random(IATmean, IATspread) /* inter arrival time */ depart activity condition: t >= t_departure actions: if (queue_length == 0) cashier_state = Idle else /* queue_length != 0 */ queue_length--, keep cashier_state == Busy t_depart = t + Random(SERVmean, SERVspread) /* service time */ end activity condition: t >= t_end actions: print t, queue_length /* current */ print avg_queue_length /* performance metric */ Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: Discrete Event WorldViews 23/54

Recommend


More recommend