Wired network simulation in ns2

The departments supported by our organizations are as follows: Computer science, information Technology, Electronic and communication, and electrical engineering. These department students are doing their final year project with our guidance. We are also encouraging the students innovative thought which are implemented by us in their projects. This is one of our added features which came us to a market leading organization in project and research development. The Adhoc routing protocol is changed to DSDV. Also, in the script itself we also define TCP and CBR connections between the wired and wireless nodes. The connection pattern file used in earlier simulation is not used in our Wired network simulation in ns2. The simulation stop time also changed in our Wired network simulation in ns2. Note here that we use array opt() instead of val() simply to illustrate that this is no longer a global array variable and its scope is defined only in the test script.

set opt(adhocRouting)   DSDV

set opt(cp)              “”       ;# cp file not used

set opt(stop)           300     ;# time to stop simulation

We define the start times for TCP flows here in Wired network simulation in ns2:

set opt(ftp1-start)     160.0

set opt(ftp2-start)     170.0

Also add the following line to define number of wired and base-station nodes in Wired network simulation in ns2:

set num_wired_nodes     2

set num_bs_nodes         1

Now we move to the main part of the program. The hierarchical routing in order to route packets between wireless and wired domains should use the mixed simulations. The routing information for wired nodes is based on connectivity of the topology in Wired network simulation in ns2. The nodes are connected to one another through Links in the topology. Using adhoc routing protocols the packets are routed in a wireless topology which build forwarding tables by exchanging routing queries among its neighbors. In Wired network simulation in ns2 base-stations which act as gateways between the two domains. We segregate in Wired network simulation in ns2 in different domains we are placing the wired and wireless nodes. By means of hierarchical topology structure the domains and sub-domains (or clusters as they are called here) are defined as shown below. After line “set ns [new Simulator]”, add the following lines in Wired network simulation in ns2:

$ns_ node-config -addressType hierarchical

AddrParams set domain_num_ 2           ;# number of domains

lappend cluster_num 2 1               ;# number of clusters in each

;#domain

AddrParams set cluster_num_ $cluster_num

lappend eilastlevel 1 1 4             ;# number of nodes in each cluster

AddrParams set nodes_num_ $eilastlevel ;# for each domain

We first configure the node object in Wired network simulation in ns2 to have addresstype as Hierarchical. The topology hierarchy is defined next in Wired network simulation in ns2. In this Wired network simulation in ns2 topology the number of domains is 2 (one for the wired nodes and one for the wireless) is used. The “2 1” defines number of clusters in each of these domains which indicates the first domain (wired) to have 2 clusters and the second (wireless) to have 1 cluster. The number of nodes in each of these clusters which is “1 1 4” is defined in the next line of code. i.e one node in each of the first 2 clusters (in wired domain) and 4 nodes in the cluster in the wireless domain. So Wired network simulation in ns2 topology is defined into a 3-level hierarchy (see the topology figure above).