0% found this document useful (0 votes)
9 views13 pages

Simulation Modelling Assignment Solutions

The document discusses the concepts of modeling and simulation (M&S), defining modeling as the creation of abstract representations of real-world systems and simulation as the execution of these models to study system behavior. It highlights the importance of M&S in reducing costs and risks, improving understanding of complex systems, and aiding decision-making, with practical examples in fields like aviation and traffic management. Additionally, it covers discrete-event simulation and continuous simulation techniques, their applications in various domains, and the mathematical foundations underlying these methods.

Uploaded by

goldconsult52
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views13 pages

Simulation Modelling Assignment Solutions

The document discusses the concepts of modeling and simulation (M&S), defining modeling as the creation of abstract representations of real-world systems and simulation as the execution of these models to study system behavior. It highlights the importance of M&S in reducing costs and risks, improving understanding of complex systems, and aiding decision-making, with practical examples in fields like aviation and traffic management. Additionally, it covers discrete-event simulation and continuous simulation techniques, their applications in various domains, and the mathematical foundations underlying these methods.

Uploaded by

goldconsult52
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODELLING AND SIMULATION

Assignment Solutions

Question 1: What is Simulation and Modelling?


Modelling:
Modelling is the process of creating a simplified, abstract representation of a real-world system or
phenomenon. A model captures the essential characteristics, behaviours, and relationships of the
system so that it can be studied, analysed, or understood without directly interacting with the real
system. Models can be mathematical (equations), physical (scale replicas), or conceptual (flowcharts and
diagrams).

Simulation:
Simulation is the process of executing or running a model over time to imitate the behaviour and
operation of a real-world system. It involves using the model to generate data and observe how the
system responds to various inputs or conditions. Simulation allows us to experiment with the model
dynamically, study system performance, predict outcomes, and make informed decisions — all without
the risk or cost of experimenting on the actual system.

Combined Definition:
Together, Modelling and Simulation (M&S) is a discipline that involves constructing a model of a real
system (modelling) and then conducting experiments on that model to understand or predict system
behaviour (simulation). It is widely used in engineering, science, business, and computer science to
design, analyse, and optimise complex systems.

Question 2: Importance and Practical Examples of Modelling and Simulation


Three (3) Importances:
• Cost and Risk Reduction: Simulation allows engineers and scientists to test systems in a virtual
environment before physical implementation, reducing the cost of prototyping and eliminating
the risk of catastrophic failures. For instance, aircraft designs can be tested in simulation before
actual construction.
• Better Understanding of Complex Systems: M&S helps analysts understand intricate systems
that are too complex, too large, or too dangerous to study directly. It allows step-by-step
examination of system dynamics and behaviour under different conditions.
• Decision Support and Optimisation: Organisations use simulation to evaluate different scenarios
and strategies before committing resources. Decision-makers can compare outcomes and
choose the most optimal strategy, saving time and resources.

Two (2) Practical Examples:


• Flight Simulation: Airlines and aviation authorities use flight simulators — which are models of
actual aircraft and atmospheric conditions — to train pilots. The simulator models the aircraft's
physical behaviour, cockpit controls, and various weather scenarios, allowing pilots to practise
safely without any real-world risk.
• Traffic Flow Simulation: City planners use M&S to simulate traffic flow at intersections and along
highways. By modelling road networks, vehicle arrival rates, and traffic light timings, planners
can identify bottlenecks and optimise traffic signal schedules to improve throughput and reduce
congestion.

Question 3: Three Areas of Applications of Modelling and Simulation in


Computer Science
1. Computer Networks and Communication Systems
Simulation is used to model network traffic, packet transmission, routing protocols, and bandwidth
allocation in computer networks. Network designers use tools like NS-3 or OPNET to simulate how data
flows across a network, test new protocols, and evaluate performance under different load conditions
— all before actual hardware deployment.

2. Operating Systems and Resource Management


M&S is applied to model CPU scheduling algorithms, memory management, and I/O operations within
operating systems. Researchers simulate scheduling policies (e.g., Round Robin, FCFS, Priority
Scheduling) on simulated workloads to determine which algorithm provides the best throughput,
response time, and resource utilisation under various conditions.

3. Artificial Intelligence and Machine Learning


In AI, simulation environments (e.g., OpenAI Gym, Unity ML-Agents) are used to train intelligent agents
using reinforcement learning. The agent interacts with a simulated world — such as a virtual robot
navigating a maze — to learn optimal behaviours before deployment in the real world. This is critical in
robotics, autonomous vehicles, and game AI development.

Question 4: Concepts in Model Design


a. Problem Formulation
Problem formulation is the first and most critical step in model design. It involves clearly identifying and
defining the real-world problem that the model is intended to solve. This includes determining the
objectives of the study, the scope and boundaries of the system, the key variables and parameters
involved, and the performance measures that will be used to evaluate the model's outcomes. A poorly
formulated problem leads to an irrelevant model, so precision and clarity are essential at this stage.

b. Model Conceptualization
Model conceptualization is the process of translating the formulated problem into a conceptual
(abstract) framework or structure. At this stage, the modeller identifies the system's components, their
relationships, and interactions. It involves deciding what elements to include in the model and how they
interact — creating flowcharts, block diagrams, or entity-relationship diagrams to visualise the system
structure. This step bridges the problem definition and the actual model construction.

c. Data Collection
Data collection involves gathering all the necessary quantitative and qualitative information required to
build and validate the model. This includes collecting real-world observations, historical records,
statistical measurements, and experimental results. Accurate data is essential because the reliability and
validity of the simulation depend heavily on the quality of the input data. Data collection may also
involve identifying appropriate probability distributions to represent stochastic (random) elements in
the system.

d. Abstraction
Abstraction is the process of focusing on the essential features of a system while ignoring irrelevant
details. In model design, abstraction means representing the real system at the right level of detail —
capturing only those properties that are necessary to answer the study's questions. For example, when
modelling vehicle traffic, individual passenger characteristics are abstracted away; only vehicle speed
and arrival rates are relevant. Proper abstraction ensures the model is manageable and computationally
feasible.

e. Simplification
Simplification involves making assumptions that reduce the complexity of the model while still
preserving its ability to accurately represent the system's essential behaviour. Unlike abstraction (which
removes entire categories of detail), simplification modifies or approximates relationships and
behaviours. For example, assuming a normally distributed arrival rate instead of modelling every
individual variation. Simplification must be carefully balanced — too much simplification can lead to
inaccurate results, while too little makes the model overly complex and hard to analyse.

Question 5: Discrete-Event Simulation (DES)


Discrete-Event Simulation (DES) is a method of simulation in which the state of the system changes only
at discrete points in time — specifically, at the occurrence of events. Between events, the system state
remains constant. DES is concerned with modelling systems as a series of events, where each event
occurs at a particular time and may cause a change in the system state, triggering further events.

Key Characteristics of DES:


• The system state changes only when an event occurs (e.g., a customer arriving or a server
completing service).
• Time advances in jumps — from one event to the next.
• Events are stored in an event list, ordered by their scheduled time.

Typical Example — Bank Queue Simulation:


Consider a bank with a single teller and a queue of customers. The DES model would track the following
events:
• Arrival Event: A customer arrives at the bank. The system records the time of arrival. If the teller
is free, service begins immediately; otherwise, the customer joins the queue.
• Service Completion Event: The teller finishes serving a customer and either begins serving the
next customer in the queue or becomes idle if the queue is empty.
Between these two types of events, nothing changes in the system. Time advances directly from one
event to the next (event-driven clock). This models the bank accurately and efficiently without
simulating every second of the clock.

Question 6: Definition of Event and State


Event:
An event is an instantaneous occurrence that changes the state of the system at a specific point in
simulation time. Events are the driving force of discrete-event simulation. Examples of events include a
customer arriving at a service point, a machine breaking down, or a message being received by a server.
Each event is logged in an event list with its scheduled occurrence time.

State:
The state of a system is the collection of variables (state variables) that contain all the information
necessary to describe the system's condition at any given point in time. The state captures everything
relevant about the system at a particular moment. For example, in a queuing system, the state might
include the number of customers in the queue and whether the server is busy or idle. The state changes
only when an event occurs.

Question 7: Two Concepts Associated with DES


1. Event Scheduling / Next-Event Time Advance
This concept involves maintaining a future event list (FEL) — a chronologically ordered list of all future
events along with their scheduled occurrence times. The simulation clock does not advance
continuously but jumps forward to the time of the next scheduled event. When an event is processed,
the system state is updated, and new future events may be generated and added to the FEL. This
mechanism ensures computational efficiency, as simulation time is spent only at meaningful moments
(events), not during idle periods.

2. Activity Scanning / Process Interaction


This concept focuses on modelling entities (such as customers, jobs, or packets) as they move through a
system and interact with resources. Each entity follows a process — a sequence of activities and events.
When entities compete for the same resource (e.g., two customers competing for one server), the
simulation must resolve this conflict. In activity scanning, the simulation checks at each time step
whether conditions are satisfied to start new activities. In process interaction, each entity's lifecycle is
defined as a co-routine that suspends when waiting for resources and resumes when they become
available.

Question 8: Three Importances of DES


• Efficiency in Modelling Time-Varying Systems: DES is highly efficient for systems where events
are sparse in time. By advancing the simulation clock directly from event to event (rather than
incrementing it step-by-step), DES avoids wasting computational resources on time periods
where nothing happens. This makes it ideal for systems with infrequent but significant events.
• Flexibility in Modelling Complex Systems: DES can model a wide variety of real-world systems —
from manufacturing lines and computer networks to healthcare systems and supply chains. It
can accommodate variable inter-arrival times, different service distributions, multiple queues,
priorities, and resource constraints, making it an extremely flexible and powerful tool.
• Enables What-If Analysis and System Optimisation: DES allows analysts to test different system
configurations and policies without disrupting real operations. Decision-makers can experiment
with different server numbers, arrival rates, or scheduling policies to determine the optimal
configuration — helping reduce costs, improve throughput, and enhance service quality.

Question 9: Continuous Simulation Technique


Continuous simulation is a technique used to model systems in which the state variables change
continuously over time. Unlike discrete-event simulation (where state changes happen only at specific
event points), continuous simulation models systems governed by differential equations, where
variables evolve smoothly and uninterruptedly as time progresses.

Key Features of Continuous Simulation:


• System state is described by continuous variables that change smoothly over time.
• The model is typically expressed using ordinary differential equations (ODEs) or partial
differential equations (PDEs).
• Numerical integration methods (e.g., Euler's method, Runge-Kutta) are used to solve these
equations step-by-step over time.
• A small time step (Δt) is used to approximate the continuous change at each interval.

Example 1 — Population Growth (Logistic Model):


The growth of a biological population can be modelled continuously. The rate of change of population
P(t) is governed by:
dP/dt = rP(1 - P/K)
where r is the growth rate and K is the carrying capacity. As time progresses, the population P changes
continuously — not in discrete jumps. A continuous simulation integrates this equation numerically over
time to track population growth.

Example 2 — Pendulum Motion:


The angular displacement θ(t) of a swinging pendulum satisfies the second-order ODE:
d²θ/dt² + (g/L)sin(θ) = 0
where g is gravitational acceleration and L is the pendulum length. Continuous simulation numerically
integrates this equation to track the pendulum's position and velocity as they change smoothly over
time.

Example 3 — Chemical Reaction Kinetics:


In a chemical reaction A → B, the concentration [A] decreases over time according to:
d[A]/dt = -k[A]
Continuous simulation tracks how the concentration of reactant A changes continuously as the reaction
proceeds, which is critical in chemical engineering and pharmacokinetics.

Question 10: Mathematical Foundation of Continuous Simulation


The mathematical foundation of continuous simulation is rooted in differential calculus and numerical
methods. The core idea is that a system's behaviour can be expressed as a set of differential equations
that describe how state variables change over time.

1. Ordinary Differential Equations (ODEs):


A continuous simulation is primarily based on ODEs of the form:
dx/dt = f(x, t)
where x is the state vector, t is time, and f is a function defining the rate of change. The solution x(t)
describes how the system evolves over time.
2. Numerical Integration Methods:
Since most ODEs cannot be solved analytically, numerical methods are used to approximate the solution
by computing discrete steps:
• Euler's Method (first-order): x(t + Δt) ≈ x(t) + Δt · f(x(t), t). Simple but less accurate for large Δt.
• Runge-Kutta Methods (e.g., RK4): Higher-order approximations that use intermediate slope
estimates to achieve greater accuracy while maintaining manageable computational cost. RK4 is
the most widely used method in continuous simulation.
• Adams-Bashforth / Adams-Moulton: Multi-step methods that use information from previous
time steps.

3. State Variables and Initial Conditions:


The simulation begins with a defined initial condition x(t₀) = x₀. The numerical method then iteratively
computes x at each time step t₀, t₁, t₂, ..., building a trajectory of the system's evolution over time.

4. Stiffness and Stability:


In many real systems, ODEs exhibit stiffness — where some components change much faster than
others. Stiff equations require specialised solvers (e.g., implicit methods like Backward Euler or
trapezoidal methods) to maintain numerical stability without using excessively small time steps.

5. System Dynamics and Feedback Loops:


Continuous simulation also incorporates system dynamics concepts such as stocks (accumulators), flows
(rates of change), and feedback loops. These are represented in tools like MATLAB/Simulink and Vensim,
where the differential equations capture positive (reinforcing) and negative (balancing) feedback
mechanisms.

Question 11: Four Areas of Applications of Continuous Simulation


1. Engineering and Physical Systems
Continuous simulation is fundamental in mechanical, electrical, and civil engineering. Examples include
modelling the dynamics of a spring-mass-damper system (vibration analysis), simulating electrical
circuits (RC/LC networks), and analysing the structural response of bridges under load. In aeronautics,
flight dynamics and control systems are modelled continuously using ODEs representing lift, drag, and
thrust forces.

2. Environmental and Ecological Modelling


Continuous simulation is used to model ecosystems, climate systems, and environmental processes.
Examples include the Lotka-Volterra predator-prey model (which uses coupled ODEs to track the
continuous interaction between predator and prey populations), climate change models tracking
greenhouse gas concentrations over decades, and hydrological models simulating river flow and
groundwater levels continuously over time.

3. Biomedical and Pharmacokinetics


In medicine and pharmacology, continuous simulation models how drugs are absorbed, distributed,
metabolised, and excreted (ADME) in the human body. Compartmental pharmacokinetic models use
ODEs to track drug concentration in blood plasma over time. Similarly, physiological models simulate
cardiovascular dynamics (blood pressure, heart rate) and neural firing patterns continuously over time.

4. Economics and Financial Modelling


Continuous simulation is applied in macroeconomics to model GDP growth, inflation dynamics, and
capital accumulation using differential equations (e.g., the Solow growth model). In financial
mathematics, the Black-Scholes model uses a stochastic differential equation to continuously simulate
stock price movements over time, which is the foundation of options pricing theory.

Question 12: Importance of Continuous Simulation


• Accurate Representation of Physical Phenomena: Many real-world systems — such as electrical
circuits, fluid dynamics, and chemical reactions — are inherently continuous in nature.
Continuous simulation accurately captures the smooth, uninterrupted evolution of these
systems in a way that discrete-event simulation cannot, leading to more realistic and precise
predictions.
• Enables Analysis of Dynamic Systems with Feedback: Continuous simulation can model complex
feedback mechanisms and system dynamics. By capturing how variables influence each other
continuously over time, it allows engineers and scientists to study stability, resonance, control
responses, and long-term trends — all of which are critical in control engineering and ecological
modelling.
• Supports Engineering Design and Optimisation: In engineering design, continuous simulation
allows designers to test system responses under varying parameters before physical prototypes
are built. For example, simulating a control system's response to disturbances helps engineers
tune PID controllers without costly trial-and-error in the real world.
• Facilitates Prediction and Scenario Analysis: By numerically integrating the governing equations
over time, continuous simulation produces time-series data that can be used for forecasting and
planning. Scientists can project how a population will grow, how a drug concentration will
change, or how a climate variable will evolve under different scenarios.

Question 13: Queuing Theory Problem — Telephone Booth


Given Information:
• Average time between arrivals = 8 minutes → Arrival rate: λ = 1/8 arrivals/min = 0.125/min
• Mean service time = 4 minutes → Service rate: μ = 1/4 = 0.25 customers/min
• This is an M/M/1 queuing system (Poisson arrivals, Exponential service, 1 server)

Traffic Intensity (Server Utilisation):


ρ = λ/μ = (1/8) / (1/4) = (1/8) × (4/1) = 4/8 = 0.5

(a) Expected Fraction of the Day the Phone Will Be in Use


The expected fraction of time the server (phone) is busy equals the traffic intensity ρ:
ρ = λ/μ = 0.5
The phone is expected to be in use 50% of the day (i.e., 12 hours out of every 24-hour day).

(b) Expected Number of Units in the Queue (Lq) and Expected Waiting Time in the Queue
(Wq)
Formula for expected number in queue (M/M/1):
Lq = ρ² / (1 - ρ)
Lq = (0.5)² / (1 - 0.5) = 0.25 / 0.5 = 0.5 customers

Expected waiting time in queue (Little's Law: Wq = Lq / λ):


Wq = Lq / λ = 0.5 / (1/8) = 0.5 × 8 = 4 minutes

(c) Expected Number of Units in the System (L)


Formula: L = λ / (μ - λ)
L = (1/8) / (1/4 - 1/8) = (1/8) / (1/8) = 1 customer
Alternatively: L = Lq + ρ = 0.5 + 0.5 = 1 customer ✓

(d) Expected Waiting Time in the System (W)


Formula: W = 1 / (μ - λ)
W = 1 / (1/4 - 1/8) = 1 / (1/8) = 8 minutes
Alternatively (Little's Law): W = L / λ = 1 / (1/8) = 8 minutes ✓
Or: W = Wq + 1/μ = 4 + 4 = 8 minutes ✓

(e) Expected Number of Units in Queue from Time to Time


This refers to the expected number in queue given that the queue is non-empty (conditional queue
length). The probability distribution of the number in queue (n ≥ 1) follows:
P(n in queue) = ρⁿ(1 - ρ), for n ≥ 0
The expected number in queue Lq = 0.5 (calculated above). However, given that a queue exists (i.e., at
least one customer is waiting, n ≥ 1), the conditional expected queue length is:
E[Nq | Nq > 0] = 1 / (1 - ρ) = 1 / (1 - 0.5) = 2 customers

(f) Probability That an Arrival Will Have to Wait in Queue for Service
An arrival must wait if the server is busy (i.e., at least 1 unit is already in the system). This probability
equals the server utilisation:
P(wait) = ρ = λ/μ = 0.5
There is a 50% probability that an arriving customer will have to wait.

(g) Probability That Exactly 3 Units Are in the System


For M/M/1, the probability of exactly n units in the system:
P(n) = (1 - ρ) × ρⁿ
For n = 3:
P(3) = (1 - 0.5) × (0.5)³ = 0.5 × 0.125 = 0.0625
There is a 6.25% probability that exactly 3 units are in the system at any point in time.

(h) Probability That an Arrival Will NOT Have to Wait in Queue


An arrival does not wait if the server is idle (no units in the system, n = 0):
P(no wait) = P(0) = 1 - ρ = 1 - 0.5 = 0.5
There is a 50% probability that an arriving customer will find the server idle and receive immediate
service.

Summary of Results:
Measure Value
Traffic Intensity (ρ) 0.5 (50%)
Fraction of Day in Use 50% (12 hours/day)
Expected Queue Length (Lq) 0.5 customers
Expected Wait in Queue (Wq) 4 minutes
Expected Number in System (L) 1 customer
Expected Time in System (W) 8 minutes
Conditional Queue Length 2 customers (given queue > 0)
P(arrival must wait) 0.5 (50%)
P(exactly 3 in system) 0.0625 (6.25%)
P(arrival will NOT wait) 0.5 (50%)

Question 14: Two Major Reasons Why Queuing Models Are Important
• Optimising System Performance and Resource Allocation: Queuing models provide
mathematical frameworks to analyse and optimise the performance of service systems. By
calculating metrics such as average queue length, waiting times, and server utilisation,
managers can determine the optimal number of servers, service rates, and scheduling policies to
minimise customer waiting times and maximise resource efficiency. This is critical in designing
hospitals, banks, call centres, computer systems, and manufacturing lines.
• Cost-Benefit Analysis and Decision Making: Queuing models help organisations balance the
trade-off between service cost (e.g., hiring more servers, adding machines) and customer
dissatisfaction cost (e.g., long waits leading to lost business). By quantifying performance
metrics, decision-makers can determine the point at which adding resources yields diminishing
returns — enabling cost-effective operational decisions without the need for expensive physical
experiments.

Question 15: Block Diagram of Basic Components of a Queuing Model


The following block diagram illustrates the fundamental structure of a queuing system:

→ QUEUE → SERVICE FACILITY → OUTPUT


INPUT SOURCE
(Waiting Line) (Server / Channel) (Departures)
(Calling Population)
[][][][] [ Server 1 ]

Above the diagram flows: Arriving Customers → Queue (Waiting Line) → Service Facility → Departing
Customers. The queue discipline (FCFS, LCFS, Priority) governs how customers move from the queue to
the service facility.

Question 16: Explanation of the Queuing Model Components


1. Input Source (Calling Population)
The input source is the population from which customers (or entities) arrive to demand service. It is
characterised by its size (finite or infinite), the arrival pattern (arrival rate distribution — typically
Poisson), and the behaviour of arrivals (whether they balk, renege, or jockey). In most theoretical
models, the calling population is assumed to be infinite (i.e., the number of potential arrivals is so large
that it does not significantly affect the arrival rate).
2. Queue (Waiting Line)
The queue is where arriving customers wait when the service facility is busy. It is characterised by its
maximum capacity (finite or infinite), the queue discipline (the rule governing the order in which waiting
customers are served), and the customer behaviour (patience level). Common queue disciplines include:
First Come First Served (FCFS), Last Come First Served (LCFS), Service in Random Order (SIRO), and
Priority-based scheduling.

3. Service Facility (Server)


The service facility consists of one or more servers (channels) that provide service to customers. It is
characterised by the number of servers (single or multi-channel), the arrangement (series or parallel),
and the service time distribution (typically exponential in M/M/1 models). The service rate μ is the
average number of customers served per unit time. The server can be in two states: busy (serving) or
idle (waiting for customers).

4. Output (Departures)
After service is completed, customers leave the system. The output captures departing entities. In some
systems, served customers may re-enter the queue (feedback queues), but in most basic models,
departures permanently exit. The output characterises the system's throughput — how many customers
are served per unit time.

Question 17: Four Differences Between Finite Queue and Infinite Queue
# Finite Queue Infinite Queue
1 Capacity Limitation: Has a fixed maximum Capacity Limitation: Has no upper bound on
number of customers (or jobs) that can wait the number of customers that can wait. Any
in the queue at any given time. Once the number of arrivals can join the queue
capacity is reached, new arrivals are turned regardless of how many are already waiting.
away (blocked or lost).
2 Customer Behaviour (Balking): When the Customer Behaviour (Balking): Customers can
queue is full, arriving customers cannot join always join the queue regardless of its current
and are turned away. This leads to lost length, assuming no capacity constraint.
customers and can affect the system's However, they may still renege (leave after
throughput and revenue. waiting too long) based on patience.
3 Mathematical Model: Analysed using the Mathematical Model: Analysed using the
M/M/1/K model (where K is the finite standard M/M/1 (or M/M/c) model with no
capacity). The steady-state probabilities capacity restriction. All arrivals enter the
account for the blocked states. Effective system, and steady-state analysis requires the
arrival rate λ_eff < λ because some arrivals stability condition ρ = λ/μ < 1.
are rejected.
4 Real-World Example: A hospital waiting room Real-World Example: A theoretical telephone
with a fixed number of seats — if all seats are helpline or email inbox where all incoming
taken, new patients may be turned away or requests are stored and processed in order,
redirected to another facility. A computer regardless of volume. Internet routers with
buffer with a fixed memory size is another unlimited buffers are sometimes
example. approximated as infinite queues.

— End of Assignment Solutions —

You might also like