Skip to content
EX-606 · Simulation Lab/Quick Revision Short Notes

Simulation Lab (EX-606) - Unit 1 Short Notes

1.0 Introduction to Simulation

1.1 Definition and Purpose of Simulation

  • What is a system? A collection of interacting entities working together to achieve a goal.

    • Discrete System: State variables change at distinct, separate points in time (e.g., number of customers in a queue).

    • Continuous System: State variables change continuously over time (e.g., water level in a tank).

    • Deterministic Model: No randomness; inputs lead to predictable outputs.

    • Stochastic Model: Contains random variables; outputs are probabilistic.

  • What is Simulation? The process of creating a model (an abstract representation) of a real system and conducting experiments on this model to understand system behavior or evaluate strategies.

  • When to Use Simulation:

    • Advantages: Safe, cost-effective for experimenting with "what-if" scenarios; can model complex, stochastic systems where analytical solutions are impossible.

    • Limitations: Model development can be time-consuming and expensive; results are estimates, not exact solutions; requires expertise in modeling and statistics.

1.2 Types of Simulation Models

  • Discrete-Event Simulation (DES): System state changes only at discrete events (arrivals, departures). Core focus for this lab. Models queues, resource contention, and process flows.

  • Continuous Simulation: Models systems where state variables change continuously, using differential equations (e.g., fluid dynamics).

  • Monte Carlo Simulation: Uses repeated random sampling to estimate numerical results, often for risk analysis or integrating complex functions. No explicit notion of time.

  • Hybrid Simulation: Combines two or more paradigms.

    • Agent-Based Simulation (ABS): Models autonomous agents and their interactions (often DES-like).

    • System Dynamics (SD): Uses stocks, flows, and feedback loops for high-level, continuous behavior over time.

1.3 Core Components of a Discrete-Event Model

  • Entities: Active objects that move through the system (e.g., customers, parts, packets). Have Attributes (characteristics like priority, type).

  • Resources: Passive entities that provide service (e.g., teller, machine, server). Have a Capacity.

  • Queues: Holding areas where entities wait for a resource. Can be FIFO, LIFO, or priority-based.

  • Events: Instantaneous occurrences that cause a state change (e.g., "Arrival," "Service End"). Scheduled on the Future Event List (FEL).

  • Global Variables: System-wide state variables (e.g., total number served, total waiting time).

  • Processes/Activities: The logic that defines an entity's path through the system (e.g., Seize Resource -> Delay (Service) -> Release Resource).

[!TIP]

Key Distinction: Entities are what move (customers), Resources are what they use (servers). An entity seizes a resource, delays (uses it), then releases it.


2.0 The Simulation Study Process

2.1 Problem Formulation & Project Planning

  • Define clear, measurable objectives (e.g., "Reduce average customer waiting time by 15%").

  • Establish scope (what's in/out of the model) and performance metrics (KPIs like utilization, cycle time).

  • Identify stakeholders and deliverables (model, report, presentation).

2.2 Conceptual Model Development

  • Define system boundaries and assumptions (e.g., "arrivals are Poisson," "breakdowns are negligible").

  • Create Process Flow Diagrams (PFDs) and logic flowcharts to visualize entity movement and decision logic.

  • Identify data requirements for inputs (arrival rates, service times) and outputs.

2.3 Data Collection & Analysis

  • Input Data Types: Inter-arrival times, service times, resource capacities, routing probabilities, breakdown times.

  • Probability Distributions: Choose between empirical (use raw data) or theoretical (fit a known distribution like Exponential, Normal).

  • Goodness-of-Fit Tests: Statistically test if a theoretical distribution fits the data.

    • Chi-Square Test: For grouped/binned data.

    • Kolmogorov-Smirnov (K-S) Test: For continuous distributions, compares empirical CDF to theoretical CDF.

2.4 Model Translation & Implementation

  • Translate conceptual model into simulation software syntax (e.g., Arena blocks, Simio processes, SimPy Python code).

  • Best Practices: Build modularly (reusable components), parameterize (use variables instead of hard-coded numbers) for easy experimentation.

2.5 Verification & Validation (V&V)

[!TIP]

Mnemonic: Verification = "Did we build the model right?" (Code is correct). Validation = "Did we build the right model?" (Model is accurate).

  • Verification Techniques:

    • Debugging/Trace Debugging: Step through model logic entity-by-entity.

    • Modular Testing: Test sub-models in isolation.

    • "Degenerate" Tests: Run with extreme inputs to check for logical errors.

  • Validation Techniques:

    • Face Validity: Have domain experts review model logic and outputs.

    • Historical Data Validation: Compare model output to real system historical data.

    • Sensitivity Analysis: Check if outputs respond plausibly to input changes.

2.6 Experimentation & Output Analysis

  • Design Experiments: Plan what-if scenarios (e.g., "What if we add a second server?"). Consider optimization if seeking best configuration.

  • Warm-up Period (Transient Removal): Initial period where system is filling up; results are not representative of steady-state. Must be discarded.

    • Methods: Welch's method (plotting moving averages), visual inspection of time-series, auto-correlation analysis.
  • Terminating vs. Non-Terminating Simulations:

    • Terminating: Has a natural ending point (e.g., "simulate one 8-hour shift"). Analysis uses multiple independent replications.

    • Non-Terminating (Steady-State): Runs indefinitely; seeks long-run average performance. Requires a single long run after warm-up, using batch means for analysis.

2.7 Documentation & Reporting

  • Technical Documentation: Detailed model description, assumptions, input data sources, verification/validation results, for future model users.

  • Management Report: Concise summary of problem, methodology, key findings, and actionable recommendations.


3.0 Statistical Foundations for Simulation

3.1 Review of Probability & Statistics

  • Random Variable (RV): Value determined by chance.

    • Discrete RVs: Poisson ($$\displaystyle P(X=k) = \frac{\lambda^k e^{-\lambda}}{k!} $$), Binomial.

    • Continuous RVs: Exponential ($$\displaystyle f(x) = \lambda e^{-\lambda x} $$), Normal, Uniform, Triangular, Empirical.

  • Key Properties:

    • Mean ($\mu$): Expected value.

    • Variance ($$\displaystyle \sigma^2 $$): $$\displaystyle \text{Var}(X) = E[(X - \mu)^2] $$.

    • Standard Deviation ($\sigma$): $\sqrt{\text{Var}(X)}$.

    • Correlation: Measure of linear relationship between two RVs.

3.2 Random Number Generation (RNG)

  • Need: Simulation requires streams of independent, uniformly distributed random numbers $U(0,1)$ to drive stochastic processes.

  • Properties of Good RNGs:

    • Uniformity: Numbers evenly distributed over (0,1).

    • Independence: No discernible pattern between successive numbers.

    • Long Period: Sequence doesn't repeat quickly.

    • Reproducibility: Same seed produces same sequence (for debugging).

  • Common Algorithm: Linear Congruential Generator (LCG)

$$X_{n+1} = (aX_n + c) \mod m$$

Where $$\displaystyle X_n $$ is the current integer seed, $a$ is multiplier, $c$ is increment, $m$ is modulus. Output $$\displaystyle U_n = X_n / m $$.
  • Testing RNGs: Chi-square test for uniformity, runs test for independence, autocorrelation test.

3.3 Random Variate Generation

  • Inverse Transform Technique:

    1. Generate $U \sim \text{Uniform}(0,1)$.

    2. Set $$\displaystyle X = F^{-1}(U) $$, where $F$ is the CDF of the desired distribution.

    • Example (Exponential): $$\displaystyle F(x) = 1 - e^{-\lambda x} \Rightarrow X = -\frac{1}{\lambda} \ln(1-U) $$. Since $1-U \sim U$, often $$\displaystyle X = -\frac{1}{\lambda} \ln(U) $$.

    \boxed{X = F^{-1}(U)}

  • Acceptance-Rejection Technique: Used when inverse CDF is difficult. Generate candidate from a "proposal" distribution and accept/reject based on a probability.

  • Convolution Method: Sum of independent RVs (e.g., sum of two Uniform(0,1) RVs yields Triangular distribution).

  • Built-in Functions: All major simulation software (Arena, Simio, SimPy) have built-in functions to generate variates directly (e.g., EXPO(mean), NORMAL(mean, std)).


4.0 Input Analysis & Data Modeling

4.1 Identifying Input Processes

  • Key stochastic inputs: inter-arrival times, service times, time-between-failures, repair times, routing probabilities.

4.2 Fitting Distributions to Data

  • Steps:

    1. Choose Distribution Family: Based on data shape (e.g., skewed right -> Exponential, Gamma, Weibull; symmetric -> Normal, Uniform).

    2. Estimate Parameters: Use method of moments, maximum likelihood estimation (MLE), or software.

    3. Goodness-of-Fit Testing: Apply Chi-square or K-S test. Do not rely solely on p-value; also examine histograms/Q-Q plots.

    4. Select Best Fit: Choose the simplest distribution that adequately fits and makes logical sense for the process.

  • Software Tools: Arena's Input Analyzer, Minitab, R (fitdistrplus), Python (scipy.stats).

4.3 Using Empirical Distributions

  • When to Use: When no theoretical distribution fits well, or data is highly irregular.

  • Implementation: Store observed data values. For each required random variate, randomly select a value from the dataset (with or without replacement).

  • Advantage: Preserves exact data characteristics. Disadvantage: May not extrapolate beyond observed data range.


5.0 Output Analysis & Performance Metrics

5.1 Types of Output Data

  • Time-Persistent Variables: Value depends on time (e.g., number in queue $Q(t)$). Average over time: $$\displaystyle \frac{1}{T} \int_0^T Q(t) dt $$.

  • Tally Variables (Event-Responsive): Updated at events (e.g., waiting time of each customer). Average is simple mean of observations.

  • Replication vs. Single Long Run:

    • Terminating: Use multiple independent replications (different RNG streams). Each replication gives one observation of the performance measure.

    • Non-Terminating: Use one long run after warm-up, then use batch means to create "pseudo-replications."

5.2 Analyzing Non-Terminating (Steady-State) Simulations

  • Initial Transient: Early period where system is not in steady-state. Must be removed via warm-up period.

  • Warm-up Period Determination:

    • Welch's Method: Plot moving average of output (e.g., average queue length) over simulation time. Choose point after which plot stabilizes.

    • Visual Inspection: Look for trend in time-series plot of output.

  • Batch Means Method for Confidence Intervals:

    1. After warm-up, run simulation for a long time $T$.

    2. Divide the output into $k$ batches (non-overlapping time intervals).

    3. Compute batch mean $$\displaystyle \bar{Y}_i $$ for each batch.

    4. Overall mean $$\displaystyle \bar{Y} = \frac{1}{k} \sum_{i=1}^k \bar{Y}_i $$.

    5. Sample variance of batch means: $$\displaystyle S_b^2 = \frac{1}{k-1} \sum_{i=1}^k (\bar{Y}_i - \bar{Y})^2 $$.

    6. 95% Confidence Interval:

    \boxed{\bar{Y} \pm t_{0.025, k-1} \frac{S_b}{\sqrt{k}}}

    Where $t$ is the t-distribution critical value.

5.3 Analyzing Terminating Simulations

  • Perform $n$ independent replications (each with its own RNG stream, starting from initial conditions).

  • For a performance measure $Y$ (e.g., total waiting time per replication):

    • Replication means: $$\displaystyle \bar{Y}_1, \bar{Y}_2, ..., \bar{Y}_n $$.

    • Overall mean: $$\displaystyle \bar{Y} = \frac{1}{n} \sum_{i=1}^n \bar{Y}_i $$.

    • Sample standard deviation: $$\displaystyle S = \sqrt{\frac{1}{n-1} \sum_{i=1}^n (\bar{Y}_i - \bar{Y})^2} $$.

    • 95% Confidence Interval:

    \boxed{\bar{Y} \pm t_{0.025, n-1} \frac{S}{\sqrt{n}}}

5.4 Common Performance Measures

  • Utilization ($\rho$): Fraction of time a resource is busy. $$\displaystyle \rho = \frac{\text{Busy Time}}{\text{Total Time}} $$.

  • Throughput ($TH$): Average number of entities completing processing per unit time.

  • Cycle Time ($CT$): Total time an entity spends in the system (waiting + processing).

  • Waiting Time ($$\displaystyle W_q $$): Time spent waiting in queue before service.

  • Queue Length ($$\displaystyle L_q $$): Average number of entities waiting.

  • Little's Law: $$\displaystyle L = \lambda W $$ (for stable system). Where $L$ = avg. number in system, $\lambda$ = throughput, $W$ = avg. cycle time.

  • Comparing Configurations: Use two-sample t-test (assuming independent replications) to see if difference in means is statistically significant.

[!TIP]

Critical Rule: For non-terminating models, always perform a warm-up period analysis. Ignoring the transient leads to biased (usually pessimistic) estimates of steady-state performance.


6.0 Simulation Software Overview & Model Building Principles

6.1 General-Purpose Simulation Software

  • Common Architectures:

    • Process-Oriented: Most common (Arena, Simul8, Simio). User defines entity processes (flowcharts) using modules.

    • Event-Oriented: User defines events and their scheduling (e.g., in GPSS).

    • Object-Oriented: Entities are objects with methods and attributes (e.g., AnyLogic, Simio).

  • Key Modules (Process-Oriented):

    • Create: Generates entities (arrivals) according to a schedule or inter-arrival distribution.

    • Process/Seize-Delay-Release: Models resource usage. Seize a resource, Delay (service time), Release resource.

    • Assign: Sets entity attributes or global variables.

    • Decide: Conditional or probabilistic routing.

    • Batch/ Separate: Group or split entities.

    • Record/Dispose: Collect statistics or remove entities from system.

6.2 Building a Basic Model: Step-by-Step Walkthrough

  1. Define Entity Types & Attributes: (e.g., Customer with Priority attribute).

  2. Set up Resource Pools: (e.g., Tellers with capacity=2).

  3. Model Arrivals: Use Create module with inter-arrival distribution (e.g., EXPO(5) for avg. 5 mins).

  4. Model Processing Logic:

    • Seize Tellers (1 at a time).

    • Delay with service time distribution (e.g., TRIA(2,4,6)).

    • Release Tellers.

    • Use Decide for routing, Batch for grouping.

  5. Collect Statistics:

    • Tally Variables: For averages (e.g., Tally for waiting time).

    • Time-Persistent Variables: For time-averaged values (e.g., Time-Persistent for number in queue).

6.3 Model Debugging & Testing Strategies

  • Trace Mode: Step through simulation clock, watch entity movement and variable changes.

  • Animation: Visualize entity flow; often reveals logic errors quickly.

  • Check Entity Conservation: # Created = # Disposed + # Currently in System.

  • Check Resource Utilization: Should be between 0 and 1.

  • Run Simplified Test Cases: Use deterministic inputs (e.g., all inter-arrivals = 5, all services = 3) with small numbers to manually calculate expected outputs and verify.


7.0 Applications & Case Studies (Introduction)

7.1 Manufacturing & Production Systems

  • Assembly Lines: Balancing workstations, finding bottlenecks.

  • Job Shops: Scheduling jobs on machines with varying setups.

  • Key Metrics: Throughput, cycle time, machine utilization, WIP (Work-in-Process) inventory.

7.2 Service Systems

  • Call Centers: Staffing optimization, queue management (IVR routing).

  • Hospital Emergency Departments: Patient flow, resource (room/doctor) allocation, waiting time reduction.

  • Bank Tellers/Airport Security: Determining optimal number of servers.

  • Key Metrics: Customer waiting time, server utilization, abandonment rate.

7.3 Logistics & Supply Chain

  • Warehousing: Order picking, dock scheduling.

  • Distribution Networks: Inventory policies, transportation routing.

  • Port Operations: Berth allocation, crane scheduling.

  • Key Metrics: Order cycle time, on-time delivery, inventory holding cost.

7.4 Computer Systems & Networks

  • CPU Scheduling: Process wait times under different algorithms (FCFS, Round Robin).

  • Network Traffic: Packet delay, router buffer overflow.

  • Database Contention: Lock wait times, transaction throughput.

  • Key Metrics: Response time, throughput, resource contention probability.

Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in