Prof. Dr. Mesut Güneş Ch. 1 Introduction To Simulation
Prof. Dr. Mesut Güneş Ch. 1 Introduction To Simulation
Prof. Dr. Mesut Güneş Ch. 1 Introduction To Simulation
Introduction to Simulation
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?
- 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?
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
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:
- 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.
Time
S0 S1 S2
• 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
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
• 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.
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.
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
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.
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.
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
Shannon, 1975
System
How to study?
Simulation
Experiment with the actual system Experiment with a model of the system
-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.
** 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.
Object
Packet
- 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?
Efficiency
Albert Einstein
simulation models.
Mesut
GüneŞ
Models
static dynamic
Monte Carlo
Simulation
continuous discrete
Discrete-event
Simulation
Resources
(Utilization)
Done
Done Probability
incorrectly Error j
Time between errors
System
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
User System
request response
Time
Response time
Time
Response time
Response time
Utilit
Utilit
y
y
Metric Metric Metric
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
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