Prof. Dr. Mesut Güneş Ch. 1 Introduction To Simulation

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 82

Chapter 1

Introduction to Simulation

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.1


Contents
• Introduction
• Simulation examples
• What is a simulation and how it is done?
• What is a system?
• What is a model?
• What is a performance metric?
• Other simulation paradigms
• Steps in a simulation study

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.2


Introduction to Simulation

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.3


Introduction to Simulation

• Given a system, how do you evaluate its performance


(measure its effectiveness)?
System
How to evaluate?

Measurements Analysis Simulation

Develop a Develop a computer


mathematical program which
Use existing instance
abstraction of the implements a model of
of the system to
system and derive the system. Perform
perform performance
formulas which experiments by
measurements.
describe the system running the computer
performance. program.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.4


Cont.
1. Measurements: By collecting data from the system in real-world scenarios, you can
analyze various metrics such as response time, throughput, resource utilization, and
error rates. This method provides empirical data on the system's actual performance
and can help identify bottlenecks or areas of improvement.

2. Analysis: By modeling the system and analyzing its behavior using mathematical
techniques, you can gain insights into its performance characteristics without the need
for real-world measurements. This method is particularly useful when it is difficult or
costly to perform measurements directly on the system.

3. Simulation: By running experiments using the simulated model, you can observe and
analyze the system's behavior under various conditions. Simulations allow you to
manipulate different parameters and variables to understand how they impact
performance. This method is useful when it is impractical or impossible to measure the
system directly, or when you want to predict the system's behavior in hypothetical
scenarios.
Introduction to Simulation
• Given a system, how do you evaluate its performance?

System
How to evaluate?

Measurements Analysis Simulation

What to do • Good solutions, but • How to assure that


• if system does not only feasible for model-
exist in reality? simple systems. implementation-
• if changes are very analysis do not show
expensive or time • Real world systems randomness
consuming? are too complex, • Garbage-In
• if system is not e.g., factory, Garbage-Out (GIGO)
available? computer, network,
etc.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.6


Cont.
* Regarding the concern of randomness, the Garbage-In/Garbage-Out (GIGO) principle applies. It
emphasizes that the accuracy and reliability of the outputs depend on the quality and validity of the
inputs. To ensure that your model, implementation, and analysis do not show randomness, it is
crucial to:

- Use accurate and representative input data: Ensure that the input data used in simulations or
mathematical models accurately represents the real-world scenarios and workload patterns.
Garbage in (incorrect or biased input data) can lead to unreliable or misleading results.

- Validate and verify the model and implementation: Thoroughly review and validate the model or
implementation against known benchmarks or real-world data. This process helps ensure that the
model accurately represents the system's behavior and that the implementation faithfully reflects
the intended design.

- Perform sensitivity analysis: Vary input parameters and observe how they affect the system's
performance. Sensitivity analysis helps identify the impact of different factors and provides insights
into the system's robustness and stability.

By following these practices and applying extremely accurate validation and verification techniques,
you can minimize randomness and improve the reliability of your evaluations and performance
assessments.
Introduction to Simulation
• There are many open questions
• What is a system?

• What is a model?

• What is performance and how to measure it?

• On what does performance depend?

• How to build a model?

• How to numerically evaluate it?

• How to interpret such results?

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.8


Simulation examples

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.9


Simulation examples

Entertainment Games Serious Games

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.10


Cont.
Simulation is widely used in both entertainment games and serious games to create virtual environments
and provide interactive experiences for players. Here are examples of how simulation is utilized in these
game types:

1.Entertainment Games (Ex: Flight Simulators): Simulation is extensively used in flight simulators to
recreate the experience of piloting an aircraft. These games simulate various aspects of aviation,
including aircraft controls, weather conditions, navigation systems, and airport procedures. The goal is to
provide a realistic flying experience to players.

2.Serious Games: are designed with a purpose beyond entertainment, such as education, training, or
simulation of real-world scenarios. Simulation plays a vital role in serious games by recreating specific
environments, scenarios, or processes for educational or training purposes.

Ex: Disaster Management Simulations: Serious games focused on disaster management employ
simulation to recreate emergency situations such as natural disasters, fires, or terrorist attacks. Users can
learn and practice crisis response, decision-making under pressure, and coordination among different
agencies or stakeholders. These simulations help improve preparedness and response capabilities in real-
world scenarios.

Whether it's for entertainment or training purposes, simulation enhances the realism and engagement of
the game, allowing players to explore and learn in virtual environments.
Simulation examples (simulate the loading process in a storehouse with
multiple loading berths to optimize cost-effective loading and minimize waiting time for
trucks.)
• A storehouse with n loading berths
• Several 100 trucks daily to serve
• Loading time of a truck is 50 minutes Storehouse
• Goal: Cost-effective loading and short
waiting time 1 n

• Usually 2 customer types


• Type 1: Full load with only one product
• Type 2: Load consisting of several
products
• Proposals
• Fast loading berth for Type 1
customers
• Special berth for Type 2
customers
• Problem
• Cannot experiment, changes are Park Slots
expensive!
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.12
Cont.
Here's a simplified example:
1.Define Parameters:
• n: Number of loading berths in the storehouse (e.g., 5)
• total_trucks: Total number of trucks to serve in a day (e.g., 100)
• loading_time_per_truck: Time required to load a single truck (e.g., 50 minutes)
2.Initialize Variables:
• waiting_trucks: Number of trucks waiting in the queue (initially set to 0)
• completed_trucks: Number of trucks that have finished loading (initially set to 0)
• total_waiting_time: Total waiting time for all trucks (initially set to 0)
• average_waiting_time: Average waiting time per truck (initially set to 0)
3.Simulation Loop:
• Repeat the following steps for each truck:
• Check if there are available loading berths.

• If yes, decrement the number of available berths (n) by 1.


• Start loading the truck and increase the completed_trucks count by 1.
• Calculate the waiting time for the truck based on the number of trucks waiting before it
(waiting_trucks) and the loading time per truck.
• Add the waiting time to the total_waiting_time.

• If there are no available berths, increment the waiting_trucks count by 1.


Cont.
3. Calculate Results:
• Calculate the average waiting time by dividing the total_waiting_time by
the completed_trucks count.
• Calculate the cost of loading, which can be based on factors such as labor
costs, equipment usage, or energy consumption.
4. Output the Results:
• Display the average waiting time per truck.
• Display the cost of loading.

By running this simulation, you can analyze the impact of different parameters
such as the number of loading berths (n) or the total number of trucks
(total_trucks) on the average waiting time and the cost of loading. It allows you
to optimize the storehouse's loading process to reduce waiting time and
maximize cost-effectiveness.
Simulation examples (In the context of computer networks, simulations
can be used to analyze and understand the performance of servers and networks)

• Computer network
• Clients request some service from a server over a network.
• Client = user and web browser
• Service = web page
• Server = web server
Client 1
• Network = {local network, Network
(Internet)
Internet, wireless network}
• Analysis Server
• Performance of the server
Client k
• Performance of the
network
• Attention
• In this example the
server as well as
the network is
depicted very
simple!
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.15
cont.
*Simulations are computer-based models that imitate real-world systems and enable us to observe
and analyze their behavior under different conditions.
Here are a couple of simulation examples related to server and network performance:

1.Server Performance Simulation:

- In order to evaluate the performance of a web server, a simulation can be created to mimic the
server's behavior under varying loads.
-The simulation can generate multiple client requests and measure the server's response time,
throughput, and resource utilization.
-By adjusting parameters such as the number of clients, the type of requests, and the server's
processing capacity, one can analyze how different factors affect the server's performance.
-This can help identify potential bottlenecks, optimize resource allocation, and improve overall
server efficiency.
Cont.
2. Network Performance Simulation:

-To assess the performance of a computer network, simulations can be used to model the network
infrastructure, including routers, switches, and communication channels.
- Various network traffic patterns and conditions can be simulated, such as different levels of
network congestion, bandwidth limitations, or packet loss.
-By simulating these scenarios, one can evaluate network performance metrics like latency,
throughput, and packet delivery rates.
-This information can be used to optimize network configurations, identify potential issues, or
plan for network upgrades.

*Simulation examples like these enable network administrators and system engineers to gain
insights into the performance of servers and networks without the need for expensive and time-
consuming real-world experiments. They provide a controlled environment for testing different
scenarios and can help in making informed decisions to improve the overall performance and
reliability of the network infrastructure.
Simulation examples (Large computer networks like the Internet are
complex systems with multiple interconnected components. )

*Simulations can be used to study and analyze various aspects of these networks, such as Topology
1.Topology Simulation:
Simulating the topology of a large computer network involves modeling the physical or logical
layout of the network. This can include nodes (routers, switches, servers, etc.) and their connections
(links, cables, etc.).
- By creating a simulated network topology, researchers can study the effects of network structure
on performance, scalability.
- Simulations can help in optimizing network design and identifying potential bottlenecks or
vulnerabilities.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.18


Simulation examples: Summary
• Simulation is used to imitate the real world
• It is not as new as we think ;-)

• According to Elmaghraby [1968]


• Aid to thought
• Communication
• Training/Education
• Experimentation
• Predicting

• Entertainment (this is a new application)


• Video games
• Serious games

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.19


What is a simulation and how it is done?

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.20


Introduction to Simulation
• What is a simulation?
• A simulation is the imitation of the operation of a real-world
system over time.

Time
S0 S1 S2

• What is the method?


• Generate an artificial history of the system
• Draw inferences from the artificial history concerning the
characteristics of the system
• How it is done?
• Develop a model
• Model consists of entities (objects)

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.21


When is simulation appropriate?
• Simulation enables the study of experiments with
internal interactions
• Informational, organizational, and environmental changes
can be simulated to see the model’s behavior
• Knowledge from simulations can be used to improve the
system
• Observing results from simulation can give insight to
which variables are the most important ones
• Simulation can be used as pedagogical device to
reinforce the learning material
• Simulations can be used to verify analytical results, e.g.,
queueing systems
• Animation of a simulation can show the system in action,
so that the plan can be visualized

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.22


When is simulation not appropriate?
• When problem is solvable by common sense
• When the problem can be solved mathematically
• When direct experiments are easier
• When the simulation costs exceed the savings
• When the simulation requires time, which is not
available
• When no (input) data is available, but simulations need
data
• When the simulation can not be verified or validated
• When the system behavior is too complex or unknown

• Example: human behavior is extremely complex to model

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.23


Advantages of simulation ( Simulations provide a valuable tool for
decision-making, optimization, and gaining insights into system behavior.)

• Policies, procedures, decision rules, information flows can be


explored without disrupting the real system. (Ex: a simulation can be
used to test different scheduling algorithms (like: priority rules) in a manufacturing
facility to determine the most efficient production plan.)
• New hardware designs, physical layouts, transportation systems,
protocols, computer systems, and network architectures can be
tested without committing resources (EX: a simulation can be used to
assess the performance of a proposed network protocol before implementing it in a
real network.)
• Hypotheses about how or why a phenomenon occurs can be
tested for feasibility (Ex: a simulation can evaluate the feasibility of a
hypothesis that increased advertising expenditure leads to higher sales for a product.)
• Time can be compressed or expanded, allowing for the study of
processes that occur over extended periods in a shorter timeframe.
• Slow-down or Speed-up
(EX: a simulation can be used to model the growth and evolution of a forest
ecosystem over several decades in hours or days.)

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.24


Advantages of simulation

• Insight can be obtained about the interaction of variables (Ex:


simulation can reveal how changes in pricing, marketing efforts, and customer
preferences interact to impact the revenue of a retail business.)
• Insight can be obtained about the importance of variables to
the performance of the system (Ex:, a simulation of a supply chain can
assess the impact of factors like inventory levels, transportation costs, and demand
variability on overall supply chain efficiency.)
• Bottleneck analysis can be performed to detect problems (Ex: a
simulation can identify bottlenecks in a production line and suggest changes to
improve throughput and reduce delays.)
• Simulation can help to understand how the system operates
rather than how people think the system operates (Ex: a simulation
of traffic flow can reveal patterns and congestion points that may not be
immediately apparent from observation alone.)
• “What if …” questions can be answered, exploring the consequences
of different scenarios or decisions. (EX:, a simulation can assess the impact of
changing interest rates on the profitability of a financial institution.)

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.25


Disadvantages of simulation
• Model building requires training, it is like an art.
(Ex: Building a simulation model to replicate the behavior of a complex manufacturing process
would require understanding the intricacies of the process, identifying significant factors, and
defining the relationships between variables such as machine settings, material properties, and
production rates. This process can be seen as an art since it requires experience and domain
knowledge to create an accurate representation of the real-world system.)

3.Simulation results can be difficult to interpret (Ex: Analyzing the results of a


simulation model that predicts stock market prices may require statistical techniques to identify
meaningful patterns in the data and differentiate between random fluctuations and actual market
trends.)
• Most outputs are essentially random variables
• Thus, not simple to decide whether output is randomness or system
behavior
(EX: Simulating the spread of a contagious disease within a population would involve
incorporating randomness in factors such as individual interactions, infection rates, and
recovery times, making it challenging to precisely predict the outcome of the simulation. This
randomness can make it difficult to determine whether observed results are due to chance or
represent actual system behavior.)
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.26
Disadvantages of simulation (Cont.)

• Simulation can be time consuming and expensive


• Skimping in time and resources could lead to useless/wrong results
(Example: Simulating the behavior of a nuclear power plant during an emergency scenario
would require significant computational resources and time to accurately capture the complex
interactions of various systems, such as reactor dynamics, coolant flow, and safety protocols.)

• The disadvantages are offset as follows


• Simulation packages contain pre-built models that only need input data,
and this reduces the effort required to create a model from scratch.
• Simulation packages contain tools for analyzing and interpreting simulation
outputs, facilitating result interpretation.
• Sophistication in computer technology, such as faster processors and parallel
computing, have reduced simulation runtimes.
• For most of the real-world problems there are no closed form
solutions, thus Simulation provides a valuable approach when closed-form solutions are
not available, allowing for the study of complex systems and their behaviors.
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.27
Application areas of simulation
• Manufacturing applications
• Construction engineering and project management
• Military applications
• Transportation models and traffic
• Business process simulation
• Health care
• Call-center
• Computers and Networks
• Games, Entertainment
• ...

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.28


What is a system?

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.29


System and System Environment
• System
• A system is a group of objects that are joined together in
some regular interaction or interdependence toward the
accomplishment of some purpose.
• Example:
• Automobile factory
• Machines, parts, and workers operate jointly to produce a
vehicle
• Computer network
• User, hosts, routers, lines establish a network

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.30


System and System Environment
• System environment
• Everything outside the system, but affects the system
(can have an impact on its operation, behavior, or performance.)

• Attention
• It is important to decide on the boundary between the
system and the system environment
• This decision depends on the purpose of the study

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.31


Cont.
* The system and its environment are interconnected and influence each other. Changes or events in
the environment can affect the system, and the system, in turn, can also influence the environment.
Here are some examples of system environments:

1.Automobile Factory:
- The system: includes machines, parts, and workers that operate together to produce vehicles.
- The system environment: encompasses factors such as suppliers of raw materials, market demand
for automobiles, government regulations, technological advancements, and competition from other
manufacturers. These environmental factors can influence production schedules, supply chain
management, product design, and overall performance of the automobile factory.

2. Computer Network:
- The system: consists of users, hosts (such as servers and client devices), routers, and
communication lines.
- The system environment: includes factors like the Internet infrastructure, network protocols and
standards, security threats, network traffic patterns, and the availability of network resources.
Changes in the environment, such as network congestion, cyber attacks, changes in user behavior, or
advancements in network technology, can impact the performance, reliability, and security of the
computer network.
Components of a System
• In order to understand and analyze a system, we need some terms
• General Terminology

• Entity Object of interest in the system


• Attribute Property of an entity
• Activity A time period of specified length
• System state Collection of variables required to describe
the system at any time
• Event An instantaneous occurrence that might
change the state of the system
• Endogenous Activities and Events occurring within the
system
• Exogenous Activities and Events in the environment
(outside the system) that affect the system

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.33


Components of a System: Example (the main entity is a router with two
interfaces, which are the components through which packets are transmitted.)

Example of a simple system


IF1 IF2
• Entity: Router with two interfaces
• Attributes:
• {IF1, IF2}, IF1 and IF2 represent the two interfaces of the router. These
attributes describe the properties or characteristics of the router entity.

• Activity: The activities in this system involve transmitting packets from one
interface to another and dropping packets on each interface. The activities are
defined by their duration, specified in microseconds (µs).
• Transmit IF1 -> IF2, 20µs, This activity represents the transmission of
packets from Interface 1 (IF1) to Interface 2 (IF2) and has a duration of 20µs.
• Transmit IF2 -> IF1, 15µs, This activity represents the transmission of
packets from Interface 2 (IF2) to Interface 1 (IF1) and has a duration of 15µs.
• Drop on IF1, 10µs, This activity represents the dropping of packets on
Interface 1 (IF1) and has a duration of 10µs.
• Drop on IF2, 10µs, This activity represents the dropping of packets on
Interface 2 (IF2) and has a duration of 10µs.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.34


Components of a System: Example (the main entity is a router with two
interfaces, which are the components through which packets are transmitted.) Cont.

IF1 IF2
• System state: is a collection of variables required to describe the system at any given time.
It includes variables: related to received, transmitted, and dropped packets, as well as the queue
length of each interface.
• S = {R1, T1, D1, Q1, R2, T2, D2, Q2}
• Ri = Received packets on interface i (R1 and R2 for IF1 and IF2, respectively)
• Ti = Transmitted packets on interface i (T1 and T2 for IF1 and IF2, respectively)
• Di = Dropped packets at interface i (D1 and D2 for IF1 and IF2, respectively)
• Qi = Queue length of each interface i (Q1 and Q2 for IF1 and IF2, respectively)

• Events: instantaneous occurrences that might change the state of the system.
The event includes the interface on which the packet arrives (IF), the time at which it arrives (Time),
and the length of the packet.

• Events are: Arrival of packets , which are represented as {IF, Time, Packet
length}
• where (IF) is the interface on which the packet arrives, (Time) is the time at
which it arrives, and (Packet length) is the length of the packet.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.35


Components of a System: Examples
System Entities Attributes Activities Events State Variables
Banking Customers Checking- Making deposits Arrival; Number of busy
account Draw money departure tellers
balance Number of waiting
customer
Rapid rail Riders Source Traveling Arrival at Number of riders
Destination station at each station
Arrival at Number of rider in
destination transit
Production Machines Speed Capacity Welding Breakdown Status of
Breakdown rate Stamping machines

Communications Messages Length Transmitting Arrival at Number of waiting


Destination destination messages to be
transmitted

Inventory Warehouse Capacity Withdrawing Demand Levels of


inventory

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.36


Cont.
1.System: Banking
1. Entities: Customers
2. Attributes: Checking account balance
3. Activities: Making deposits, Withdraw money
4. Events: Arrival, Departure
5. State Variables: Number of busy tellers, Number of waiting customers
The main entity is the customers. The attributes associated with customers are their checking account
balances. The activities in this system include making deposits and withdrawing money. The events are the
arrival and departure of customers. The state variables of the system include the number of busy tellers
(representing tellers currently serving customers) and the number of waiting customers (those in line).
2.System: Rapid Rail
1. Entities: Riders
2. Attributes: Source, Destination
3. Activities: Traveling,
4. Events: Arrival at station, Arrival at destination
5. State Variables: Number of riders at each station, Number of riders in transit
The entities are riders who travel from one station to another. The attributes associated with riders are
their source and destination stations. The activities in this system include traveling (riding the train). The
events are arrival at a station, and arrival at the destination station. The state variables of the system include
the number of riders at each station and the number of riders in transit (on the train).
Cont.
3.System: Production
1. Entities: Machines
2. Attributes: Speed, Capacity, Breakdown rate
3. Activities: Welding, Stamping,
4. Events: Breakdown
5. State Variables: Status of machines
The entities are machines involved in the manufacturing process. The attributes associated with machines
include their speed, capacity, and breakdown rate. The activities in this system include welding, stamping. The
events are potential breakdowns. The state variables of the system represent the status of the machines,
indicating whether they are functioning or experiencing a breakdown.

4.System: Communications
1. Entities: Messages
2. Attributes: Length, Destination
3. Activities: Transmitting,
4. Events: Arrival at destination
5. State Variables: Number of waiting messages to be transmitted
The entities are messages being transmitted. The attributes associated with messages include their length
and destination. The activities in this system include transmitting the messages. The events are the arrival
of messages at the destination. The state variable of the system represents the number of waiting messages
to be transmitted, indicating how many messages are queued up for transmission.
Cont.
5.System: Inventory
1. Entities: Warehouse
2. Attributes: Capacity
3. Activities: Withdrawing,
4. Events: Demand
5. State Variables: Levels of inventory
The entity is the warehouse where goods are stored. The attribute associated with the warehouse is its
capacity, indicating how much it can hold. The activities in this system include withdrawing goods from the
warehouse. The event is fulfilling customer demand. The state variable of the system represents the levels
of inventory in the warehouse, indicating how much stock is available.
Discrete and Continuous Systems
• Discrete Systems
• State variables change only at

Customers waiting
discrete set of points or events
• Examples
• Bank, Grocery
• Router, Host
Time

• Continuous Systems
• State variables change
continuously over time

Head of water
• Examples
• Head of water
• Temperature

Time

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.40


Cont.
Discrete Systems:
- The state variables change only at a discrete set of points or events.

Examples of discrete systems include:

1.Customers waiting at a crosswalk: The state variable in this system is the number of
customers waiting to cross the street. The state changes only when a customer arrives or
when a customer successfully crosses the street.

2.Bank or grocery store queues: The state variables in these systems are the number of
customers in the queue. The state changes when a customer joins the queue or when a
customer is served and leaves the queue.

3.Routers and hosts in a network: The state variables in this system can include the
number of packets in the router's buffer or the number of hosts connected to a network.
The state changes when packets arrive or depart from the router or when hosts join or
leave the network.
Cont.
Continuous Systems:
- The state variables change continuously over time. The changes occur continuously,
without distinct events or points. Continuous systems are often described using
mathematical models and differential equations.

Examples of continuous systems include:

1.Head of water across time: This system describes the changing water level in a
reservoir or river or dam over time. The state variable, the head of water, changes
continuously as water flows in or out of the system.

2.Temperature of an object or environment: The state variable, Temperature of an


object or environment, change continuously due to external factors like heat sources or
cooling mechanisms, or even due to natural phenomena like weather patterns.
What is a model?

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.43


Model of a System

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.44


Model of a System

http://www.princeton.edu/~asce/const_95/ayasofya.html
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.45
Model of a System

http://www.crystalnebulae.co.uk/sunmodel.html
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.37
Model of a System

http://www.windows2universe.org/earth/Water/ocean_atmosphere_coupled_models.html
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.47
Model of a System
• What is a model?
• A model is a representation of a system for the purpose of studying the
system (created to study and understand the system(its behavior, properties, or relationships) ).
• The purpose of a model: allow researchers and analysts to gain insights,
make predictions, and test hypotheses in a simplified and controlled
environment.
Input Output
• Approach System
• Consider only those aspects of the
system that are relevant to the
specific problem being studied.
• This allows researchers or analysts
to focus on the key elements that
directly affect the problem at hand,
without being overwhelmed by
unnecessary complexity. I(t) O(t)
Model
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation
Cont.
• Problem (challenge):
• Granularity of details (determining the appropriate level of detail )
- The level of detail chosen depends on the specific objectives of the study and the resources
available.
• Models are not unique
- Different models can be developed to represent the same system, and they may vary in terms of
their assumptions, level of detail, and complexity. The choice of model depends on the specific
research question, the available data, and the trade-off between accuracy and simplicity.

• EX: For example, in studying the spread of a contagious disease, scientists may develop various
models with different levels of detail.
-A simple model could assume a homogeneous population and use basic equations to simulate
the disease's transmission dynamics. On the other hand, a more complex model might consider
factors such as population demographics, spatial dynamics, and individual behaviors to provide a
more realistic representation.
Model of a System

The tendency is nearly always to simulate


too much detail rather than too little. This
can result in complex models that may not
provide significant additional insights or
value.
Thus, one should always design the model
around the question to be answered rather
than imitate the real system exactly.

Shannon, 1975

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.50


Model of a System

System
How to study?

Simulation

Experiment with the actual system Experiment with a model of the system

-Studying a system by conducting


experiments directly on the actual Mathematical Model Physical Model
system
- In biology, scientists might
conduct experiments on live
organisms to understand their Analytical Model Simulation
physiological responses to
different stimuli or conditions.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.51


Model of a System
• Physical model: Prototype (representation ) of a system for the purpose of
study.
-It can be a scaled-down version or a simplified representation that allows researchers to observe
and analyze the behavior of the system.
-Architects often build physical models of buildings to study their structural integrity, aesthetics,
and spatial arrangements before constructing the actual buildings.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.52


Model of a System
• Mathematical model: uses symbolic and mathematical equations to
represent a system.
- It provides a formal and structured representation of the system's behavior, relationships, and
properties.
-Mathematical models are widely used across various disciplines to analyze complex systems
(allow for analytical analysis ) and make predictions or derive insights based on mathematical
principles and calculations.
- The laws of motion developed Newton, such as F = ma (force equals mass times acceleration),
form a mathematical model that describes the motion of objects in classical mechanics.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.53


Model of a system

Simulation: involves creating a computer-based model or software


program that emulates the behavior of the system over time.

-It allows researchers to observe and analyze the system's dynamics and
interactions in a virtual environment. Simulations are commonly used
when conducting experiments on complex or inaccessible systems.

Ex:
Flight simulators are used to train pilots, providing a realistic simulation of
flying an aircraft and allowing pilots to practice different scenarios and
emergency procedures.
EX:Model of a System: model for Mobility system (represents
the relationship between distance (d), velocity (v), and time (t))

• Movement
• Model formula : d = v  t (states that the distance traveled is equal to the
velocity multiplied by the time.)
• Assumptions: Constant velocity v over the whole time t of travel (This model
assumes that the velocity remains constant (np changes ) throughout the
entire duration of travel. )
• Advantage: Simple formulae and intuitive. It allows for quick calculations and
provides a basic understanding of how distance, velocity, and time are
related.
• Disadvantage: this assumption may hold true for certain scenarios, it is often
not valid for real-world mobility situations involving humans, cars, or planes.
- In reality, the velocity of a moving object or individual often varies due to
factors such as traffic conditions, acceleration, deceleration, turns, stops, or
changes in speed limits. These variations can significantly impact the distance
traveled within a given time.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.55


Ex: Model of a System: Communication Link (represents the
process of transmitting data packets in a network.)

• A packet in a network suffers various delays:


• Processing in the node: examine packet header (: When a packet arrives at a network
node (such as a router or switch), the node needs to examine the packet header to determine how to handle it.
This involves inspecting information such as the source and destination addresses, protocol type, and any
necessary routing decisions. The time taken for this processing is known as the processing delay.)
• Queueing: packet waits for transmission (After processing, if the outgoing interface is busy
transmitting another packet, the arriving packet needs to wait in a queue until it can be sent. This is known as
queueing delay and is influenced by factors such as the size of the queue, the traffic load on the network, and
the priority assigned to the packet.)
• Transmission: time to put all bits of a packet on the medium (ex: wire). (Once
the packet reaches the front of the queue, it is transmitted onto the network medium. The transmission delay
is the time required to put all the bits of the packet onto the medium. It depends on the transmission rate of
the link, which is typically measured in bits per second. )

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.56


Ex: Model of a System: Communication Link (represents the
process of transmitting data packets in a network.) Cont.

• A packet in a network suffers various delays: (cont.)


• Propagation: time to propagate on the medium from A to B (After transmission,
the packet travels through the physical medium from the source node (A) to the destination node
(B).
The propagation delay: is the time it takes for the signal to propagate from one end to the other. It
depends on the physical properties of the medium, such as the speed of light in fiber-optic cables
or the electrical propagation speed in copper wires.)

** It is important to note that the delays can vary depending on factors such as network congestion,
packet size, and the distance between nodes.
**Understanding and modeling these delays are crucial for optimizing network performance and
ensuring efficient data transmission.
**Network engineers and researchers use various techniques, such as traffic engineering, quality of
service (QoS) mechanisms, and network simulations, to analyze and improve the performance of
communication links and minimize packet delays.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.57


Ex: Model of a System: User Behavior (aims to understand and analyze
how users interact with systems or applications)

• It provides insights into user actions, preferences, and patterns,


which are crucial for designing user-friendly interfaces, optimizing
system performance, and offering services to meet user needs.
• This model can be applied at different levels, including user level,
object level, and packet level.
User/Application

Object

Packet

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.58


Cont.
1.User Level: At the user level, the model focuses on capturing and analyzing the overall
behavior of users within a system or application.

- It involves studying user actions, such as task completion rates, time spent on different
features, and preferences.
- This information helps in understanding how users interact with the system, identifying
usability issues, and improving user experience.

2.Object Level: The object level of the user behavior model zooms in on individual objects
or elements within the system or application.

-It examines how users interact with specific components, such as buttons, menus, or
multimedia content.
-By analyzing user interactions with these objects, designers can assess the effectiveness of
the design, identify areas of improvement, and optimize the user interface for better usability.
Cont.
3. Packet Level: The packet level of the user behavior model is primarily applicable in network
communication systems.
- It focuses on the analysis of network packets exchanged between the user's device and the
network infrastructure.
- By inspecting packet-level data, such as packet size, timing, source, and destination addresses, it
is possible to gain insights into user activities, network performance, and potential security issues.
- This level of analysis is often employed in network monitoring, intrusion detection, and network
optimization.

By examining behavior at different levels, such as user, object, and packet levels, designers and
system administrators can gain valuable insights into user preferences, system performance, and
network behavior.
Principles of Modeling
• Conceptualizing a model requires system knowledge, engineering
judgment, and model-building tools.
• The secret to being a good modeler is recognizing the need and having the
ability to remodel.
• The modeling process is evolutionary because the act of modeling reveals
important information piecemeal.
• The problem or problem statement is the primary controlling element in
model-based problem solving.
• In modeling combined systems, the continuous aspects of the problem
should be considered first. The discrete aspects of the model should then
be developed.
• A model should be evaluated according to its usefulness. From an
absolute perspective, a model is neither good or bad, nor is it neutral.
• The purpose of modeling is knowledge and understanding, not
models.
• Know when to model “top-down” and when to model “bottom-up”.
• It is important to learn modeling techniques, but more important to
learn to consider the tradeoffs among alternative techniques.
A. Alan B. Pritsker, James O. Henriksen, Paul A. Fishwick, Gordon M. Clark,
“Principles of Modeling”, Winter Simulation Conference,
1991.
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.61
Cont.
1.Conceptualizing a model requires system knowledge, engineering judgment, and model-building tools: When
developing a model, it is essential to have a deep understanding of the system being modeled. This includes
knowledge of its components, interactions, and underlying principles. Additionally, engineering judgment helps
in making informed decisions about simplifications, assumptions, and model parameters. Model-building tools,
such as software or mathematical frameworks, facilitate the actual creation of the model. For example, in
designing a traffic flow model, an engineer needs to possess knowledge of traffic patterns, road infrastructure,
and traffic flow dynamics. They also need to exercise judgment in selecting appropriate equations and parameters
for the model and utilize software tools like simulation software or traffic modeling packages.
2.The secret to being a good modeler is recognizing the need and having the ability to remodel: Models are
representations of real-world systems, and as our understanding of the system improves or circumstances change,
the model may need to be adjusted or completely redesigned. A good modeler recognizes when the current model
no longer serves its purpose or fails to capture the system accurately. They have the ability to identify the need
for remodeling and possess the skills to modify or rebuild the model accordingly. For example, in financial
modeling, economic conditions may change, requiring adjustments to assumptions, variables, and model
structure.
3.The modeling process is evolutionary because the act of modeling reveals important information piecemeal:
Modeling is an iterative process where new insights and understanding emerge as the model is developed. The act
of constructing a model reveals gaps in knowledge, highlights uncertainties, and uncovers hidden relationships.
This incremental knowledge gained during the modeling process leads to refinements and improvements in
subsequent iterations. For instance, when developing a climate model, scientists continuously update and refine
the model based on new data, feedback, and improved understanding of climate dynamics.
Cont.
1.The problem or problem statement is the primary controlling element in model-based problem solving: The
purpose of modeling is to solve a problem or address a specific question. The problem statement defines the
scope, objectives, and constraints of the modeling task. It guides the selection of appropriate modeling
techniques, data collection, and analysis methods. The model is built to address the problem statement and
provide insights or solutions. For example, in healthcare modeling, the problem statement might be to optimize
hospital resource allocation during a pandemic, which guides the modeling process and determines the variables,
constraints, and objectives of the model.
2.In modeling combined systems, the continuous aspects of the problem should be considered first. The discrete
aspects of the model should then be developed: Many real-world systems involve both continuous and discrete
components. Continuous aspects refer to variables that can take any value within a range, such as time,
temperature, or distance. Discrete aspects refer to variables that can only take specific values, such as counts,
categories, or states. When modeling such combined systems, it is generally advisable to first address the
continuous aspects of the problem, as they often form the foundation of the system behavior. Once the
continuous aspects are adequately captured, the discrete aspects can be incorporated. For example, in modeling a
manufacturing process, the continuous aspects, such as production rates, material flow, and energy consumption,
would be modeled first before incorporating discrete aspects, such as production scheduling or machine
maintenance.
3.A model should be evaluated according to its usefulness. From an absolute perspective, a model is neither
good nor bad, nor is it neutral: The quality of a model is subjective and depends on its intended purpose and
context. A model should be evaluated based on its usefulness in providing insights, aiding decision-making, or
solving the problem at hand. Different models can be valid and useful in different scenarios, and their
effectiveness can vary depending on the specific context. For example, a simple linear regression model may be
What is a Good Model?

Simplicity Availabilit Code quality


y

Credibility Verified Documentation

Efficiency

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.64


What is a Good Model?

Everything should be made as simple


as possible, but not simpler.

Albert Einstein

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.65


Simulation Models
• Simulation Model
• A simulation model is a particular type of mathematical model
of a system.

• Types of simulation models


• Static: Represent a system at a particular point in time.
• Dynamic: Represent a system over a time interval.

• Deterministic: Simulation models without random variables.


• Stochastic: Simulation models with random variables.

• Discrete: System state changes occur only at discrete time


points.
• Continuous: System state changes occur continuously.

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.66


Simulation Models

In this class, we will focus on

discrete, dynamic, stochastic

simulation models.

Mesut
GüneŞ

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.67


Simulation Models

Models

static dynamic

deterministic stochastic deterministic stochastic

Monte Carlo
Simulation

continuous discrete

Discrete-event
Simulation

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.68


Discrete-Event System Simulation
• Discrete-event Simulation
• System state changes only at discrete set of points in time.
• Simulation model is analyzed by numerical methods.
• Numerical methods employ computational procedures to
“solve” mathematical models.
• The model is rather “run” than “solved”

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.69


What is a performance metric?

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.70


Selecting performance metrics
Time
Request for (Response time)
service i Done
correctly Rate
(Throughput)

Resources
(Utilization)
Done

Done Probability
incorrectly Error j
Time between errors
System

Cannot Duration of the event


Event k
do
Time between events

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.71


Selecting performance metrics: Example
Response time
Get page 300 msec = 0.3 sec
Done
name.html correctly Throughput
8420 queries/min =
12.5 MB/sec
Utilization
Done 48.4% Load

System Probability
Error p = 0.3
Done
Page not
Web incorrectly Time between errors
found
server 30 min = 1800 sec
serving
web
pages Duration of the event
Cannot Event 1 Hour = 3600 sec
do Server Down
Time between events
1 Day = 86400 sec

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.72


Common performance metrics

User System
request response

Time
Response time

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.73


Common performance metrics

User User System System System User starts


starts finishes starts starts completes next
request request execution response response request

Time

Reaction time Think time

Response time

Response time

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.74


Utility classification of performance metrics

Lower is better Higher is better Nominal is best


Utilit

Utilit

Utilit
y

y
Metric Metric Metric

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.75


Other simulation paradigms

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.76


Simulation for static models
• Monte Carlo simulation
• Mainly used for mathematical problems which are not
analytically tractable
• Example: Approximate 
• Area of a circle: A    r 2 if r  1  A 
• Count the number of points inside and outside a unit quarter
circle.

The Monte Carlo


simulation was first
1
extensively used in 1944
in the research to develop
the first nuclear bomb,
the Manhattan project!

1
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.77
Simulation of dynamic, continuous models
• System described by • Growth rate of the prey
differential equation population without
• Typically involves predators
numerical solution of • r  x(t)
these equations • Predator change rate
• No real difference to a • -s  y(t)
numerically based • Interactions
mathematical solution
dx
• Typical example:  r  x(t)  a  x(t)  y(t)
predator/prey systems dt
• Let x(t) be the size of the dy
prey population  s  y(t)  b  x(t)  y(t)
dt
• Let y(t) be the size of the • Parameters
predator population • x(0), y(0), a, b, r, s
• Metrics
• x(t), y(t)
• Solve system of
differential equations
Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.78
Steps in a simulation study

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.79


Steps in a Simulation Study
1. Problem formulation
• Clearly understand problem
• Reformulation of the problem
2. Setting of objectives and overall project plan
• Which questions should be answered?
• Is simulation appropriate?
• Costs?
3. Model conceptualization
• No general guide
• Modeling tools in research, e.g., UML
4. Data collection
• How to get data?
• Are random distributions appropriate?
5. Model translation
• Program, which runs on a Computer.
6. Verified?
• Does the program that, what the model describes?
7. Validated?
• Do the results match the reality? Calibration?
• In cases with no real-world system, hard to validate
8. Experimental design
• Which alternatives should be run?
• Which parameters should be varied?
9. Production runs and analysis
10. More runs?
11. Documentation and reporting
• Program documentation – how does the program work
• Progress documentation – chronology of the work
12. Implementation

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.71


Steps in a Simulation Study
Phase 1:
Discovery and
Orientation

Phase 2:
Model building
and data
Most crucial step is collection
validation.
If model is invalid
results can lead to
dangerous and Phase 3:
expensive Run the model
decisions!

Phase 4:
Implementation

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.81


Summary
• Motivated the course by examples
• Introduced simulation as a notion
• Discussed for what purposes simulation is useful
• Introduction of a general terminology
• Introduction of discrete-event simulation
• Discussed the steps of a simulation study
• Performance metrics

Prof. Dr. Mesut Güneş ▪ Ch. 1 Introduction to Simulation 1.82

You might also like