Mannasim Framework

Using Mannasim Framework

As usual in a ns-2 wireless simulation, to simulate a wireless sensor network (WSN) with the Mannasim Framewor, the first step is to create a simulation scenario, its topography and a trace file. Itīs also necessary to create the general operations director (god) object.

set ns_	[new Simulator]                 ;# simulation object
set traceFile [open trace.tr w]         ;# trace file
$ns_ trace-all $traceFile               ;# attach trace to simulation
$ns_ use-newtrace                       ;# use new trace format
set topo [new Topography]               ;# simulation topology
$topo load_flatgrid $val(x) $val(y)     ;# flat topology
create-god $val(nn)                     ;# god

Antenna and physical layer configurations should be set too. Ns-2 OmniAntena and WirelessPhy objects provides a good abstraction to WSN simulation. The box bellow shows an omminidirectional antenna 1.5 meters above the ground and a Lucent Radio physical layer.

# Unity gain, omni-directional antennas set up the antenas to be
# centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0

The next step is to adjust a bunch of parameters placed in the "val" vector, a de facto standard in ns-2 simulation scripts. Parameters included in this vector are, for example, simulation start and stop times, routing protocol used, number of nodes in the network, etc. See the box bellow.

set val(chan)	 Channel/WirelessChannel  ;# channel type
set val(prop)	 Propagation/TwoRayGround ;# radio-propagation model 
set val(netif)	 Phy/WirelessPhy          ;# network interface type
set val(mac)	 Mac/802_11               ;# MAC type
set val(ifq)	 Queue/DropTail/PriQueue  ;# interface queye type
set val(ll) 	 LL                       ;# link layer type
set val(ant)	 Antenna/OmniAntenna      ;# antenna model
set val(ifqlen)	 200                      ;# max packet in ifq
set val(rp)      AODV	                  ;# routing protocol 
set val(x)       30.0                     ;# scenario X dimension  
set val(y)       30.0                     ;# scenario Y dimension 
set val(start)   5.0                      ;# simulation start time
set val(stop)	 3605.0                   ;# simulation stop time
set val(energy)  10.0                     ;# initial energy (joules)
set val(rx)      0.024                    ;# reception energy
set val(tx)      0.045                    ;# transmission energy
set val(idle)    0.000                    ;# idle energy
set val(nn)      22                       ;# total number of nodes

All these settings creates the ground for a WSN simulation. The Mannasim Framework on the other hand provides standardized structures for common sensor, cluster heads and access point nodes. It also contains a battery data generators and processing modules.

In the following pages it's going to be shown how the user creates access points, cluster heads and common nodes.