2. UNIT I
INTRODUCTION TO MODELING AND SIMULATION
Introduction, Discrete-event Simulation, Modeling for Computer
Simulation, Tools and Methods for Network Simulation, The
Simulation Platform, Simulation Framework, Tools and Modeling
Approaches for Simulating Hardware. Analog & Digital Simulation,
Real Time Simulation, Hybrid Simulation, Advantages & Limitations
of Simulation.
3. Introduction
• In general there are three different techniques for performance evaluation of
systems and networks :
Mathematical analysis
Measurements
Computer simulation
• In a computer simulation a real-world process or system is "imitated"
over time.
• Different types of computer simulations
discrete-event simulation
continuous simulation
Monte Carlo simulation
spreadsheet simulation
trace-driven simulation and etc
4. Introduction
• In the field of computer networks the dominant simulation technique is
“discrete-event simulation”
• key property of discrete-event simulations is that the state of the
simulation model can only change at discrete points in time which are
referred to as “events” .
• Used to do research on all layers of computer networks, including
signal processing issues in the physical layer
medium access in the link layer
routing in the network layer
protocol issues in the transport layer
design questions of the application layer
• provides a simple and flexible way to evaluate their approaches and study
their behavior under different conditions.
• Repeatability - different designs can be evaluated under exactly the same
(random) environment parameters.
5. Discrete event Simulation
• Core algorithm for a discrete event simulator - the time advance event
scheduling algorithm
6. Terminology and Components of
Discrete event Simulation
• Entity is an abstraction of a particular subject of interest. An entity
is described by its attributes, e.g., an entity packet could have attributes
length, source address, and destination address. Often referred as object
• System is defined by a set of entities and their relationship. The set of
entities and their relationships fulfill a certain purpose, i.e., the system has a
certain goal that it tries to achieve
• Discrete System is a system whose state, defined by the state of all
entities of the system, changes only at discrete points in time. The change of
the state is triggered by the occurrence of an event
• Model is an abstraction of the system, hence it consists of selected entities of
the system of interest and selected relationships between the entities.
7. Principle of Discrete event Simulation
• The idea - to jump from one event to the next - occurrence of an event may
trigger changes in the system state as well as the generation of new
• Events are recorded as event notices in the future event list (FEL)
• Event notice is composed at least out of two data (time, type)
TimeTime - specifies the time when the event will occur
TypeType - gives the kind of the event
• FEL - should implement efficient functions to insert, to find, and to remove
event notices, which are placed in the future event list.
8. • All discrete-event simulators share the following components:
System stateSystem state - A set of variables that describe the state of the system.
ClockClock - The clock gives the current time during the simulation
Future event listFuture event list - A data structure appropriate to manage the events.
Statistical countersStatistical counters - A set of variables that contain statistical information
about the performance of the system
Initialization routineInitialization routine - A routine that initializes the simulation model and
sets the clock to 0
9. Timing routineTiming routine - A routine that retrieves the next event from the future
event list and advances the clock to the occurrence time of the event.
Event routineEvent routine - A routine that is called when a particular event occurs
during the simulation. Usually, for each event type an event routine is
defined.
Often referred to as “handler “
10. Flow diagram of the core of a discrete-event simulator, i.e., the event
scheduling time-advance algorithm
11. • It consists of three parts:
Initialization
Event processing loop
Output.
• Initialization partInitialization part - the clock, entities, and state variables are initialized
• LoopLoop - the events are processed - the next event is retrieved from the future
event list and depending on its type a particular event routine (the handler )
is called.
event routine may change the state variables , entities , update statistics ,
and generate new event notices
When the termination condition of the loop is valid the simulation enters the
last part
• Output partOutput part - statistics are finally computed and if necessary written into
files.
12. Starting and Stopping of Simulations
• FEL is empty at the beginning of the simulation
• Initial event notices are generated and put into the future event list
• The termination of a simulation is typically based on:
Special termination event, e.g., until a packet delay larger than 500 ms,
1000 bytes are transmitted, or 50 dropped packets.
Specified simulation time, e.g., simulation for 1000 sec
Until the future event list gets empty.
13. Types of Simulation Runs
• Simulation runs - classified into
Transient and
Steady state simulations
• Transient simulationTransient simulation - referred as terminating simulation, because in this
case the simulation runs for a defined simulation time
• Steady stateSteady state simulationsimulation - referred as non-terminating simulation.
The goal in this kind of simulation is to study the long-term behavior of the
system
A critical issue is to figure out suitable simulation run times.
14. Modeling for Computer Simulation
• If computer simulation is chosen as evaluation method, two further issues
(i) Once a performance model is built, it has to be implemented in
software.
(ii) Therefore, an appropriate tool needs to be chosen that suites the
evaluation process well.
Good Performance Models and Good Simulation Models
Simplicity
Credibility - validation
Documentation
Efficiency
Verified
Code Quality
Availability
15. Tools and Methods for Network
Simulation
• networks of computing devices grow larger and more complex
• highly accurate and scalable network simulation technologies becomes
critical
• large-scale test beds for network research – plays vital role in terms of -
scalability
reproducibility, rapid prototyping, and education
• One of the fundamental goals in the ns–3 design was to improve the realism of
the models
16. Modeling the Network Elements in ns–3
• Network nodes
• Network devices
• Communications channels
• Communications protocols
• Protocol headers
• Network packets
17. The Simulation Platform
• simulation platform of openWNS, which includes the core components of an
event- driven stochastic simulation tool
• basis for the simulation framework and simulation modules
18. • Event Scheduler - C++ functions
• Random Distributions - random number generator is based on the Mersenne
Twister algorithm - The algorithm provides a period of of 2^19937 −1
and passed a number of stringent statistical tests.
• Configuration - Python language is used for configuration of simulation scenarios
–
• Evaluation -
19. SIMULATION FRAMEWORK
Simulation Model
need to simulate both, simple queueing systems as well as complex simulation
scenarios with an entirely equipped protocol stack.
Each simulation is defined through the simulation model which specifies two
basic methods: start() and shutdown() .
Node - Component Model
•allows for the flexible specification of protocol stacks
•Each Node contains a set of components which represent the protocol layers,
equivalent to protocol layers of the ISO/OSI reference model
20. Layer Development Kit
Protocol layer development is often the fundamental step of developing an
open WNS module.
Protocol layers in open WNS correspond to ISO/OSI layers and are subdivided into
Functional Units
FUCTIONAL UNIT NETWORKS
21. Simulation Modules
presents the simulation modules included in open WNS
Starting with the channel and interference modeling , the WiMAX and WiFi data link
layer modules are presented
(i) RISE - Radio Interference Simulation Engine
channel model is used to calculate total received signal strength for every
transmission by using the formula
Pt – txed power Pr – Rxed power L- path loss Gt & Gr – Antenna gain @ tx & rx
22. Several models to calculate the path loss between transmitter and receiver
are available.
Constant (distance independent)
Free space
Single slope
Multi slope
Different shadowing models to describe the scenario are available
Map based
Scenery object based
Spatially correlated log-Normal
(ii) IEEE 802.11 WLAN
(iii) IEEE 802 . 1 6 WiMAX
(iv) TCP/ IP Module
(v) Traffic Models
24. Tools and Modeling Approaches for
Simulating Hardware and Systems
• Need for System Models
(1)timing, deadlines and system load
(2) Energy consumption
(3) memory usage
(4) task placement at design and run-time
Instruction Set Simulation (ISS) - allows to imitate the behavior of an
Instruction Set Architecture (ISA) - e.g., a processor core
This technique can be further subdivided:
Cycle accurate ISS. Cycle accurate ISS operates on the granularity of
processor core cycles.
Instruction accurate ISS. Instruction accurate ISS operates on the granularity of
instructions
25. • Time based annotation of simulation models - Simulation models are
instrumented with system properties like processing time
26. ISS based Techniques
• allows to imitate the behavior of an Instruction Set Architecture (ISA)
• used to analyze the performance of a given hardware platform during the design
of new processor architectures or embedded systems
• Principle ----
A given executable is initially loaded into the memory of the Instruction Set
Simulator
During simulation the simulator sequentially fetches an instruction from memory,
decodes it for the targeted ISA and mimics the behavior of the target processor
core by executing the instruction on the host machine
28. Pipeline Principle
• found in nearly all modern processor cores and is a common principle to increase
the overall throughput
• Common processor architectures such as the Cortex-R4 ARM processor have an
8-stage pipeline whereas general purpose processors from Intel and AMD
contain 10 to 20 pipeline stages
• hazards can be classified as control hazards and data hazards – especially read-
after-write (RAW), write-after-write (WAW), and write-after-read (WAR) hazards
30. Cycle Accurate ISS
• each instruction is processed within its current pipeline stage and passed to the
next stage in the following cycle.
• repeats till the instruction has completely propagated through the pipeline
• sensitive to the clock of the processor , each pipeline stage is executed based on
the current instruction.
31. Instruction Accurate ISS
• today’s embedded systems more and more processor cores are applied
• simulators of the targeted system have to achieve high simulation speeds, which
run at real-time or at least close to that
• ISSs achieving high simulation speeds which can be combined to so called Virtual
Platforms (VPs)
• VPs model complete System-on-Chips (SoCs) including processor cores along with
the system’s peripherals such as USB, Ethernet and VGA-output devices.
33. REAL TIME SIMULATION
• refers to a computer model of a physical system that can execute at the same
rate as actual "wall clock" time
• the computer model runs at the same rate as the actual physical system
34. Advantages of Simulation
• biggest of these advantages is money – no need for Designing, building, testing,
redesigning, rebuilding, retesting
• simulation testing is cheaper and faster than performing the multiple tests of the
design each time
• simulation can give you results that are not experimentally measurable with our
current level of technology
35. Disadvantages
• simulation errors - incorrect key stroke has the potential to alter the results of
the simulation and give you the wrong results
• we are programming using theories of the way things work not laws and theories
are not often 100% correct
• Many people do not consider what they do engineering unless they can see,
hear, feel, and taste the project