Title: A comparison of the architecture of network simulators NS2 and TOSSIM Seminar Performance Simulation
1A comparison of the architecture of network
simulators NS-2 and TOSSIMSeminar
Performance Simulation of Algorithms and
ProtocolsStudienprojekt CUBUSMichael Karl
2Overview
- Introduction and Motivation
- Architecture of TOSSIM
- What is TOSSIM?
- Architectural overview
- Component Graphs
- Events
- Models
- Communication Services
- Visualization Tool
- Conclusion
- Architecture of NS-2
- What is NS-2 ?
- Architectural Overview
- Network Components
- Event Scheduler
- Languages
- - Otcl / Tclcl / Tcl 8.0
- Visualization Tool
3Introduction and motivation
- Introduction
- Network simulation has a long history
- Most network simulators have some drawbacks
- Network simulators have widely varying focuses
- Motivation (in general)
- Study of the architecture of network simulators
offers insight into their design, functions and
working method. - Motivation (for the Studienprojekt CUBUS)
- We need to know how other network simulators are
designed and how they are working to develop and
understanding of how to design CUBUS - Understanding of their structure is essential for
beeing competitive with them and achieving better
performance results
4What is TOSSIM?
- TOSSIM
- A discrete event simulator for TinyOS wireless
sensor networks - TOSSIM and TinyOS were developed at UC Berkeley
- Can simulate thousands of nodes simultaneously
- Every mote in a simulation runs the same TinyOS
program - Provides configurable debugging output
- TinyOS
- stands for Tiny Microthreading Operating System
- Sensor network operating system
- runs on sensor nodes, so-called motes
5Architectural overview on TOSSIM
- TOSSIM architecture is composed of 5 parts
- TinyOS Component Graphs
- Execution Model (Events)
- Hardware abstraction components
- Models (Radio and ADC Models)
- Communication Services
6TinyOS Component Graphs
command
event
- A TinyOS program is a graph of components
(component graph). - Each TinyOS component has
- - a frame
- - a structure of private variables
- - three computational abstractions
- - Commands, events and tasks
- Commands and events
- - are mechanisms for inter-component
communication - Tasks
- - are used to express intra-component
concurrency.
- A command is typically a request to a component
to perform some service. - An event signals the completion of that service.
7Execution Model (Events)
- Events
- A simulator event queue sits at the core of
TOSSIM. - This event queue delivers the interrupts that
drive the execution of a
TinyOS application. - TOSSIM models each TinyOS interrupt as a
simulation event. - Simulator events run atomically with respect to
one another. - After each simulator event executes, TOSSIM
checks the task queue for any pending tasks, and
executes all of them in FIFO (First-In,
First-Out) scheduling order. - When a simulator event calls an interrupt handler
(in the TOSSIM hardware abstraction components)
the interrupt handler signals TinyOS events and
calls TinyOS commands. - These TinyOS events and commands again post tasks
and cause further simulator events to be
enqueued, driving execution forward.
8Models (Radio and ADC Models)
- The TOSSIM architecture include two different
models - Radio models for all kinds of transmission
aspects and - ADC models for the Analog-Digital-Converter.
- Radio Models
- TOSSIM uses a very simple abstraction for a
network signal, it is either a one or a
zero. - All transmission signals have equal strength.
- Collision is modeled as a logic OR.
- Disadvantage Distance does not effect signal
strength. - TOSSIM provides two built-in radio models
- the simple radio model
- the lossy radio model
9Radio Models
- simple
- places all of the nodes in a single radio cell
- every bit transmitted is received error-free
- no bits are corrupted due to error
- Disadvantage two motes transmitting at the same
time can - lead to problems
- lossy
- places the nodes in a directed graph with bit
error probabilities - Each edge (u, v) in the graph means that the
signal of node u can be heard by node v. - Every edge has a weight that indicates the
probability that a bit sent by node u will be
corrupted (and therefore flipped) when node v
hears it.
10ADC Models (1)
- ADC Models
- ADC stands for Analog-Digital-Conversion.
- An Analog-Digital-Conversion is an electronic
process in which a continuously variable (analog)
signal is changed, without altering its essential
content, into a multi-level (digital) signal. - TOSSIM provides two ADC models
- random and
- generic
11ADC Models (2)
- random
- The ADC has several channels that can be sampled.
- If any of the channels are sampled, it returns a
10-bit random value. - generic
- has the functionality of the random model but in
addition to that - provides also the possibility to be actuated by
external applications - By using the TOSSIM control channel, external
applications can set the value for any ADC port
on any mote. - TinyViz does this through the ADC plugin.
12Hardware abstraction components
- Hardware abstraction components
- The TinyOS operating system running on motes
abstracts each hardware resource as a component. - TOSSIM takes advantage of that by replacing only
a small number of these components (such as the
ADC, the Clock, the EEPROM, etc.). - TOSSIM emulates the behavior of the underlying
raw hardware. - TOSSIM models these components in the hardware
abstraction components part of the architecture.
13Communication Services
- Tossim
- provides mechanisms that allow PC-application to
communicate with TOSSIM - this happens via TCP/IP
- has a command/event interface that mediates
between PC applications and the simulation. - TOSSIM signals events to applications, providing
data on a running simulation - Applications call commands on TOSSIM to actuate a
simulation or modify its internal state.
response
signals events
signals events
Command/event interface
TOSSIM
PC application
calls commands
calls commands
request
14Visualization Tool
Interactive plugins
- Tiny Viz
- is a visualization and actuation environment for
TOSSIM - Java-based graphical user interface application
- can be attached to a running simulation
- Uses a plug-in architecture to allow for
expansion - Provides debugging and visualization output
- Interacts with Tossim simulations of TinyOS
applications
- Plugins
- ADC Readings
- Debug messages
- Sent radio packets
Simulation visualization
15What is NS-2?
- ns2 stands for network simulator (ver 2)
- Discrete event simulator targeted at networking
research. - Focuses on the simulation of IP networks on the
packet level. - Wired and wireless
- Object-oriented Tcl (Otcl) script interpreter
with network simulation object libraries.
16Architectural overview on NS-2
- NS architecture is composed of 5 parts
- Discrete event scheduler
- Data network (the Internet) components
- Tclcl C and otcl linkage
- OTcl Object-oriented support
- Tcl8.0 scripting language
Event Scheduler
ns-2
Tclcl
Network Component
OTcl library
Tcl8.0
17Discrete Event Scheduler
- Event scheduler
- to drive the execution of the simulation,
- to process and schedule simulation events
- For network components that simulate
packet-handling delay or that need timers.
18Network Components
- Class hierarchy
- NS models all network elements through a class
hierarchy. - TclObject class is the superclass of all OTcl
library objects (network components, event
scheduler, timers and others). - NsObject again is the superclass of all basic
network component objects that handle packets. - Connector is the superclass of all basic
network objects that have only one output data
path and - Classifier is the superclass of all switching
objects that have possible multiple output data
paths.
- Network objects, such as nodes and linkes can
then be composed of this basic network
components.
19C and OTcl Separation
- data / control separation NS separates the
control and data path because of efficiency
reasons. - C for data
- per packet procssing, core of ns
- fast to run, detailed, complete control
- OTcl for control
- Simulation scenario configurations
- Periodic or triggered action
- Manipulating existing C objects
- fast to write and change
- Advantage running vs. writing speed
- Disadvantage Learning and debugging (two
languages)
20OTcl and C The Duality
the compiled objects are made available
to the OTcl interpreter
- Otcl and C
- OTcl and C share class hierarchy.
- The compiled C objects are made available to
the OTcl interpreter through an OTcl Linkage. - The OTcl linkage creates a matching OTcl object
for each of the C objects. - In this way, the controls of the C objects are
given to OTcl.
the event scheduler and the basic network
component objects in the data path
C objects data path handling OTcl Objects
control path handling
21Visualization Tool
- Nam
- stands for network animator
- The NS visualization tool
- visualizes ns (or other) output
- only visualization, no actuation or generation of
simulation prgram - only animation of simulation output
- -gt Nam editor GUI interface to generate ns
scripts
22Conclusion
- What is different?
- The network simulators NS-2 and TOSSIM focus on
different aspects and have therfore totally
different architectures - - NS-2 focuses on the simulation of network
nodes at the packet level. - - TOSSIMs approach is to simulate the TinyOS
sensor networks at bit - level granularity.
- What do they have in common?
- Both simulators have some kind of event handling
mechanism to cope with the processing of events. - - TOSSIM Discrete event queue
- - NS-2 Event scheduler
23Thanks for your attention
Questions?