Skip to content
EC-406 · Simulation Lab/Quick Revision Short Notes

Simulation Lab (EC-406) - Unit 1 Short Notes

EC-406 Simulation Lab - Unit 1: Foundations of Simulation & Basic Modeling


1.0 Introduction to Simulation

1.1 Definition and Purpose of Simulation

  • What is Simulation?

    The process of creating a model (a simplified representation) of a real-world system and conducting experiments on this model to understand system behavior or evaluate strategies.

    • System: A set of interacting entities pursuing a common objective.

    • Model: A mathematical/logical representation of the system.

    • Experiment: Running the model under specified conditions to observe output performance measures.

  • Why Simulate?

    • Advantages over analytical methods: Handles complex, stochastic systems where precise mathematical solutions are intractable.

    • Advantages over physical prototyping: Safer, cheaper, faster to test "what-if" scenarios without disrupting real operations.

  • When is Simulation Appropriate?

    • System is too complex for analytical solutions.

    • Experimentation on the real system is dangerous, costly, or impossible.

    • Need to understand the impact of variability (randomness).

    • Time compression/expansion is needed.

1.2 Key Terminology

Term Definition Example (Bank)
Entity An object that moves through the system. A customer
Attribute A characteristic of an entity. Customer type (VIP, regular)
State A variable describing the system at a moment. Number of customers in queue, server status (busy/idle)
Event An instantaneous occurrence that changes the system state. Customer arrival, service completion
Process A sequence of events/activities for an entity. Arrive → Queue → Get served → Leave
Input Variable A factor that can be controlled or is an external influence. Number of tellers, inter-arrival time
Output Performance Measure A metric used to evaluate system performance. Average waiting time, server utilization

Model Types:

  • Static vs. Dynamic: Static (no time, e.g., Monte Carlo for risk), Dynamic (time-based, e.g., DES, continuous).

  • Deterministic vs. Stochastic: Deterministic (no randomness, fixed inputs), Stochastic (incorporates randomness in inputs).

1.3 The Simulation Study Process

A structured, iterative methodology:

  1. Problem Definition & System Definition: Clearly state objectives and boundaries.

  2. Model Conceptualization & Formulation: Develop a logical model with assumptions.

  3. Data Collection & Input Analysis: Gather data and fit probability distributions.

  4. Model Translation: Code the model in simulation software.

  5. Verification & Validation (V&V):

    • Verification: "Did we build the model right?" (Debugging, code correctness).

    • Validation: "Did we build the right model?" (Accuracy, credibility with stakeholders).

  6. Experimentaion & Output Analysis: Design experiments, run model, analyze results statistically.

  7. Documentation & Implementation: Report findings and recommend decisions.

[!TIP] Exam Focus: Be prepared to define each term and list the 7 steps of the simulation study process in order. V&V is a common exam question—know the difference.


2.0 Types of Simulation & Application Areas

Type Core Concept Time Handling Typical Applications Key Software Examples
Discrete-Event (DES) System state changes at discrete events in time. Between events, state is constant. Event-based, next-event time advance. Manufacturing, logistics, service systems (queues), computer networks, healthcare. Arena, Simio, AnyLogic (DES mode), FlexSim.
Continuous State variables change continuously over time. Fixed-increment time advance. Physical systems governed by differential equations (mechanical, electrical, thermal, chemical). MATLAB/Simulink, Dymola, Modelica.
Hybrid Combines DES and continuous simulation. Mixed. Complex systems with both event-driven and continuous dynamics (e.g., a manufacturing plant with robotic arms (DES) and temperature control (continuous)). AnyLogic, Simulink (with Stateflow).
Monte Carlo Uses repeated random sampling to estimate probabilistic outcomes. Not time-based (static). Risk analysis, financial forecasting, project management (PERT), integration. @RISK, Crystal Ball, Python (NumPy/ SciPy).
Agent-Based (ABM) Models autonomous "agents" and their interactions to emerge system-level behavior. Often event-based or time-stepped. Social systems, market dynamics, crowd simulation, biology. NetLogo, AnyLogic (ABM mode), Repast.

[!TIP] Exam Focus: Know the core difference between DES and Continuous. Be able to classify a given problem statement (e.g., "bank queue" → DES, "temperature in a tank" → Continuous).


3.0 Simulation Software Landscape & Environment Setup

3.1 Overview of Common Simulation Software

  • General-Purpose:

    • MATLAB/Simulink: Dominant for continuous, control systems, and signal processing. Strong mathematical capabilities.

    • Python (with SimPy, Salabim): Open-source, flexible, excellent for custom DES and integration with data science libraries (Pandas, NumPy).

  • Dedicated DES:

    • Arena: Industry-standard, flowchart-based, strong in manufacturing/logistics.

    • Simio: Object-oriented, 3D animation, good for facility design.

    • AnyLogic: Multi-method (DES, ABM, Continuous), very versatile.

    • FlexSim: Strong 3D material handling and warehousing focus.

3.2 Laboratory Environment Setup

  1. Installation & License: Install software, activate license (student/network).

  2. UI Navigation: Learn key panes: library/toolbar, model window, properties window, output/report viewer.

  3. Project Management: Create/save projects, understand file structure (.sim, .model files).

[!TIP] Exam Focus: You may be asked to match a software to its primary domain. Know the basic UI layout of the software used in your lab (likely Arena or Simulink).


4.0 Basic Modeling Concepts in a DES Environment

4.1 The Building Blocks of DES

Module/Concept Purpose Key Parameters
Entity The item flowing through the model. Name, picture, attributes.
Create Generates entities. Inter-arrival time/distribution, first creation time, maximum entities.
Process Defines entity activity (often uses Resource). Seize (request resource), Delay (service time), Release (free resource).
Resource A capacity-limited service provider. Capacity, schedule (shift patterns), cost.
Queue Holds entities waiting for a resource. Discipline (FIFO default), capacity, queueing rule (e.g., Highest Priority First).
Dispose Removes entities from the system. Record entity statistics.
Decide Routes entities based on a condition. Probability (%) or condition (e.g., attribute value).
Assign Sets an entity's attribute value. Attribute name, new value (constant, random, expression).
Record Collects statistics on variables/time. Variable to record, statistic type (time average, tally).

4.2 Input Data & Probability Distributions

  • Identifying Inputs: Arrival rates (inter-arrival times), service times, routing probabilities, resource breakdown times.

  • Fitting Distributions: Use collected data to fit a theoretical distribution (e.g., Exponential for inter-arrivals in Poisson process, Normal for task times, Uniform for uniform variability).

  • Common Distributions in DES:

    • **Exponential(

$$\lambda$$

):**

$$f(t) = \lambda e^{-\lambda t}$$

. Memoryless property. Used for Poisson arrivals/service.

*   **Normal(

$$\mu, \sigma^2$$

):**

$$f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}$$

. Symmetric around mean.

*   **Uniform(a, b):** 

$$f(x) = \frac{1}{b-a}$$

. All values equally likely.

*   **Triangular(a, m, b):** Defined by min, mode, max. Useful when data is limited.
  • Random Number Generators (RNGs): Software uses pseudo-random numbers (e.g., linear congruential generator). Seed value controls reproducibility.

4.3 Running a Simulation Model

  • Replication Length: Total simulated time for one run (e.g., 8 hours, 30 days).

  • Warm-up Period (Transient Period): Initial period where system state is not representative of steady-state (e.g., starting empty). Results from this period are discarded to avoid bias.

  • Number of Replications: Multiple independent runs (with different RNG seeds) to estimate statistical uncertainty. Required for output analysis.

  • Single Run vs. Batch Run: Single run = one replication. Batch run = executes multiple replications automatically.

[!TIP] Common Pitfall: Forgetting to set a warm-up period for steady-state analysis. Always check if your software's default report includes warm-up exclusion.


5.0 Basic Output Analysis & Reporting

5.1 Key Performance Indicators (KPIs) for DES

KPI Category Specific Metrics What it Measures
Resource Utilization (% Busy), Mean/Total Idle Time How heavily a resource is used.
Queue Average Length, Maximum Length, Average Waiting Time Congestion and delay.
Entity/System Throughput (entities/time), Cycle Time (total time in system), Total Time in System System throughput and responsiveness.

5.2 Interpreting Standard Output Reports

  • Reports are typically categorized by Entity, Resource, Queue, and Global statistics.

  • Look for Averages (TimeAverage, Average) and Totals.

  • Example (Arena Report):

    
    Resource: Teller1
    
      Number In: 1000
    
      Number Out: 1000
    
      Utilization: 0.752
    
      Mean Waiting Time: 4.2 min
    
    

5.3 Introduction to Statistical Uncertainty

  • Why Multiple Replications? A single run gives only one possible outcome. System randomness means results vary.

  • Confidence Interval (CI): A range that likely contains the true population mean (long-run average).

    • For mean from n replications:

$$\bar{X} \pm t_{\alpha/2, n-1} \frac{s}{\sqrt{n}}$$

    *   

$$\bar{X}$$

= sample mean of replication means.

    *   

$$s$$

= standard deviation of replication means.

    *   

$$t_{\alpha/2, n-1}$$

= t-value from t-distribution (for 95% CI,

$$\alpha=0.05$$

).

  • Interpretation: "We are 95% confident the true average waiting time is between [lower] and [upper] minutes."

[!TIP] Exam Focus: Be able to calculate a 95% CI from a table of replication outputs. Know that a narrower CI indicates more precision (achieved by more replications or less variability).


6.0 First Laboratory Exercise: A Simple System Model

6.1 Problem Statement: Single-Server Queue (M/M/1)

  • System: Customers arrive, wait in a single line, are served by one server, then leave.

  • Input Data: Inter-arrival times ~ Exponential(mean=5 min), Service times ~ Exponential(mean=3 min).

  • Run Parameters: Warm-up = 100 hours, Replication length = 1000 hours, Number of replications = 10.

6.2 Step-by-Step Model Construction (Generic DES)

  1. Define Entity: Customer.

  2. Create Module: Set Time Between Arrivals = EXPO(5) (mean 5 min).

  3. Process Module (for Service):

    • Seize: Server (capacity 1).

    • Delay: Service Time = EXPO(3) (mean 3 min).

    • Release: Server.

  4. Dispose Module: Exit.

  5. Connect Modules: Create → Process → Dispose.

  6. Set Run Parameters: Warm-up = 100, Replication length = 1000, Replications = 10.

6.3 Execution and Basic Report Analysis

  1. Run Model: Execute batch run.

  2. Extract KPIs from Report:

    • Resource Server: Utilization = % Busy.

    • Queue Customer.Wait: Average Length, Average Waiting Time.

    • Entity Customer: Average Total Time (Cycle Time).

  3. Compare with Analytical M/M/1 Formulas (Steady-State):

    • Utilization (ρ):

$$\rho = \frac{\lambda}{\mu} = \frac{1/5}{1/3} = 0.6$$

*   **Average # in Queue (Lq):** 

$$L_q = \frac{\rho^2}{1-\rho} = \frac{0.6^2}{0.4} = 0.9$$

*   **Average Wait in Queue (Wq):** 

$$W_q = \frac{L_q}{\lambda} = \frac{0.9}{0.2} = 4.5 \text{ min}$$

*   **Average Total Time (W):** 

$$W = W_q + \frac{1}{\mu} = 4.5 + 3 = 7.5 \text{ min}$$

[!TIP] Exam Practical: You will likely build a simple model in the lab exam. Practice the drag-and-drop of Create, Process (with Seize/Delay/Release), and Dispose modules. Know how to set exponential distributions (EXPO(mean)). Always check the report for the warm-up period effect—utilization should be close to the theoretical ρ=0.6.

\boxed{\text{Core Exam Takeaways:} \

  1. \text{ Simulation = Model + Experiment on a system.} \

  2. \text{ DES: State changes at discrete events.} \

  3. \text{ Key DES modules: Create, Process (Seize/Delay/Release), Dispose.} \

  4. \text{ Warm-up period is discarded; multiple replications are needed for CI.} \

  5. \text{ M/M/1 steady-state formulas: } \rho = \lambda/\mu, L_q = \rho^2/(1-\rho), W_q = L_q/\lambda.}

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