Discrete-Event Simulation Overview Basic Discrete-Event System Models 1 Doug Bodner ISyE 3044 – Simulation Analysis and Design Spring 2022 1 Topics • Concepts • Worldviews ▪ Event-scheduling ▪ Process-interaction ▪ Activity scanning • Mechanics Spring 2022 2 DES Concepts • System ▪ Collection of interacting components that operate together to achieve a goal • System model ▪ Abstract representation of a system (mathematical or computational) used for design or analysis • System state ▪ Collection of variables containing all the information needed to describe the system at any time • Entity ▪ An active object or component in the system that requires representation • Resource ▪ A passive object or component in the system that requires representation • Attribute ▪ Property of a given entity or resource Spring 2022 3 DES Concepts • List ▪ • Event ▪ • Duration of time of specified length (end time is a scheduled event) Delay ▪ • List of event notices for future events ordered by scheduled time of occurrence Activity ▪ • Record of an event to occur now or in the future, including data needed for event execution (type and scheduled time) Event list (event calendar) ▪ • Instantaneous occurrence causing system state to change Event notice ▪ • Collection of temporarily or permanently associated entities or resources in some logical order Duration of time of unspecified length Clock ▪ ▪ Spring 2022 Keeps time in simulation Can start with 𝑡 = 0 or some pre-specified time (2/9/2022 11:00am) 4 Call Center Example • A call center has two operators. Able has a faster service time and takes a call if both are idle. Baker takes a call if idle and Able busy. • Single queue with two servers • System state Spring 2022 5 Call Center Example (cont’d) • Events ▪ Customer arrives ▪ Able completes service ▪ Baker completes service • Other events? Spring 2022 6 Call Center Example (cont’d) • Activities • Delays Spring 2022 7 Call Center Example (cont’d) • Entities • Resources • Attributes Spring 2022 8 DES Worldviews • How we conceptualize a dynamic system • Event-scheduling ▪ Focus on events and state changes (explicit event calendar) ▪ Events occur and schedule future events ▪ Move onto next event • Process-interaction ▪ Focus on active entities moving through resource network ▪ Aligned with network of queues ▪ Predominant worldview • Activity scanning ▪ Focus on activities ▪ Scan system at each time-step to see if any activities are enabled and if so start them ▪ Computationally expensive Spring 2022 9 Event-Scheduling 1. Define system state and code different event types ▪ State changes for each event ▪ Events caused by each event 2. 3. 4. Set initial state and schedule first event to initialize simulation Move clock time to next event time on event calendar Execute next event ▪ Remove event from event calendar ▪ Make state changes ▪ Schedule future events (update event calendar) 5. 6. Go to 3 unless 6 is enabled End simulation with ▪ No more events left ▪ Defined end time Spring 2022 10 Event-Scheduling Example • Call center with 2 operators Able and Baker • Initialize with arrival Spring 2022 11 Event-Scheduling Example (cont’d) • Call center with 2 operators Able and Baker • Assume 2nd arrival occurs before end of 1st service Spring 2022 12 Event-Scheduling Example (cont’d) • Call center with 2 operators Able and Baker • Assume Able completes service next Spring 2022 13 Single Queue Example • Events • State variables • Event logic is state dependent Spring 2022 14 Process-Interaction 1. Code the lifecycle of an entity (job or customer) ▪ Set of resources through which it moves 2. 3. 4. 5. 6. Initialize simulation with initial state and first arrival Use inter-arrival times for subsequent arrivals Entities move through “blocks” seizing and releasing resources Entities exit system End simulation with ▪ No more events left ▪ Defined end time • Under the hood, the simulation is executing events and advancing clock time to the next event Spring 2022 15 Process-Interaction Example • Single server queue with two customers contending for server Spring 2022 16 Activity Scanning 1. Define system state and code different activities that can occur ▪ ▪ Primary activities/events Conditional activities/events 2. Handle primary activities/events using event-scheduling 3. At each event, scan all conditional activities/events and start any that are enabled 4. End simulation with ▪ No more activities/events left ▪ Defined end time Spring 2022 17 Dump Truck Example • Look at lists in more detail • Six dump trucks are used to transport coal from a mine to the railroad. • The dump trucks are loaded at one of two stations and then are weighed at one station. • They travel to the railroad and back for additional coal. Spring 2022 18 Dump Truck Example (cont’d) • System state • Entities • Resources Spring 2022 19 Dump Truck Example (cont’d) • Lists • Activities • Events Spring 2022 20 Dump Truck Example (cont’d) • Attributes of entities • Attributes of resources Spring 2022 21 Dump Truck Example (cont’d) • Load times (minutes) ▪ 5 with probability 0.30 ▪ 10 with probability 0.50 ▪ 15 with probability 0.20 • Weight times (minutes) ▪ 12 with probability 0.70 ▪ 16 with probability 0.30 • Travel times (minutes) ▪ ▪ ▪ ▪ Spring 2022 40 with probability 0.40 60 with probability 0.30 80 with probability 0.20 100 with probability 0.10 22 Dump Truck Example (cont’d) • Assume FIFO queues • Initialization of system ▪ 𝑇2 and 𝑇3 are being loaded ▪ 𝑇1 is being weighed ▪ 𝑇4 , 𝑇5 and 𝑇6 are in loader queue • Event calendar ▪ EL at 𝑡 = 5, 𝑇3 ▪ EL at 𝑡 = 10, 𝑇2 ▪ EW at 𝑡 = 12, 𝑇1 Spring 2022 23 Dump Truck Example Execution 0 Spring 2022 𝐿 𝐿𝑞 Time 3 2 𝑊 𝑊𝑞 0 1 LQ 𝑇4 𝑇5 𝑇6 WQ EC BL BW - EL, 5, 𝑇3 EL, 10, 𝑇2 EW, 12, 𝑇1 0 0 24 Dump Truck Example Execution (cont’d) Time Spring 2022 𝐿𝑞 𝐿 𝑊𝑞 𝑊 LQ WQ EC BL BW 25 Dump Truck Example Execution (cont’d) Time Spring 2022 𝐿𝑞 𝐿 𝑊𝑞 𝑊 LQ WQ EC BL BW 26 Dump Truck Example Statistics • Resource utilization • Truck 1 statistics • Note: Simulation must be run for a long time (e.g., one week of simulated time) to get reasonably accurate statistics, and we should do multiple replications Spring 2022 27 Dump Trucks Using Process-Interaction • Dump truck life cycle Spring 2022 28 Dump Trucks Using Activity Scanning Activity Pre-conditions Loading time Truck is at front of loader queue and At least one loader is idle Weighing time Truck is at front of weighing queue and Weigh station is idle Travel time Truck has just completed weighing Spring 2022 29 Different Size Dump Trucks • Trucks 1-3 have twice the capacity as trucks 45 • How does this change the model? Spring 2022 30 Different Queue Discipline for Trucks • The larger trucks have priority in the queue • Ties in size revert to FIFO • How does this change the model? Spring 2022 31 Other Statistics of Interest • Number of trucks spending more than 20 minutes in a queue • Proportion of trucks spending more than 20 minutes in a queue Spring 2022 32 List Processing • Using singly linked lists for event calendar and queues Spring 2022 33 Wrap-Up • Concepts • Worldviews ▪ Event-scheduling ▪ Process-interaction ▪ Activity scanning • Mechanics Spring 2022 34