Simulation and ModelingUnit 611 min read
Discrete Event Simulation (DES): Concepts, Phases, and Applications
Unit 6 of Simulation and Modeling covers Discrete Event Simulation (DES), including its definition, phases, components, and practical applications like queueing systems, real-world case studies (e.g., eSewa transactions), and tools like GPSS. Learn how DES models events, traces execution, and validates outputs with wor
TAKEAWAYS:
- DES models systems where state changes occur at discrete points in time (e.g., customer arrivals, server completions).
- The three phases of a DES study are problem formulation, model development, and output analysis.
- Poisson arrival patterns and exponential service times are common in DES for modeling randomness (e.g., Pathao ride requests).
- GPSS blocks like
MARKandTABULATEtrack events and collect statistics (e.g., average wait time in a bank queue). - Hybrid simulation combines DES with continuous models (e.g., simulating traffic flow with vehicle speed changes).
- Initial bias elimination ensures simulation results reflect steady-state behavior (e.g., ignoring early data in a Monte Carlo trial).
Core Concepts of Discrete Event Simulation (DES)
What is DES?
Discrete Event Simulation (DES) is a technique to model systems where the state changes only at specific points in time (events). Unlike continuous simulation (e.g., fluid dynamics), DES focuses on discrete events like:
- A customer arriving at a bank (
ARRIVALevent). - A server finishing a task (
DEPARTUREevent). - A machine breaking down (
FAILUREevent).
Key Idea: The system’s state remains constant between events. For example, in a coffee shop, the number of customers in the queue changes only when a new customer arrives or the barista finishes serving someone.
graph TD
A["Initial State: Queue = 0"] -->|"Customer arrives"| B["State: Queue = 1"]
B -->|"Barista starts serving"| C["State: Queue = 0, Server busy"]
C -->|"Service completes"| AFigure 1: State transitions in a coffee shop DES model.Phases of a DES Study
Every DES project follows these three phases, visualized below:
1. Problem Formulation
- Objective: Clearly define what the simulation will achieve. Example:
- Goal: Reduce average wait time in a Daraz delivery queue.
- Scope: Focus on the last-mile delivery hub (not the entire supply chain).
- Boundaries: Decide what to include/exclude. For example:
- Include: Number of delivery personnel, package sizes, traffic delays.
- Exclude: Weather effects (unless data is available).
2. Model Development
Components of a DES Model
| Component | Description | Example (eSewa Transaction) |
|---|---|---|
| Entities | Objects that move through the system (e.g., customers, packages). | A user initiating a bill payment. |
| Attributes | Properties of entities (e.g., arrival time, service time). | Payment amount, user’s device type. |
| Events | Instantaneous occurrences that change the system state. | "Payment request received," "OTP verified." |
| Resources | Limited capacity items (e.g., servers, machines). | eSewa’s payment processing servers. |
| Logic | Rules governing how events interact (e.g., queues, priorities). | FIFO queue for payments. |
Worked Example: Modeling a Bank ATM Queue
Scenario: Customers arrive at an ATM with an average rate of 1 every 2 minutes. The ATM takes 1.5 minutes to process a transaction. Assumptions:
- Arrivals follow a Poisson process (random, independent).
- Service times are exponentially distributed (mean = 1.5 minutes).
Step-by-Step Trace:
- Event 1: Customer A arrives at time
t = 0.- State: Queue = [A], ATM =
IDLE.
- State: Queue = [A], ATM =
- Event 2: ATM starts serving A at
t = 0.- State: Queue = [], ATM =
BUSY(untilt = 1.5).
- State: Queue = [], ATM =
- Event 3: Customer B arrives at
t = 1.2(random Poisson arrival).- State: Queue = [B], ATM =
BUSY.
- State: Queue = [B], ATM =
- Event 4: ATM finishes serving A at
t = 1.5.- State: ATM starts serving B.
- Event 5: Customer C arrives at
t = 2.0.- State: Queue = [C], ATM =
BUSY.
- State: Queue = [C], ATM =
Visualization of Events:
timeline
title ATM Queue Simulation Trace
0: Customer A arrives
0: ATM starts serving A
1.2: Customer B arrives (Queue: [B])
1.5: ATM finishes A, starts B
2.0: Customer C arrives (Queue: [C])
3.0: ATM finishes B, starts CKey DES Concepts and Tools
Poisson Arrivals and Exponential Service Times
- Poisson Process: Models random arrivals where the probability of an arrival in a small time interval is proportional to the interval length.
- Parameter λ (lambda): Average arrivals per unit time (e.g., λ = 1 customer/3 minutes for the coffee shop).
- Probability Mass Function (PMF):
- Exponential Distribution: Models service times where the probability of completion decreases over time.
- PMF:
- Mean service time: .
Real-World Example:
- Pathao Ride Requests: Ride requests arrive as a Poisson process (λ = 20 requests/hour during peak times). Service time (driver assignment) is exponentially distributed (mean = 3 minutes).
GPSS: A Classic DES Language
GPSS (General Purpose Simulation System) uses blocks to define events. Two critical blocks:
MARKBlock:- Marks the start of a transaction (e.g., a customer entering the system).
- Syntax:
MARK <label>. - Example:
MARK ARRIVALwhen a customer arrives at the coffee shop.
TABULATEBlock:- Collects statistics (e.g., wait times, queue lengths).
- Syntax:
TABULATE <variable>, <interval>. - Example:
TABULATE WAIT_TIME, 1records wait times every minute.
GPSS Worked Example: Coffee Shop Simulation
START GENERATE 3, 0.5 // Arrivals every 3 minutes, 50% variation
QUEUE CUSTOMERS // Join the queue
SEIZE BARISTA // Occupy the barista
ADVANCE 2.5, 0.5 // Service time: 2.5 mins, 50% variation
RELEASE BARISTA
MARK 1 // End of transaction
TABULATE WAIT_TIME // Record wait time
TERMINATE 1 // End simulation after 1 "customer"
Output: After running, TABULATE provides the average wait time in the queue.
Hybrid Simulation
Combines discrete events (e.g., customer arrivals) with continuous changes (e.g., temperature in a server room). Example: Simulating a data center:
- Discrete Events: Servers failing, technicians arriving.
- Continuous Process: Temperature rising due to overheating servers.
When to Use Hybrid Simulation:
| Scenario | DES Alone | Hybrid Simulation |
|---|---|---|
| Modeling traffic flow | ✅ Yes | ❌ No |
| Simulating chemical reactions | ❌ No | ✅ Yes |
| Bank teller queues | ✅ Yes | ❌ No |
| Robot arm movement + sensor data | ❌ No | ✅ Yes |
Real-World Tie-In:
- NTC’s Network Traffic Simulation: Uses hybrid models to simulate data packet arrivals (discrete) and signal strength decay (continuous) across Nepal’s telecom towers.
Initial Bias and Steady-State Analysis
Problem: Initial Bias
Early simulation results may not reflect the system’s steady-state behavior because the system starts in an arbitrary state (e.g., empty queue). Example: In a Monte Carlo simulation of a stock market, the first 100 days may show unrealistic volatility.
Solution: Elimination of Initial Bias
- Warm-Up Period: Discard initial results (e.g., first 10% of simulation time).
- Batch Means: Split output into batches and analyze only the last few.
- Regenerative Methods: Reset the simulation at regeneration points (e.g., when the queue empties).
Worked Example: Coffee Shop Warm-Up
- Simulate for 100 minutes (total time).
- Discard first 20 minutes (warm-up).
- Analyze wait times from
t = 20tot = 100.
Exam Tip: How to Score Full Marks
For DES Definition:
- Always mention discrete events, state changes, and time advancement.
- Example answer:
"Discrete Event Simulation models systems where state changes occur instantaneously at specific events (e.g., arrivals, departures). Time advances from one event to the next, ignoring continuous changes between events."
For Phases of Simulation:
- Draw the flowchart (Figure 2) and label all three phases with bullet points.
For GPSS:
- Explain
MARKandTABULATEwith a short code snippet (like above) and a real-world analogy (e.g., eSewa transactions).
- Explain
For Poisson/Exponential:
- Write the PMF equations and relate them to a real scenario (e.g., Pathao ride requests).
For Hybrid Simulation:
- Compare DES vs. hybrid in a table (like above) and give a Nepali example (NTC, NEPSE trading).
For Initial Bias:
- Describe warm-up period with a time trace (like the ATM example) and explain why it’s needed.
In the Real World
eSewa Transactions:
- Idea Used: Queueing Theory + DES.
- How: eSewa’s backend simulates payment requests as discrete events (arrivals) and processes them through servers (resources). The system uses Poisson arrivals to model user logins during peak hours (e.g., 6–9 PM) and exponential service times for OTP verification.
Pathao Driver Assignment:
- Idea Used: Poisson Arrivals + Priority Queues.
- How: Ride requests arrive as a Poisson process. Pathao’s algorithm assigns drivers based on proximity (a discrete event) while continuously tracking driver availability (continuous state). The system eliminates initial bias by ignoring the first 5% of requests in a new city to stabilize the model.
NTC’s 4G Network Planning:
- Idea Used: Hybrid Simulation.
- How: NTC uses DES to model call arrivals at cell towers (discrete events) and continuous simulation to track signal interference between towers. This helps optimize tower placement in Kathmandu’s dense urban areas.
Daraz’s Warehouse Robotics:
- Idea Used: Discrete Event + Monte Carlo.
- How: Daraz simulates order picking in warehouses using DES (robots moving, orders being packed). Monte Carlo methods estimate the probability of delays due to robot malfunctions or traffic jams in the warehouse aisles.
Common Pitfalls and How to Avoid Them
| Mistake | Solution |
|---|---|
| Assuming uniform arrival times | Use Poisson distribution for random arrivals. |
| Ignoring warm-up period | Always discard initial data or use regenerative analysis. |
| Overcomplicating the model | Start simple (e.g., single-server queue) before adding complexity. |
| Misusing GPSS blocks | MARK tracks events; TABULATE collects data—don’t confuse them. |
| Forgetting to validate the model | Compare simulation output with real data (e.g., bank wait times). |
Summary Checklist for Exam Preparation
Before the exam, ensure you can:
- Draw the three phases of DES as a flowchart.
- Write the PMF for Poisson and exponential distributions.
- Explain GPSS blocks (
MARK,TABULATE) with a short code example. - Differentiate DES vs. hybrid simulation with a Nepali example.
- Describe how to eliminate initial bias in a simulation trace.
- Relate DES to real-world systems (eSewa, Pathao, NTC) with specific mechanics.
Based on the TU BSc CSIT syllabus for Simulation and Modeling (CSC317), unit 6.
Discussion
Loading…