0% found this document useful (0 votes)
10 views14 pages

Network Simulation and Modeling Lecture Notes

The document contains combined lecture notes on Network Simulation and Modeling, covering key concepts such as the OSI and TCP/IP reference models, system modeling approaches, and random number generation in simulations. It details the structure and functionality of network layers, simulation components, performance metrics, and confidence intervals. Additionally, it discusses various simulation platforms and tools used in network simulations.

Uploaded by

mzhasan
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)
10 views14 pages

Network Simulation and Modeling Lecture Notes

The document contains combined lecture notes on Network Simulation and Modeling, covering key concepts such as the OSI and TCP/IP reference models, system modeling approaches, and random number generation in simulations. It details the structure and functionality of network layers, simulation components, performance metrics, and confidence intervals. Additionally, it discusses various simulation platforms and tools used in network simulations.

Uploaded by

mzhasan
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

Network Simulation and Modeling

Combined Lecture Notes


Lectures 2, 3, and 4

Network Department
3rd Class – Second Semester 2024/2025

February 2025
Network Simulation and Modeling – Combined Lecture Notes

Table of Contents
Part I: OSI and TCP/IP Reference Models (Lecture Two – Feb 04, 2025)
1.1 The OSI Model
1.2 The TCP/IP Reference Model
1.3 The Layering Concept
1.4 Data Encapsulation and Decapsulation

Part II: System Modeling (Lectures Two & Three – Feb 04–11, 2025)
2.1 Introduction to System Modeling
2.2 Analytical vs. Simulation Approach
2.3 Basics of Computer Network Simulation
2.4 Simulation Components
2.5 Simulation Performance Metrics
2.6 Confidence Intervals
2.7 Simulation Platforms and Tools

Part III: Random Number Generation (Lectures Three & Four – Feb 11–17, 2025)
3.1 Introduction to Random Number Generators
3.2 Seeds and Determinism
3.3 RNG in Network Simulations
3.4 Simulating Packet Delays
3.5 Simulating Packet Loss
3.6 Simulating Network Congestion
3.7 Reliability of Simulation Results

Page 2
Network Simulation and Modeling – Combined Lecture Notes

PART I
OSI and TCP/IP Reference Models
Lecture Two – February 04, 2025

1.1 The OSI Model


The Open Systems Interconnection (OSI) model was the first reference model developed by the
International Standards Organization (ISO) to provide a standard framework to describe the
protocol stacks in a computer network. It consists of seven layers, where each layer is intended
to perform a well-defined function. These layers are the physical layer, data link layer, network
layer, transport layer, session layer, presentation layer, and application layer.
The OSI model only specifies what each layer should do; it does not specify the exact services
and protocols to be used in each layer. This distinction between specification and implementation
is a fundamental design principle that enables flexibility and interoperability.

1.2 The TCP/IP Reference Model


The Transmission Control Protocol (TCP)/Internet Protocol (IP) reference model, which is based
on two primary protocols – TCP and IP – is used in the current Internet. These protocols have
proven very powerful, and as a result have experienced widespread use and implementation in
existing computer networks.
In the TCP/IP model, the protocol stack consists of five layers: physical, data link, network,
transport, and application. Each layer is responsible for certain services.

Application Layer
The application layer sits on top of the stack and uses services from the transport layer. This layer
supports several higher-level protocols such as HTTP (Hypertext Transfer Protocol) for World
Wide Web applications, SMTP (Simple Mail Transfer Protocol) for electronic mail, TELNET for
remote virtual terminal, DNS (Domain Name Service) for mapping comprehensible host names
to their network addresses, and FTP (File Transfer Protocol) for file transfer.

Transport Layer
The objective of the transport layer is to perform flow control and error control for message
transportation. Flow control ensures that the end-to-end transmission speed is neither too fast to
cause network congestion nor too slow to underutilize the network. Error control ensures that
packets are delivered to the destination properly.
Generally, when a transport protocol receives a message from the higher layer, it breaks down
the message into smaller pieces. It then generates a Protocol Data Unit (PDU) – called a segment
– by attaching necessary error and flow control information, and passes the segment to the lower
layer.
Two well-known transport protocols are defined in this layer: TCP (Transmission Control Protocol)
provides reliable, connection-oriented communication between two hosts, while UDP (User

Page 3
Network Simulation and Modeling – Combined Lecture Notes

Datagram Protocol) supports unreliable, connectionless transport. TCP is ideal for applications
that prefer accuracy over prompt delivery, and the reverse is true for UDP.

Network Layer
The network layer determines the route through which a packet is delivered from a source node
to a destination node. A PDU for the network layer is called a packet.

Data Link Layer


A link layer protocol has three main responsibilities. First, flow control regulates the transmission
speed in a communication link. Second, error control ensures the integrity of data transmission.
Third, flow multiplexing/demultiplexing combines multiple data flows into and extracts data flows
from a communication link.
Choices of link layer protocols may vary from host to host and network to network. Examples of
widely used link layer protocols/technologies include Ethernet, Point-to-Point Protocol (PPP),
IEEE 802.11 (Wi-Fi), and Asynchronous Transfer Mode (ATM).

Physical Layer
The physical layer deals with the transmission of data bits across a communication link. Its primary
goal is to ensure that the transmission parameters (e.g., transmission power) are set appropriately
to achieve the required transmission performance, such as the target bit error rate.

1.3 The Layering Concept


A computer network is a complex system. To facilitate design and flexible implementation, the
concept of layering is introduced. Using a layered structure, the functionalities of a computer
network can be organized as a stack of layers.
Logically, each layer communicates with its peer (a logical entity on the same layer) on the other
communication node. However, the actual data transmission occurs through the lowest layer –
the physical layer. Therefore, data at the source node always move down the layers until reaching
the physical layer, where it is transmitted via a physical link to a neighboring node or the
destination node. At the destination node, the data are passed upward through the layers until
reaching the corresponding peer.
Representing a well-defined and specific part of the system, each layer provides certain services
to the layer above it. When performing a task (e.g., transmit a packet), an upper layer asks its
lower layer to do the more specific job. Accessible through so-called interfaces, these services
usually define what should be done in terms of network operations or primitives, but do not
specifically define how such things are implemented. The details of how a service is implemented
are defined in a protocol.
The beauty of this layering concept is layer independency. That is, a change in a protocol of a
certain layer does not affect the rest of the system as long as the interfaces remain unchanged.
The interaction among services, protocols, and interfaces is what makes up the layering concept.

Page 4
Network Simulation and Modeling – Combined Lecture Notes

1.4 Data Encapsulation and Decapsulation


Suppose an application process running on Layer 4 of the source generates data or messages
destined for the destination. The communication starts by passing a generated message M down
to Layer 3, where the data are segmented into two chunks (M1 and M2), and control information
called a header (H3) specific to Layer 3 is appended to M1 and M2.
The control information includes, for example, sequence numbers, packet sizes, and error
checking information. This information is understandable and used only by the peering layer on
the destination to recover the data (M). The resulting data (e.g., H3+M1) are called a Protocol
Data Unit (PDU) and are handed to the next lower layer, where some protocol-specific control
information is again added.
This process continues until the message reaches the lowest layer, where transmission of
information is actually performed over a physical medium. Note that, along the line of these
processes, it might be necessary to further segment the data from upper layers into smaller
segments for various purposes.
When the message reaches the destination, the reverse process takes place. As the message
moves up the stack, its headers are ripped off layer by layer. If necessary, several messages are
put together before being passed to the upper layer. The process continues until the original
message (M) is recovered at Layer 4.

Page 5
Network Simulation and Modeling – Combined Lecture Notes

PART II
System Modeling
Lectures Two & Three – February 04–11, 2025

2.1 Introduction to System Modeling


System modeling is an act of formulating a simple representation for an actual system. It allows
investigators to look closely into the system without having to actually implement it. During the
investigation, various parameters can be applied to study system behavior. After the system is
well understood, investigators can decide whether the actual system should be implemented.
System modeling often requires simplification assumptions. These assumptions exclude
irrelevant details of the actual system, hence making the model cleaner and easier to implement.
However, excessive assumptions may lead to inaccurate representation of the system. Design
engineers need to use their discretion to achieve the best modeling trade-off.

2.2 Analytical vs. Simulation Approach


Analytical Approach
The general concept of the analytical modeling approach is to describe the system
mathematically, and apply numerical methods to gain insight from the developed mathematical
model. Examples of widely used mathematical tools include queuing theory and probability theory.
Since analytical results derive mainly from mathematical proofs, they are true as long as the
underlying conditions hold.

Simulation Approach
Simulation recreates real-world scenarios using computer programs. It is used in various
applications ranging from operations research, business analysis, manufacturing planning, and
biological experimentation. Compared to analytical modeling, simulation usually requires fewer
simplification assumptions, since almost every possible detail of system specifications can be
incorporated in a simulation model.
When the system is rather large and complex, a straightforward mathematical formulation may
not be feasible. In this case, the simulation approach is usually preferred to the analytical
approach.

2.3 Basics of Computer Network Simulation


Part 1 – Planning (40% of Time)
This part includes defining the problem, designing the corresponding model, and devising a set
of experiments for the formulated simulation model. It is recommended that 40% of time and effort
be spent on planning.

Page 6
Network Simulation and Modeling – Combined Lecture Notes

Part 2 – Implementing (20% of Time)


Implementation of simulation programs consists of three steps:

Step 1 – Initialization
This step establishes initial conditions (e.g., resetting simulation clocks and variables) so that the
simulation always starts from a known state.

Step 2 – Result Generation


The simulation creates and executes events, and collects necessary data generated by the
created events.

Step 3 – Post-Simulation Processing


The raw data collected from simulation are processed and translated into performance measures
of interest.

Part 3 – Testing (40% of Time)


This part includes verifying and validating the simulation model, experimenting on the scenarios
defined in Part 1 and possibly fine-tuning the experiments themselves, and analyzing the results.

2.4 Simulation Components


A computer network simulation can be thought of as a flow of interaction among network entities
(e.g., nodes, packets). These entities move through the system, interact with other entities, join
activities, trigger events, cause changes to the state of the system, and terminate themselves.
From time to time, they contend or wait for some type of resources. This implies that there must
be a logical execution sequence to cause all these actions to happen in a comprehensible and
manageable way.
The key components of a simulation include:

Entities
Entities are objects that interact with one another in a simulation program. They cause changes
to the states of the system. In the context of a computer network, entities may include computer
nodes, packets, flows of packets, or non-physical objects such as simulation clocks.

Resources
Resources are limited virtual assets shared by entities, such as bandwidth or power budget.

Activities and Events


From time to time, entities engage in some activities. The engagement creates events and triggers
changes in the system state. Common examples of events are packet reception and route update
events.

Scheduler
A scheduler maintains a list of events and their execution time. During a simulation, it moves
along a simulation clock and executes events in the proper sequence.

Page 7
Network Simulation and Modeling – Combined Lecture Notes

State and Global Variables


State variables keep track of the system state. They can be classified as local variables and global
variables based on their scope of operation. Local variables are valid under a limited range, while
global variables are understandable globally by all program entities. In general, global state
variables hold general information shared by several entities such as the total number of nodes,
the geographical area information, and the reference to the scheduler.

Random Number Generator (RNG)


A Random Number Generator introduces randomness in a simulation model. It generates random
numbers by sequentially picking numbers from a deterministic sequence of pseudo-random
numbers, yet the numbers picked from this sequence appear to be random. Without randomness,
the results for every run would be exactly the same. To generate different results, we may initialize
the RNG for different runs with different seeds. A seed identifies the first location where the RNG
starts picking random numbers.

Statistics Gatherer
Statistics gatherers use variables to collect relevant data (e.g., packet arrival and departure time).
These data can later be used to compute performance measures such as average and standard
deviation of the queuing delay for data packets traversing a network.

2.5 Simulation Performance Metrics


Performance of a simulation is measured by the following metrics:
• Execution Speed: How fast a simulation can be completed.
• Cost: Expense paid to procure software/hardware, develop simulation programs, and
obtain simulation results. Generally, commercial tools have more features and are easier
to work with at the expense of increasing cost.
• Fidelity: How reliable the simulation results are. Fidelity can be increased by
incorporating more details (i.e., making fewer assumptions) into the simulation.
• Repeatability: An assurance that if the experiment were to be repeated, the results
would be the same. Repeatability can be quantified using confidence intervals.
• Scalability: The impact of the size of the problem (e.g., the number of nodes, the input
traffic) on other simulation performance measures.

2.6 Confidence Intervals


A confidence interval is a useful mathematical tool that helps quantify the level of repeatability. It
is a range between which one has confidence in finding data points, characterized by its width
and the confidence coefficient (i.e., probability) to find data points within that range.
It is fairly impossible or impractical to have perfectly repeatable results. Confidence intervals
measure such imperfection. As long as the imperfection is well defined and reasonable, the
simulation results are usually deemed sufficiently reliable.

Key Components of a Confidence Interval

Page 8
Network Simulation and Modeling – Combined Lecture Notes

1. Point Estimate: The best estimate of the true parameter (e.g., sample mean).
2. Margin of Error: The range within which the true value is likely to fall, calculated using
statistical formulas.
3. Confidence Level: Expressed as a percentage (e.g., 90%, 95%, 99%), it represents the
probability that the true parameter falls within the interval.

Example: Network Performance Simulation


A company is testing a new network routing protocol by running a simulation to measure the
average packet delay (latency) in milliseconds. After running multiple simulation trials, the results
show: sample mean delay of 50 ms, standard deviation of 5 ms, and a 95% confidence interval
of [48 ms, 52 ms].
The simulation estimates that the true average delay for this network protocol is likely between
48 ms and 52 ms, with 95% confidence. If the confidence interval were too wide (e.g., [40 ms, 60
ms]), it would indicate high uncertainty, making the results less reliable. A narrower confidence
interval means more precise and trustworthy simulation results.

Why Confidence Intervals Matter in Network Simulations


1. Performance Benchmarking: Helps compare different network protocols with statistical
reliability.
2. Quality Assurance: Ensures network performance meets expected standards before
real-world deployment.
3. Capacity Planning: Assists in predicting network congestion and optimizing resource
allocation.

2.7 Simulation Platforms and Tools


Platform Types
• Software platforms: Very flexible and economical. Can be installed on personal
computers or servers and upgraded very easily.
• Hardware platforms: Can be very fast and more suitable for computationally intensive
simulation (e.g., using VHDL). Also essential when input parameters need to be
collected from the surrounding environment. The major drawback is that they can be
expensive to implement and modify.
• Hybrid platforms: Combine benefits of both software and hardware platforms. An
example is Hardware In the Loop (HIL) simulation, used to test complex real-time
embedded systems.

Tool Classification
• Open-source vs. Closed-source: Open-source software reveals its source code,
allowing investigation, modification, and redistribution. The drawback is lack of
accountability. Closed-source software can be modified only by the developers, who are
fully accountable for quality.

Page 9
Network Simulation and Modeling – Combined Lecture Notes

• Free vs. Commercial: Free software may lack support and accountability. Commercial
software is usually well documented and has better technical support.
• Publicly available vs. In-house: Publicly available software can be open-source or
closed-source, and can be free or commercial.

User Interface
The user interfaces of simulation programs can be Command Line Interface (CLI) or Graphic User
Interface (GUI). A large number of academic works use CLI-based simulation tools since these
tools use most computational power for simulations. GUI-based tools, on the other hand, allocate
a part of computational power to improve user interface, providing user-friendly network
configuration interfaces and graphical/animation-based result presentation.

Page 10
Network Simulation and Modeling – Combined Lecture Notes

PART III
Random Number Generation
Lectures Three & Four – February 11–17, 2025

3.1 Introduction to Random Number Generators


A Random Number Generator (RNG) is a system that generates numbers that appear to be
random. There are two main types of RNGs:

1. Pseudorandom Number Generator (PRNG)


A PRNG uses a mathematical algorithm to produce sequences of numbers that seem random. It
requires an initial value (seed) to start generating numbers. PRNGs are deterministic: the same
seed always produces the same sequence. They are fast and efficient, used in games,
simulations, and cryptography.

2. True Random Number Generator (TRNG)


A True Random Number Generator relies on physical phenomena (e.g., atmospheric noise,
radioactive decay) to generate genuinely unpredictable numbers. Unlike PRNGs, TRNGs do not
require a seed and produce truly non-deterministic sequences.

3.2 Seeds and Determinism


A seed is an initial value used to start a random number generator. Since most RNGs in computing
are actually pseudorandom, they follow a deterministic sequence based on the seed. This means
that if you use the same seed, you will get the same sequence of random numbers every time.
The seed acts as the starting point for generating numbers, ensuring that the sequence can be
reproduced.

Example: Simple Formula-Based RNG


Consider a simple PRNG that follows this formula:
Next Number = (Previous Number × 3 + 7) mod 100
If we use a seed of 5, the sequence would be:
(5 × 3 + 7) mod 100 = 22
(22 × 3 + 7) mod 100 = 73
(73 × 3 + 7) mod 100 = 26
If we restart the generator with the same seed (5), we will get the same sequence: 22, 73, 26...

Python Demonstration: Same Seed, Same Sequence


import random

Page 11
Network Simulation and Modeling – Combined Lecture Notes

[Link](42) # Set the seed


print([Link](1, 100)) # Output: 82
print([Link](1, 100)) # Output: 15
print([Link](1, 100)) # Output: 4

# Reset seed and generate again


[Link](42)
print([Link](1, 100)) # Output: 82
print([Link](1, 100)) # Output: 15
print([Link](1, 100)) # Output: 4
Since PRNGs are deterministic, setting the same seed will always produce the same sequence
of random numbers.

Different Seed, Different Sequence


[Link](99) # Changing the seed
print([Link](1, 100)) # Output: 9
print([Link](1, 100)) # Output: 78
print([Link](1, 100)) # Output: 28
The sequence is completely different because we changed the seed.

3.3 RNG in Network Simulations


In network simulations, random number generators are used to model real-world uncertainties
like packet delays, traffic patterns, and node failures. A deterministic PRNG ensures that the same
simulation can be reproduced for debugging and analysis.
In a computer network simulation, a packet arrival process and a service process are usually
modeled as random processes. These random processes are implemented with the aid of an
RNG. Two simulations whose RNG picks different initial positions (seeds) would generate
different simulation results.

3.4 Simulating Packet Delays


We can simulate a network where packets experience random delays due to congestion, using a
seeded PRNG to ensure that we can repeat the same simulation.

Using [Link](a, b)
The function [Link](a, b) returns a random floating-point number in the range [a, b],
including decimal values. Unlike [Link](a, b), which gives only whole numbers,
[Link]() allows more realistic delay variations in network simulations. Network delays
are rarely whole numbers (e.g., 12.75 ms, 43.92 ms), so uniform() better represents real-world
behavior.

Code Example: Simulating Network Packet Delays


import random

Page 12
Network Simulation and Modeling – Combined Lecture Notes

# Set a fixed seed for reproducibility


[Link](123)

# Simulating delays for 5 packets (in milliseconds)


for i in range(5):
delay = [Link](10, 100) # Random delay between 10ms and 100ms
print(f"Packet {i+1} delay: {delay:.2f} ms")

3.5 Simulating Packet Loss


Packet loss occurs when some packets never reach their destination due to network congestion,
hardware failure, or interference. We can simulate this by randomly dropping packets based on a
probability threshold.

Code Example: Packet Loss Simulation


import random

[Link](42) # Set seed for reproducibility


packet_loss_probability = 0.2 # 20% chance of packet loss

# Simulate 10 packets being sent


for i in range(10):
if [Link]() < packet_loss_probability: # 20% chance to drop
print(f"Packet {i+1}: LOST")
else:
delay = [Link](10, 100) # Random delay in ms
print(f"Packet {i+1}: Delay {delay:.2f} ms")

3.6 Simulating Network Congestion


Congestion happens when too much traffic is being sent through the network, leading to higher
delays and more packet loss. The following simulation models increasing congestion over time,
with both the packet loss probability and delay range increasing as congestion rises.

Code Example: Congestion Simulation


import random

[Link](42) # For reproducibility


base_loss_probability = 0.1 # 10% base packet loss
max_loss_probability = 0.5 # 50% max loss under congestion
base_delay_range = (10, 100) # Normal delay range in ms
congested_delay_range = (50, 300) # Higher delay during congestion
num_packets = 10

Page 13
Network Simulation and Modeling – Combined Lecture Notes

for i in range(num_packets):
congestion_level = i / num_packets # Increase congestion (0 to 1)

# Increase loss probability as congestion rises


packet_loss_probability = base_loss_probability + \
congestion_level * (max_loss_probability - base_loss_probability)

# Higher congestion = higher delays


delay_range = base_delay_range if congestion_level < 0.5 \
else congested_delay_range

if [Link]() < packet_loss_probability:


print(f"Packet {i+1}: LOST (Congestion Level
{congestion_level:.2f})")
else:
delay = [Link](*delay_range)
print(f"Packet {i+1}: Delay {delay:.2f} ms (Congestion Level
{congestion_level:.2f})")

3.7 Reliability of Simulation Results


When we say that the simulation results are usually deemed sufficiently reliable, it means that the
outcomes generated by the simulation are generally considered accurate enough for decision-
making, analysis, or further use.

What Determines Reliability?


The reliability of simulation results depends on several factors:
1. Model Accuracy: The simulation must be based on a well-defined model that correctly
represents the real-world system being studied. If the assumptions and equations used
in the model are incorrect, the results will be unreliable.
2. Verification: Ensures that the simulation is correctly implemented (i.e., the model is
programmed correctly without software errors).
3. Validation: Checks whether the model produces results that match real-world data or
expected behavior.
By ensuring model accuracy, proper verification, and thorough validation, researchers can
produce simulation results that are statistically sound and practically useful for network design
and optimization.

Page 14

You might also like