Hosting

Web hosting is a service of providing online space for storage of web pages. These web pages are made available via World Wide Web. The companies which offer website hosting are known as Web hosts. The servers on which web site is hosted remain switched on 24 x7. These servers are run by web hosting companies. Each server has…

Read More

Find shortest path

identify shortest path routing, sample tcl code   set dd 2 set st 0 set cr 1 set si [list] set now [$ns now] set m 0 for {set j 0} {$j < 25 } {incr j} {   set sre [lsearch $ne_ig “$j”] set sre1 [lsearch $to_do “$j”]   set a [ expr $X1($j)-$X1($ne)]…

Read More

Find Neighbor nodes

Step 1: Calculate distance between nodes Step 2: Fix a threshold of maximum radius for example, distance >=250 Step 3: Filter nodes with above condition is the neighbors set k 0 set p 0 for {set j 0} {$j < $val(nn) } {incr j} { set a [ expr $X1($j)-$X1($i)] set b [ expr $a*$a]…

Read More

Writing neighbors to a file

Neighbor of nodes can be detected by distance formulae and this can be written in a file For that first create a file using following statement set out1 [open neighbour w] Then Fine neighbors, read this page   Then following code used to write neighbor in a file set a1 [ expr $count(0)+$count(1)] set b1…

Read More

Calculate distance between nodes

Distance between two nodes can be calculated using distance formulae Distance = sqrt[(X2-X1)*(X2-X1) +(Y2-Y1)*(Y2-Y1)] for {set j 0} {$j < $val(nn) } {incr j} { set a [ expr $X1($j)-$X1($i)] set b [ expr $a*$a] set c [ expr $Y1($j)-$Y1($i)] set d [ expr $c*$c] set e [ expr $b+$d] set f 0.5 set g…

Read More

Represent topology

How to represent topology type in ns2 project is given below set topo [new Topography] ;#??topography object The below line represents 2D topology called flat grid $topo load_flatgrid $val(x) $val(y) Then create a new instance for god (General Operations Director) object create-god $val(nn)

Read More

Configure static node or mobile node in ns2 project

sample code for creating nodes in ns2 tcl file   $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channel $chan0 \ -topoInstance $topo \ -agentTrace OFF \ -routerTrace OFF \ -macTrace ON \ -movementTrace OFF then configure…

Read More

How to Assign routing protocol in TCL file

Routing protocol is always assigned in wireless or wired network creation code. For example, if we are using OLSR routing protocol, we may define it like following code set val(adhocRouting) OLSR if we are using AODV routing protocol, we may define it like following code set val(adhocRouting) AODV if we are using LEACH as routing…

Read More

New Wireless Network Creation in NS2

Wireless network creation in ns2 involves 13 main steps configuration. This includes assigning a Channel Type, propagation model, interface type and MAC type, number of nodes, routing protocol used for communication between nodes, X-axis and Y-axis configuration for network animator (nam) and finally assign the simulation time, these values are assigned in a TCL file…

Read More