+ All Categories
Home > Documents > Lab Assignment Report Template MS Office

Lab Assignment Report Template MS Office

Date post: 07-Apr-2018
Category:
Upload: harsha-balam
View: 224 times
Download: 0 times
Share this document with a friend
30
CpE/EE/SysEngg 348 WIRELESS NETWORKS Exam 3 Report page 1 <Name of the author> 1. INTRODUCTION This lab experiment deals with a scenario where the network has two foreign agents, one home agent, one mobile node arranged in a fashion seen in cellular networks. In case 1, the mobile node is made to move around the centre point of the network in a square shaped path. In case 2 the mobile node is placed at the centre point without any motion and the traffic patterns are observed. Ca se 2 deals with two types of propagation: Two Ray Propagation Shadowing Propagation The placement of the nodes are decided according to the gaps mentioned in the network diagram Initially the location of HA is assumed as (250,250) and based on that the locations of other nodes are calculated. The co-ordinates are: Case 1 and case 2: HA: (250,250) FA1: (665.7,250) FA2: (457.85, 610) C: (457.85,370) The mobile node destinations are: (432.85,345), (482.85,345), (482.85, 395), (432.85,395) In the case where R = 200, the new co ordinates are HA: (250,250) FA1: (596.41,250) FA2: (423.20,550) C: (423.20,350) The mobile node destinations are: (398.20,325), (448.20,325), (448.20,375), (398.20,375) .
Transcript

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 1/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 1

<Name of the author>

1. INTRODUCTION

This lab experiment deals with a scenario where the network has two foreign agents, onehome agent, one mobile node arranged in a fashion seen in cellular networks. In case 1,the mobile node is made to move around the centre point of the network in a squareshaped path. In case 2 the mobile node is placed at the centre point without any motionand the traffic patterns are observed. Case 2 deals with two types of propagation:

Two Ray Propagation

Shadowing Propagation

The placement of the nodes are decided according to the gaps mentioned in the network diagram

Initially the location of HA is assumed as (250,250) and based on that the locations of other nodes are calculated.

The co-ordinates are:

Case 1 and case 2:

HA: (250,250)

FA1: (665.7,250)

FA2: (457.85, 610)

C: (457.85,370)

The mobile node destinations are:

(432.85,345), (482.85,345), (482.85, 395), (432.85,395)

In the case where R = 200, the new co ordinates are

HA: (250,250)

FA1: (596.41,250)

FA2: (423.20,550)

C: (423.20,350)

The mobile node destinations are:

(398.20,325), (448.20,325), (448.20,375), (398.20,375)

.

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 2/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 2

2. RESULTS AND DISCUSSION

2.1. Create simulation script (TCL) for the described scenario

The TCL files are attached in the appendix.

2.2. Generate plots with throughout and end-to-end delay over time

Case 1

Figure 1. Plot of all the throughputs overlayed onto each other

Figure 2. End-to-end delay over simulation event time

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 3/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 3

Case 2

Two ray propagation:

Figure 3. Plot of the throughputs of the mobile node (case 1 – Two ray model)

Figure 4. End-to-end delay over simulation event time (case 2 – tworay model)

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 4/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 4

Figure 5. Plot of the throughputs of the mobile node (case 2 – Shadowing model)

Figure 6. End-to-end delay over simulation event time (case 2 - shadowing)

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 5/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 5

Part 3:

Figure 7. Plot of the throughputs of the mobile node (case 3 – Shadowing model for part 1)

Figure 8. End-to-end delay over simulation event time (case 3 – shadowing of part 1)

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 6/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 6

Figure 9. Plot of the throughputs of the mobile node (case 3 – Shadowing model for part 1with R = 200)

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 7/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 7

2.3. Comment on the results

From the figure 1 and 2, we can observe that the mobile node enters theregion where handoff takes place at time instants close to 30 seconds, 60

seconds. During this time the thoughput decreases. This is due to the loss of 

signal strength during this period. The change in the delay is also consistent

with that observed in the throughput plot. The delay changes precisely at the

same time instants as the change in the thoughput.

Figure 3 plots the throughputs of the network in the case of Two ray

  propagation model. In this case due to the inherent property of the

 propagation model of the signal being reflected from a surface before beingreceived by the receiver, we observe that the throughput drops during the

time when the node undergoes handoff process. After the handoff processes

have been complete, at about 100 seconds onwards the delay remains

constant but lesser than that during the startup of the network. This is due to

the packets generated for the purpose of the network setup. But in this

scenario, the delay remains almost constant throughout indicating that this

type of propagation is robust in nature and that the handoff process isn’t

changing the delay values. The delay is plotted in figure 4.

Shadowing is the event where a large obstruction such as a hill or large

  building obscures the main signal path between the transmitter and the

receiver. This causes fading in the network. Figures 5 and 6 plot the

throughputs of the system and the corresponding delays in the case where R 

= 240m. The throughput plot indicates that the throughput of the system

drops when the mobile node attempts handoff for the first time at around 30

seconds. After the first handoff process is completed, the throughput again

increases. Though the throughput increases, its not as much as it was during

the network setup time. This indicates that this is due to the more number of 

 packets needed to be generated during the network setup. The delay in this

case is pretty much constant and shows no sign of handoff effect.

Figure 7 and 8 plot the throughput and delay for the case of the system using

shadowing model. The throughput of the system is high initially and then

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 8/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 8

drops down and again raises to a lesser level to that of the throughput during

network setup. This indicates that the network stabilizes after the initialsetup period where there is a large packet overhead and the delay also

changes in accordance with the change in the throughputs. In this case the

value of R is 240.

Plot 9 corresponds to the case where the network uses shadowing model

with R = 200 and the mobile node is moving as in the case of case1.

Comparing plot 7 and 9, we can notice the following things. When the value

of R is decreased, the values of the throughputs are high and they are quite

resistant to the handoff operation. This indicates that if the gap between themobile node and the central point of the network where the signal strength is

highest is less, the system performance is high which is indicated by the

throughput plot

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 9/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 9

3. APPENDIX

TCL File for Part1:

## wireless-mobileIP-simulation

# o W1 WIRED NODES# |# o W2# / \# / \#--*--*--*--*--*--*- o o base-stn nodes --*-*-*-*-*-*-*-# HA FA

# o# o WL o WIRELESS NODE MOVING# WL WL FROM HA TO FA.##

#options

set opt(chan) Channel/WirelessChannelset opt(prop) Propagation/TwoRayGround#set opt(prop) Propagation/Shadowing

set opt(netif) Phy/WirelessPhyset opt(mac) Mac/802_11set opt(ifq) Queue/DropTail/PriQueueset opt(ll) LLset opt(ant) Antenna/OmniAntennaset opt(x) 1000set opt(y) 1000set opt(ifqlen) 50set opt(tr) exam3.tr 

set opt(nn) 1

set opt(adhocRouting) DSDVset opt(cp) ""set opt(sc) ""set opt(stop) 150set num_wired_nodes 2set num_bs_nodes 3

# Propagation/Shadowing set pathlossExp_ 2.2

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 10/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 10

# Propagation/Shadowing set std_db_ 4.0# Propagation/Shadowing set dist0_ 1.0# Propagation/Shadowing set seed_ 0

# create simulator instanceset ns_ [new Simulator]

# set up for hierarchical routing$ns_ node-config -addressType hierarchicalAddrParams set domain_num_ 4lappend cluster_num 2 1 1 1AddrParams set cluster_num_ $cluster_numlappend eilastlevel 1 1 2 1 1

AddrParams set nodes_num_ $eilastlevel

set tracefd [open $opt(tr) w]$ns_ trace-all $tracefd$ns_ use-newtrace

set topo [new Topography]$topo load_flatgrid $opt(x) $opt(y)# 2 for the FA / the HAcreate-god [expr $opt(nn) + 3]

#create wired nodesset temp {0.0.0 0.1.0}for {set i 0} {$i < $num_wired_nodes} {incr i} {

set W($i) [$ns_ node [lindex $temp $i]]}#Configure for ForeignAgent and HomeAgent nodes$ns_ node-config -mobileIP ON \

-adhocRouting $opt(adhocRouting) \-llType $opt(ll) \-macType $opt(mac) \-ifqType $opt(ifq) \-ifqLen $opt(ifqlen) \

-antType $opt(ant) \-phyType $opt(netif) \-propInstance [new $opt(prop)] \-channel [new $opt(chan)] \-topoInstance $topo \-wiredRouting ON \-agentTrace ON \-routerTrace OFF \

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 11/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 11

-macTrace OFF

# Create HA and FAset HA [$ns_ node 1.0.0]set FA1 [$ns_ node 2.0.0]set FA2 [$ns_ node 3.0.0]$HA random-motion 0$FA1 random-motion 0$FA2 random-motion 0# Position (fixed) for base-station nodes (HA & FA).$HA set X_ 250.000000000000$HA set Y_ 250.000000000000$HA set Z_ 0.000000000000

$FA1 set X_ 665.7.000000000000$FA1 set Y_ 250.000000000000$FA1 set Z_ 0.000000000000

$FA2 set X_ 457.85.000000000000$FA2 set Y_ 610.000000000000$FA2 set Z_ 0.000000000000

$ns_ node-config -wiredRouting OFFset MH [$ns_ node 1.0.2]

set node_(0) $MHset HAaddress [AddrParams addr2id [$HA node-addr]]puts "MH 1.0.2 HSAddr=$HAaddress [$HA node-addr]"puts "FA2 3.0.0 FA2Addr=$HAaddress [$HA node-addr]"[$MH set regagent_] set home_agent_ $HAaddress

$MH set X_ 432.85000000000000$MH set Y_ 345.000000000000$MH set Z_ 0.000000000000

# MH starts to move towards bottom right corner $ns_ at 25.000000000000 "$MH setdest 482.850000000000 \

345.000000000000 2.000000000000"

# MH starts to move towards top right corner $ns_ at 50.000000000000 "$MH setdest 482.850000000000 \

395.000000000000 2.000000000000"

# MH goes top left corner # $ns_ at 75.000000000000 "$MH setdest 432.85000000000000 \

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 12/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 12

# 395.000000000000 2.000000000000"

# create links between wired and BaseStation nodes$ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail$ns_ duplex-link $W(0) $FA2 5Mb 2ms DropTail$ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail$ns_ duplex-link $W(1) $FA1 5Mb 2ms DropTail

$ns_ duplex-link-op $W(0) $W(1) orient down$ns_ duplex-link-op $W(1) $HA orient left-down$ns_ duplex-link-op $W(1) $FA1 orient right-down

set tcp1 [new Agent/TCP]

$tcp1 set class_ 2set sink1 [new Agent/TCPSink]$ns_ attach-agent $MH $tcp1$ns_ attach-agent $W(0) $sink1$ns_ connect $tcp1 $sink1set ftp1 [new Application/FTP]$ftp1 attach-agent $tcp1$ns_ at 10.0 "$ftp1 start"

for {set i 0} {$i < $opt(nn)} {incr i} {$ns_ initial_node_pos $node_($i) 20

}for {set i 0} {$i < $opt(nn) } {incr i} {$ns_ at $opt(stop).0000010 "$node_($i) reset"

}$ns_ at $opt(stop).0000010 "$HA reset"$ns_ at $opt(stop).0000010 "$FA1 reset"$ns_ at $opt(stop).0000010 "$FA2 reset"$ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"

 proc finish {} {

global ns_ trace namtrace$ns_ flush-traceclose $namtraceclose $trace

#puts "running nam..."#exec nam out.nam &

puts "Finishing ns.."

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 13/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 13

exit 0}

#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)" puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

 puts "Starting Simulation..."$ns_ run

TCL File for Part 2: 

Two ray ground model:

## wireless-mobileIP-simulation

# o W1 WIRED NODES# |# o W2# / \# / \#--*--*--*--*--*--*- o o base-stn nodes --*-*-*-*-*-*-*-# HA FA

# o# o WL o WIRELESS NODE MOVING# WL WL FROM HA TO FA.##

#options

set opt(chan) Channel/WirelessChannelset opt(prop) Propagation/TwoRayGround#set opt(prop) Propagation/Shadowingset opt(netif) Phy/WirelessPhy

set opt(mac) Mac/802_11set opt(ifq) Queue/DropTail/PriQueueset opt(ll) LLset opt(ant) Antenna/OmniAntennaset opt(x) 1000set opt(y) 1000set opt(ifqlen) 50set opt(tr) exam3.tr 

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 14/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 14

set opt(nn) 1set opt(adhocRouting) DSDVset opt(cp) ""set opt(sc) ""set opt(stop) 150set num_wired_nodes 2set num_bs_nodes 3

# Propagation/Shadowing set pathlossExp_ 2.2# Propagation/Shadowing set std_db_ 4.0# Propagation/Shadowing set dist0_ 1.0

# Propagation/Shadowing set seed_ 0

# create simulator instanceset ns_ [new Simulator]

# set up for hierarchical routing$ns_ node-config -addressType hierarchicalAddrParams set domain_num_ 4lappend cluster_num 2 1 1 1

AddrParams set cluster_num_ $cluster_numlappend eilastlevel 1 1 2 1 1AddrParams set nodes_num_ $eilastlevel

set tracefd [open $opt(tr) w]$ns_ trace-all $tracefd$ns_ use-newtrace

set topo [new Topography]$topo load_flatgrid $opt(x) $opt(y)# 2 for the FA / the HAcreate-god [expr $opt(nn) + 3]

#create wired nodesset temp {0.0.0 0.1.0}for {set i 0} {$i < $num_wired_nodes} {incr i} {

set W($i) [$ns_ node [lindex $temp $i]]}#Configure for ForeignAgent and HomeAgent nodes$ns_ node-config -mobileIP ON \

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 15/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 15

-adhocRouting $opt(adhocRouting) \-llType $opt(ll) \-macType $opt(mac) \-ifqType $opt(ifq) \-ifqLen $opt(ifqlen) \-antType $opt(ant) \-phyType $opt(netif) \-propInstance [new $opt(prop)] \-channel [new $opt(chan)] \-topoInstance $topo \-wiredRouting ON \-agentTrace ON \-routerTrace OFF \

-macTrace OFF

# Create HA and FAset HA [$ns_ node 1.0.0]set FA1 [$ns_ node 2.0.0]set FA2 [$ns_ node 3.0.0]$HA random-motion 0$FA1 random-motion 0$FA2 random-motion 0# Position (fixed) for base-station nodes (HA & FA).$HA set X_ 250.000000000000

$HA set Y_ 250.000000000000$HA set Z_ 0.000000000000

$FA1 set X_ 665.7.000000000000$FA1 set Y_ 250.000000000000$FA1 set Z_ 0.000000000000

$FA2 set X_ 457.85.000000000000$FA2 set Y_ 610.000000000000$FA2 set Z_ 0.000000000000

$ns_ node-config -wiredRouting OFF

set MH [$ns_ node 1.0.2]set node_(0) $MHset HAaddress [AddrParams addr2id [$HA node-addr]]puts "MH 1.0.2 HSAddr=$HAaddress [$HA node-addr]"puts "FA2 3.0.0 FA2Addr=$HAaddress [$HA node-addr]"[$MH set regagent_] set home_agent_ $HAaddress

$MH set X_ 457.85000000000000

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 16/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 16

$MH set Y_ 370.000000000000$MH set Z_ 0.000000000000

# MH starts to move towards bottom right corner #$ns_ at 25.000000000000 "$MH setdest 482.850000000000 \

# 345.000000000000 2.000000000000"

# MH starts to move towards top right corner #$ns_ at 50.000000000000 "$MH setdest 482.850000000000 \

# 395.000000000000 2.000000000000"

# MH goes top left corner # $ns_ at 75.000000000000 "$MH setdest 432.85000000000000 \

# 395.000000000000 2.000000000000"

# create links between wired and BaseStation nodes$ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail$ns_ duplex-link $W(0) $FA2 5Mb 2ms DropTail$ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail$ns_ duplex-link $W(1) $FA1 5Mb 2ms DropTail

$ns_ duplex-link-op $W(0) $W(1) orient down$ns_ duplex-link-op $W(1) $HA orient left-down$ns_ duplex-link-op $W(1) $FA1 orient right-down

set tcp1 [new Agent/TCP]$tcp1 set class_ 2set sink1 [new Agent/TCPSink]$ns_ attach-agent $MH $tcp1$ns_ attach-agent $W(0) $sink1$ns_ connect $tcp1 $sink1set ftp1 [new Application/FTP]$ftp1 attach-agent $tcp1$ns_ at 10.0 "$ftp1 start"

for {set i 0} {$i < $opt(nn)} {incr i} {

$ns_ initial_node_pos $node_($i) 20}for {set i 0} {$i < $opt(nn) } {incr i} {$ns_ at $opt(stop).0000010 "$node_($i) reset"

}$ns_ at $opt(stop).0000010 "$HA reset"$ns_ at $opt(stop).0000010 "$FA1 reset"$ns_ at $opt(stop).0000010 "$FA2 reset"

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 17/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 17

$ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"

 proc finish {} {global ns_ trace namtrace$ns_ flush-traceclose $namtraceclose $trace

#puts "running nam..."#exec nam out.nam &

puts "Finishing ns.."

exit 0}

#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)" puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

 puts "Starting Simulation..."$ns_ run

Shadowing:

## wireless-mobileIP-simulation

# o W1 WIRED NODES# |# o W2# / \# / \#--*--*--*--*--*--*- o o base-stn nodes --*-*-*-*-*-*-*-# HA FA

# o# o WL o WIRELESS NODE MOVING# WL WL FROM HA TO FA.##

#options

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 18/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 18

set opt(chan) Channel/WirelessChannel#set opt(prop) Propagation/TwoRayGroundset opt(prop) Propagation/Shadowingset opt(netif) Phy/WirelessPhyset opt(mac) Mac/802_11set opt(ifq) Queue/DropTail/PriQueueset opt(ll) LLset opt(ant) Antenna/OmniAntennaset opt(x) 1000set opt(y) 1000set opt(ifqlen) 50set opt(tr) exam3.tr 

set opt(nn) 1set opt(adhocRouting) DSDVset opt(cp) ""set opt(sc) ""set opt(stop) 150set num_wired_nodes 2set num_bs_nodes 3

Propagation/Shadowing set pathlossExp_ 2.2Propagation/Shadowing set std_db_ 4.0

Propagation/Shadowing set dist0_ 1.0Propagation/Shadowing set seed_ 0

# create simulator instanceset ns_ [new Simulator]

# set up for hierarchical routing$ns_ node-config -addressType hierarchicalAddrParams set domain_num_ 4lappend cluster_num 2 1 1 1AddrParams set cluster_num_ $cluster_numlappend eilastlevel 1 1 2 1 1

AddrParams set nodes_num_ $eilastlevel

set tracefd [open $opt(tr) w]$ns_ trace-all $tracefd$ns_ use-newtrace

set topo [new Topography]$topo load_flatgrid $opt(x) $opt(y)

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 19/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 19

# 2 for the FA / the HAcreate-god [expr $opt(nn) + 3]

#create wired nodesset temp {0.0.0 0.1.0}for {set i 0} {$i < $num_wired_nodes} {incr i} {

set W($i) [$ns_ node [lindex $temp $i]]}#Configure for ForeignAgent and HomeAgent nodes$ns_ node-config -mobileIP ON \

-adhocRouting $opt(adhocRouting) \-llType $opt(ll) \-macType $opt(mac) \

-ifqType $opt(ifq) \-ifqLen $opt(ifqlen) \-antType $opt(ant) \-phyType $opt(netif) \-propInstance [new $opt(prop)] \-channel [new $opt(chan)] \-topoInstance $topo \-wiredRouting ON \-agentTrace ON \-routerTrace OFF \-macTrace OFF

# Create HA and FAset HA [$ns_ node 1.0.0]set FA1 [$ns_ node 2.0.0]set FA2 [$ns_ node 3.0.0]$HA random-motion 0$FA1 random-motion 0$FA2 random-motion 0# Position (fixed) for base-station nodes (HA & FA).$HA set X_ 250.000000000000$HA set Y_ 250.000000000000$HA set Z_ 0.000000000000

$FA1 set X_ 665.7.000000000000$FA1 set Y_ 250.000000000000$FA1 set Z_ 0.000000000000

$FA2 set X_ 457.85.000000000000$FA2 set Y_ 610.000000000000$FA2 set Z_ 0.000000000000

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 20/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 20

$ns_ node-config -wiredRouting OFFset MH [$ns_ node 1.0.2]set node_(0) $MHset HAaddress [AddrParams addr2id [$HA node-addr]]puts "MH 1.0.2 HSAddr=$HAaddress [$HA node-addr]"puts "FA2 3.0.0 FA2Addr=$HAaddress [$HA node-addr]"[$MH set regagent_] set home_agent_ $HAaddress

$MH set X_ 457.85000000000000$MH set Y_ 370.000000000000$MH set Z_ 0.000000000000

# MH starts to move towards bottom right corner # $ns_ at 25.000000000000 "$MH setdest 482.850000000000 \# 345.000000000000 2.000000000000"

# MH starts to move towards top right corner # $ns_ at 50.000000000000 "$MH setdest 482.850000000000 \# 395.000000000000 2.000000000000"

# MH goes top left corner # $ns_ at 75.000000000000 "$MH setdest 432.85000000000000 \# 395.000000000000 2.000000000000"

# create links between wired and BaseStation nodes$ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail$ns_ duplex-link $W(0) $FA2 5Mb 2ms DropTail$ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail$ns_ duplex-link $W(1) $FA1 5Mb 2ms DropTail

$ns_ duplex-link-op $W(0) $W(1) orient down$ns_ duplex-link-op $W(1) $HA orient left-down$ns_ duplex-link-op $W(1) $FA1 orient right-down

set tcp1 [new Agent/TCP]

$tcp1 set class_ 2set sink1 [new Agent/TCPSink]$ns_ attach-agent $MH $tcp1$ns_ attach-agent $W(0) $sink1$ns_ connect $tcp1 $sink1set ftp1 [new Application/FTP]$ftp1 attach-agent $tcp1$ns_ at 10.0 "$ftp1 start"

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 21/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 21

for {set i 0} {$i < $opt(nn)} {incr i} {$ns_ initial_node_pos $node_($i) 20

}for {set i 0} {$i < $opt(nn) } {incr i} {$ns_ at $opt(stop).0000010 "$node_($i) reset"

}$ns_ at $opt(stop).0000010 "$HA reset"$ns_ at $opt(stop).0000010 "$FA1 reset"$ns_ at $opt(stop).0000010 "$FA2 reset"$ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"

 proc finish {} {global ns_ trace namtrace$ns_ flush-traceclose $namtraceclose $trace

#puts "running nam..."#exec nam out.nam &

puts "Finishing ns.."exit 0

}

#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)" puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

 puts "Starting Simulation..."$ns_ run

TCL File for case 3: Shadowing model with R = 200

## wireless-mobileIP-simulation

# o W1 WIRED NODES# |# o W2# / \

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 22/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 22

# / \#--*--*--*--*--*--*- o o base-stn nodes --*-*-*-*-*-*-*-# HA FA# o# o WL o WIRELESS NODE MOVING# WL WL FROM HA TO FA.##

#options

set opt(chan) Channel/WirelessChannel#set opt(prop) Propagation/TwoRayGround

set opt(prop) Propagation/Shadowingset opt(netif) Phy/WirelessPhyset opt(mac) Mac/802_11set opt(ifq) Queue/DropTail/PriQueueset opt(ll) LLset opt(ant) Antenna/OmniAntennaset opt(x) 1000set opt(y) 1000set opt(ifqlen) 50set opt(tr) exam3.tr 

set opt(nn) 1set opt(adhocRouting) DSDVset opt(cp) ""set opt(sc) ""set opt(stop) 150set num_wired_nodes 2set num_bs_nodes 3

Propagation/Shadowing set pathlossExp_ 2.2Propagation/Shadowing set std_db_ 4.0Propagation/Shadowing set dist0_ 1.0

Propagation/Shadowing set seed_ 0

# create simulator instanceset ns_ [new Simulator]

# set up for hierarchical routing$ns_ node-config -addressType hierarchicalAddrParams set domain_num_ 4

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 23/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 23

lappend cluster_num 2 1 1 1AddrParams set cluster_num_ $cluster_numlappend eilastlevel 1 1 2 1 1AddrParams set nodes_num_ $eilastlevel

set tracefd [open $opt(tr) w]$ns_ trace-all $tracefd$ns_ use-newtrace

set topo [new Topography]$topo load_flatgrid $opt(x) $opt(y)# 2 for the FA / the HAcreate-god [expr $opt(nn) + 3]

#create wired nodesset temp {0.0.0 0.1.0}for {set i 0} {$i < $num_wired_nodes} {incr i} {

set W($i) [$ns_ node [lindex $temp $i]]}#Configure for ForeignAgent and HomeAgent nodes$ns_ node-config -mobileIP ON \

-adhocRouting $opt(adhocRouting) \-llType $opt(ll) \-macType $opt(mac) \

-ifqType $opt(ifq) \-ifqLen $opt(ifqlen) \-antType $opt(ant) \-phyType $opt(netif) \-propInstance [new $opt(prop)] \-channel [new $opt(chan)] \-topoInstance $topo \-wiredRouting ON \-agentTrace ON \-routerTrace OFF \-macTrace OFF

# Create HA and FAset HA [$ns_ node 1.0.0]set FA1 [$ns_ node 2.0.0]set FA2 [$ns_ node 3.0.0]$HA random-motion 0$FA1 random-motion 0$FA2 random-motion 0# Position (fixed) for base-station nodes (HA & FA).

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 24/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 24

$HA set X_ 250.000000000000$HA set Y_ 250.000000000000$HA set Z_ 0.000000000000

$FA1 set X_ 596.41000000000000$FA1 set Y_ 250.000000000000$FA1 set Z_ 0.000000000000

$FA2 set X_ 423.20000000000000$FA2 set Y_ 550.000000000000$FA2 set Z_ 0.000000000000

$ns_ node-config -wiredRouting OFF

set MH [$ns_ node 1.0.2]set node_(0) $MHset HAaddress [AddrParams addr2id [$HA node-addr]]puts "MH 1.0.2 HSAddr=$HAaddress [$HA node-addr]"puts "FA2 3.0.0 FA2Addr=$HAaddress [$HA node-addr]"[$MH set regagent_] set home_agent_ $HAaddress

$MH set X_ 398.20000000000000$MH set Y_ 32500000000000$MH set Z_ 0.000000000000

# MH starts to move towards bottom right corner $ns_ at 25.000000000000 "$MH setdest 448.200000000000 \325.00000000000 2.000000000000"

# MH starts to move towards top right corner $ns_ at 50.000000000000 "$MH setdest 448.200000000000 \

375.000000000000 2.000000000000"

# MH goes top left corner $ns_ at 75.000000000000 "$MH setdest 398.20000000000000 \

375.000000000000 2.000000000000"

# create links between wired and BaseStation nodes$ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail$ns_ duplex-link $W(0) $FA2 5Mb 2ms DropTail$ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail$ns_ duplex-link $W(1) $FA1 5Mb 2ms DropTail

$ns_ duplex-link-op $W(0) $W(1) orient down$ns_ duplex-link-op $W(1) $HA orient left-down

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 25/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 25

$ns_ duplex-link-op $W(1) $FA1 orient right-down

set tcp1 [new Agent/TCP]$tcp1 set class_ 2set sink1 [new Agent/TCPSink]$ns_ attach-agent $MH $tcp1$ns_ attach-agent $W(0) $sink1$ns_ connect $tcp1 $sink1set ftp1 [new Application/FTP]$ftp1 attach-agent $tcp1$ns_ at 10.0 "$ftp1 start"

for {set i 0} {$i < $opt(nn)} {incr i} {

$ns_ initial_node_pos $node_($i) 20}for {set i 0} {$i < $opt(nn) } {incr i} {$ns_ at $opt(stop).0000010 "$node_($i) reset"

}$ns_ at $opt(stop).0000010 "$HA reset"$ns_ at $opt(stop).0000010 "$FA1 reset"$ns_ at $opt(stop).0000010 "$FA2 reset"$ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"

 proc finish {} {global ns_ trace namtrace$ns_ flush-traceclose $namtraceclose $trace

#puts "running nam..."#exec nam out.nam &

puts "Finishing ns.."exit 0

}

#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)" puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

 puts "Starting Simulation..."$ns_ run

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 26/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 26

Case3: Shadowing model with R = 200

## wireless-mobileIP-simulation

# o W1 WIRED NODES# |# o W2# / \# / \#--*--*--*--*--*--*- o o base-stn nodes --*-*-*-*-*-*-*-# HA FA# o

# o WL o WIRELESS NODE MOVING# WL WL FROM HA TO FA.##

#options

set opt(chan) Channel/WirelessChannel#set opt(prop) Propagation/TwoRayGroundset opt(prop) Propagation/Shadowingset opt(netif) Phy/WirelessPhy

set opt(mac) Mac/802_11set opt(ifq) Queue/DropTail/PriQueueset opt(ll) LLset opt(ant) Antenna/OmniAntennaset opt(x) 1000set opt(y) 1000set opt(ifqlen) 50set opt(tr) exam3.tr 

set opt(nn) 1set opt(adhocRouting) DSDV

set opt(cp) ""set opt(sc) ""set opt(stop) 150set num_wired_nodes 2set num_bs_nodes 3

Propagation/Shadowing set pathlossExp_ 2.2Propagation/Shadowing set std_db_ 4.0

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 27/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 27

Propagation/Shadowing set dist0_ 1.0Propagation/Shadowing set seed_ 0

# create simulator instanceset ns_ [new Simulator]

# set up for hierarchical routing$ns_ node-config -addressType hierarchicalAddrParams set domain_num_ 4lappend cluster_num 2 1 1 1AddrParams set cluster_num_ $cluster_numlappend eilastlevel 1 1 2 1 1AddrParams set nodes_num_ $eilastlevel

set tracefd [open $opt(tr) w]$ns_ trace-all $tracefd$ns_ use-newtrace

set topo [new Topography]$topo load_flatgrid $opt(x) $opt(y)# 2 for the FA / the HAcreate-god [expr $opt(nn) + 3]

#create wired nodes

set temp {0.0.0 0.1.0}for {set i 0} {$i < $num_wired_nodes} {incr i} {set W($i) [$ns_ node [lindex $temp $i]]

}#Configure for ForeignAgent and HomeAgent nodes$ns_ node-config -mobileIP ON \

-adhocRouting $opt(adhocRouting) \-llType $opt(ll) \-macType $opt(mac) \-ifqType $opt(ifq) \-ifqLen $opt(ifqlen) \-antType $opt(ant) \

-phyType $opt(netif) \-propInstance [new $opt(prop)] \-channel [new $opt(chan)] \-topoInstance $topo \-wiredRouting ON \-agentTrace ON \-routerTrace OFF \-macTrace OFF

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 28/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 28

# Create HA and FAset HA [$ns_ node 1.0.0]set FA1 [$ns_ node 2.0.0]set FA2 [$ns_ node 3.0.0]$HA random-motion 0$FA1 random-motion 0$FA2 random-motion 0# Position (fixed) for base-station nodes (HA & FA).$HA set X_ 250.000000000000$HA set Y_ 250.000000000000$HA set Z_ 0.000000000000

$FA1 set X_ 596.41000000000000$FA1 set Y_ 250.000000000000$FA1 set Z_ 0.000000000000

$FA2 set X_ 423.20000000000000$FA2 set Y_ 550.000000000000$FA2 set Z_ 0.000000000000

$ns_ node-config -wiredRouting OFFset MH [$ns_ node 1.0.2]set node_(0) $MH

set HAaddress [AddrParams addr2id [$HA node-addr]]puts "MH 1.0.2 HSAddr=$HAaddress [$HA node-addr]"puts "FA2 3.0.0 FA2Addr=$HAaddress [$HA node-addr]"[$MH set regagent_] set home_agent_ $HAaddress

$MH set X_ 398.20000000000000$MH set Y_ 32500000000000$MH set Z_ 0.000000000000

# MH starts to move towards bottom right corner $ns_ at 25.000000000000 "$MH setdest 448.200000000000 \

325.00000000000 2.000000000000"

# MH starts to move towards top right corner $ns_ at 50.000000000000 "$MH setdest 448.200000000000 \

375.000000000000 2.000000000000"

# MH goes top left corner $ns_ at 75.000000000000 "$MH setdest 398.20000000000000 \

375.000000000000 2.000000000000"

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 29/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 29

# create links between wired and BaseStation nodes$ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail$ns_ duplex-link $W(0) $FA2 5Mb 2ms DropTail$ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail$ns_ duplex-link $W(1) $FA1 5Mb 2ms DropTail

$ns_ duplex-link-op $W(0) $W(1) orient down$ns_ duplex-link-op $W(1) $HA orient left-down$ns_ duplex-link-op $W(1) $FA1 orient right-down

set tcp1 [new Agent/TCP]$tcp1 set class_ 2

set sink1 [new Agent/TCPSink]$ns_ attach-agent $MH $tcp1$ns_ attach-agent $W(0) $sink1$ns_ connect $tcp1 $sink1set ftp1 [new Application/FTP]$ftp1 attach-agent $tcp1$ns_ at 10.0 "$ftp1 start"

for {set i 0} {$i < $opt(nn)} {incr i} {$ns_ initial_node_pos $node_($i) 20

}

for {set i 0} {$i < $opt(nn) } {incr i} {$ns_ at $opt(stop).0000010 "$node_($i) reset"}$ns_ at $opt(stop).0000010 "$HA reset"$ns_ at $opt(stop).0000010 "$FA1 reset"$ns_ at $opt(stop).0000010 "$FA2 reset"$ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"

 proc finish {} {global ns_ trace namtrace

$ns_ flush-traceclose $namtraceclose $trace

#puts "running nam..."#exec nam out.nam &

puts "Finishing ns.."exit 0

8/6/2019 Lab Assignment Report Template MS Office

http://slidepdf.com/reader/full/lab-assignment-report-template-ms-office 30/30

CpE/EE/SysEngg 348 WIRELESS NETWORKS

Exam 3 Report page 30

}

#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)" puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"

 puts "Starting Simulation..."$ns_ run


Recommended