tag:blogger.com,1999:blog-17771931373850724932024-03-12T21:42:16.743-07:00Working with NS-2 Anonymoushttp://www.blogger.com/profile/14778391253922551767noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-1777193137385072493.post-35406937486121918772014-11-07T00:56:00.001-08:002014-11-07T00:57:22.242-08:00Error during NS-2.34 installation in Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
When installing NS-2.34 in ubuntu, you might get following compilation errors.<br />
<br />
<br />
<span style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">1. </span><br />
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red;">ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined<br />ld: final link failed: Bad value<br />make: *** [libotcl.so] Error 1<br />otcl-1.13 make failed! Exiting ...</span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="line-height: 18.2000007629395px;">2. </span><br />
<span style="color: red; line-height: 18.2000007629395px;">tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’:<br />tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly [-fpermissive]<br />tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’ [-fpermissive]<br />make: *** [tools/ranvar.o] Error 1</span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red; line-height: 18.2000007629395px;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red; line-height: 18.2000007629395px;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="line-height: 18.2000007629395px;">3.</span><br />
<span style="color: red; line-height: 18.2000007629395px;">In file included from mac/mac-802_11Ext.cc:66:0:<br />mac/mac-802_11Ext.h: In member function ‘u_int32_t PHY_MIBExt::getHdrLen11()’:<br />mac/mac-802_11Ext.h:175:19: error: expected primary-expression before ‘struct’<br />mac/mac-802_11Ext.h:175:41: error: ‘dh_body’ was not declared in this scope<br />mac/mac-802_11Ext.h:175:51: error: ‘offsetof’ was not declared in this scope<br />mac/mac-802_11Ext.h:177:3: warning: control reaches end of non-void function [-Wreturn-type]<br />make: *** [mac/mac-802_11Ext.o] Error 1<br />Ns make failed!</span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red; line-height: 18.2000007629395px;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red; line-height: 18.2000007629395px;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="line-height: 18.2000007629395px;">4.</span><br />
<span style="color: red; line-height: 18.2000007629395px;">mobile/nakagami.cc: In member function ‘virtual double Nakagami::Pr(PacketStamp*, PacketStamp*, WirelessPhy*)’:<br />mobile/nakagami.cc:183:73: error: cannot call constructor ‘ErlangRandomVariable::ErlangRandomVariable’ directly [-fpermissive]<br />mobile/nakagami.cc:183:73: error: for a function-style cast, remove the redundant ‘::ErlangRandomVariable’ [-fpermissive]<br />mobile/nakagami.cc:185:67: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly [-fpermissive]<br />mobile/nakagami.cc:185:67: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’ [-fpermissive]<br />make: *** [mobile/nakagami.o] Error 1</span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red; line-height: 18.2000007629395px;"><br /></span></div>
<div style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">
<span style="color: red; line-height: 18.2000007629395px;"><br /></span></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px;">5.</span><br />
<span style="color: red;"><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><span style="line-height: 18.2000007629395px;">other compilation error</span></span></span></div>
<div style="background-color: white;">
<br /></div>
<div style="background-color: white;">
<span style="color: red;"><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><span style="line-height: 18.2000007629395px;"><br /></span></span></span></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; line-height: 18.2000007629395px;"><b>What ever is the compilation error, the error is most probably due to the old version of gcc compiler.</b></span></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span style="font-size: large; line-height: 18.2000007629395px;"><br /></span></span></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span style="font-size: large; line-height: 18.2000007629395px;"><br /></span></span></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span style="font-size: large; line-height: 18.2000007629395px;"><b>Solution:</b></span></span></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"><span style="line-height: 18.2000007629395px;"><br /></span></span></div>
<div style="background-color: white;">
<br /></div>
<div style="background-color: white;">
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-small;"></span><br />
<div>
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span style="line-height: 18.2000007629395px;"><b>Step 1.</b> </span></span></div>
<span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
<div>
<span style="line-height: 18.2000007629395px;">first install the latest compiler</span></div>
<div>
<span style="line-height: 18.2000007629395px;">~$ sudo apt-get install gcc-4.4 g++-4.4</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
</span><span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><div>
<b><span style="line-height: 18.2000007629395px;">Step </span><span style="line-height: 18.2000007629395px;">2. </span></b></div>
<div>
<span style="line-height: 18.2000007629395px;">The next step is to edit line 270 in tcl8.4.18/unix/Makefile.in.</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;">~$ gedit /your/path/ns-allinone-2.34/tcl8.4.18/Makefile.in</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;">SOLVED:</span></div>
<div>
<span style="line-height: 18.2000007629395px;">#CC = @CC@</span></div>
<div>
<span style="line-height: 18.2000007629395px;">CC = @CC@-4.4</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;">save and exit</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
</span><span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><div>
<span style="line-height: 18.2000007629395px;"><b>Step 3.</b> </span></div>
<div>
<span style="line-height: 18.2000007629395px;">To used gcc-4.4 and g++-4.4 as compiler to compile ns-allinone-2.34, change the line 36-37 in ns-2.34/Makefile.in.</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;">~$ gedit /your/path/ns-allinone-2.34/ns-2.34/Makefile.in</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;">SOLVED:</span></div>
<div>
<span style="line-height: 18.2000007629395px;">#CC = @CC@ </span></div>
<div>
<span style="line-height: 18.2000007629395px;">#CPP = @CXX@</span></div>
<div>
<span style="line-height: 18.2000007629395px;">CC = @CC@-4.4</span></div>
<div>
<span style="line-height: 18.2000007629395px;">CPP = @CXX@-4.4</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;">save and exit</span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div>
<span style="line-height: 18.2000007629395px;"><br /></span></div>
<div style="line-height: 18.2000007629395px;">
<span style="line-height: 18.2000007629395px;"><b>Step 4.</b> </span></div>
<div style="line-height: 18.2000007629395px;">
<span style="line-height: 18.2000007629395px;">now go to</span><span style="line-height: 18.2000007629395px;"> </span><span style="line-height: 18.2000007629395px;">/your/path/ns-allinone-2.34</span></div>
</span><span style="color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><div style="line-height: 18.2000007629395px;">
<span style="color: #222222; line-height: 18.4799995422363px;">./install</span></div>
<div style="line-height: 18.2000007629395px;">
<span style="color: #222222; line-height: 18.4799995422363px;"><br /></span></div>
<div style="line-height: 18.2000007629395px;">
<span style="color: #222222; line-height: 18.4799995422363px;"><br /></span></div>
<div style="line-height: 18.2000007629395px;">
<span style="color: #222222; line-height: 18.4799995422363px;">Thats all...now your ns2 should install well. Good luck.</span></div>
<div style="font-size: small; line-height: 18.2000007629395px;">
<span style="color: #222222; font-size: 13px; line-height: 18.4799995422363px;"><br /></span></div>
</span></div>
</div>
Anonymoushttp://www.blogger.com/profile/14778391253922551767noreply@blogger.com0tag:blogger.com,1999:blog-1777193137385072493.post-47753524506203083692014-03-18T22:58:00.000-07:002014-03-18T23:24:20.885-07:00Simulation of IEEE 802.15.4 (WPAN) in NS-2<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
<span style="font-family: inherit;">To
simulate 802.15.4, we just need two commands.</span><br />
<span style="text-indent: -0.25in;"><span style="font-family: inherit;"><br /></span></span>
<span style="font-family: inherit;"><span style="text-indent: -0.25in;">1. $node sscs </span><span style="color: blue; text-indent: -0.25in;">startPANCoord </span><span style="text-indent: -0.25in;"><txBeacon = 1> <beaconOrder = 3> <SuperframeOrder = 3></span></span></div>
<div class="MsoNormal" style="text-indent: .5in;">
<span style="font-family: inherit;">This command can be used to start a PAN coordinator.
Generally, there will be only one coordinator in a PAN. If some parameters are omitted, the default
values shown above will be assumed.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: .5in;">
<span style="font-family: inherit;"><span lang="KO">–</span>
Examples:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: inherit;"><span lang="KO">•</span> $node_(0) sscs startPANCoord<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: inherit;"><span lang="KO">•</span><span lang="KO"> </span>$node_(0) sscs startPANCoord 1 3 3<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><span style="text-indent: -0.25in;">2. $node sscs </span><span style="color: blue; text-indent: -0.25in;">startDevice </span><span style="text-indent: -0.25in;"><isFFD = 1> <assoPermit = 1>
<txBeacon = 0> <beaconOrder = 3> <SuperframeOrder = 3></span></span></div>
<div class="MsoNormal" style="text-indent: .5in;">
<span style="font-family: inherit;"> This Command
can be used to start a device or coordinator. If some parameters are omitted,
the default values shown above will be assumed.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: .5in;">
<span style="font-family: inherit;"><span lang="KO">–</span>
Examples:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span lang="KO" style="font-family: inherit; text-indent: 0.5in;">•</span><span style="font-family: inherit; text-indent: 0.5in;"> $node_(0) sscs startDevice // non-beacon</span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: inherit;"><span lang="KO">•</span> $node_(0) sscs startDevice 1 1 1 // beacon enabled<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Following
is the simple tcl script to simulate IEEE 802.15.4. It consists of only two
nodes; 1 coordinator and 1 end node.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">==================================Start=================================<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
stopTime 100<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
BO 3<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
SO 3<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
speed 1 <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#speed
is in m/s<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
======================================================================<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
Define options<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
======================================================================<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(chan) Channel/WirelessChannel ;#
Channel Type<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(prop) Propagation/TwoRayGround ;#
radio-propagation model<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(netif) Phy/WirelessPhy/802_15_4<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(mac) Mac/802_15_4<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(ifq) Queue/DropTail/PriQueue ;#
interface queue type<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(ll) LL ;# link layer type<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(ant) Antenna/OmniAntenna ;#
antenna model<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(ifqlen) 50 ;# max packet in ifq<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(nn) 2 ;# number of
mobilenodes<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(rp) AODV ;# routing protocol<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(x) 50<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(y) 50<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
opt(err) UniformErrorProc
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(nam) 2nodes.nam<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
val(traffic) cbr ;# cbr/poisson/ftp<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#read
command line arguments<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">proc
getCmdArgu {argc argv} {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> global val<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> for {set i 0} {$i < $argc} {incr i}
{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set arg [lindex $argv $i]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> if {[string range $arg 0 0] !=
"-"} continue<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set name [string range $arg 1
end]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set val($name) [lindex $argv
[expr $i+1]]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">getCmdArgu
$argc $argv<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">##This
is optional error model. you can delete it if u dont need it<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">proc
UniformErrorProc {} { <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"># puts "useing error model-" <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set err [new ErrorModel] <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"># $err unit pkt <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> $err set rate_ 0.05<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> return $err <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
Initialize Global Variables<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
ns_ [new Simulator]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
tracefd [open ./2nodes.tr w]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
trace-all $tracefd<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">if
{ "$val(nam)" == "2nodes.nam" } {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set namtrace [open ./$val(nam) w]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> $ns_ namtrace-all-wireless $namtrace
$val(x) $val(y)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
puts-nam-traceall {# nam4wpan #} ;#
inform nam that this is a trace file for wpan (special handling needed)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#Mac/802_15_4
wpanNam macType $para1 # added by
pranesh<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Mac/802_15_4
wpanCmd verbose on<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Mac/802_15_4
wpanNam namStatus on ;#
default = off (should be turned on before other 'wpanNam' commands can work)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#Mac/802_15_4
wpanNam ColFlashClr gold ;#
default = gold<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
For model 'TwoRayGround'<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(5m) 7.69113e-06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(9m) 2.37381e-06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(10m) 1.92278e-06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(11m) 1.58908e-06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(12m) 1.33527e-06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(13m) 1.13774e-06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(14m) 9.81011e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(15m) 8.54570e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(16m) 7.51087e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(20m) 4.80696e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(25m) 3.07645e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(30m) 2.13643e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(35m) 1.56962e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
dist(40m) 1.20174e-07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Phy/WirelessPhy
set CSThresh_ $dist(15m)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Phy/WirelessPhy
set RXThresh_ $dist(15m)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
set up topography object<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
topo [new Topography]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$topo
load_flatgrid $val(x) $val(y)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#ns-random
1 gives same result in trace file
everytime simulation is done<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#ns-random
0 gives different result in trace file when simulated<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">ns-random
0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
Create God<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
god_ [create-god $val(nn)]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
chan_1_ [new $val(chan)]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
configure node<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
node-config -adhocRouting $val(rp) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -llType $val(ll) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -macType $val(mac) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -ifqType $val(ifq) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -ifqLen $val(ifqlen) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -antType $val(ant) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -propType $val(prop) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -phyType $val(netif) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -topoInstance $topo \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -agentTrace ON \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -routerTrace OFF \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -macTrace ON \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -movementTrace OFF \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -energyModel
"EnergyModel" \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -initialEnergy 10 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -idlePower 0.00279 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -rxPower 0.0565 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -txPower 0.048 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -sleepPower 0.000030 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -transitionPower
0.002 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -transitionTime
0.0002 \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -IncomingErrProc
$opt(err) \<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> -channel $chan_1_ <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">for
{set i 0} {$i < $val(nn) } {incr i} {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set node_($i) [$ns_ node] <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> $node_($i) random-motion 0 ;# disable random motion<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">##initial
postion of node 0 and node 1<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$node_(0)
set X_ 25.0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$node_(0)
set Y_ 25.0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$node_(0)
set Z_ 0.0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$node_(1)
set X_ 10.0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$node_(1)
set Y_ 25.0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$node_(1)
set Z_ 0.0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at 0.0 "$node_(0) NodeLabel PAN
Coor"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at 0.0 "$node_(0) sscs
startPANCoord 1 $BO $SO" ;#
startPANCoord <txBeacon=1> <BO=3> <SO=3><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at 5 "$node_(1) sscs
startDevice 0 0 0 $BO $SO"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Mac/802_15_4
wpanNam PlaybackRate 3ms<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at 50 "puts \"\nTransmitting data ...\n\""</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">##define traffic type and date rate </span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
udp_(0) [new Agent/UDP]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
attach-agent $node_(1) $udp_(0)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
null_(0) [new Agent/Null]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
attach-agent $node_(0) $null_(0)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">set
cbr_ [new Application/Traffic/CBR]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$cbr_
set packetSize_ 100<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$cbr_
set interval_ 0.2<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$cbr_
set random_ 1<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$cbr_
attach-agent $udp_(0)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
connect $udp_(0) $null_(0)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at 50 "$cbr_ start"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
the following command is for moving the node 1. you can disable it if you dont
need it.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#node
1 will start to meet at time 70 towards the cordinate(42,25) at the speed of
$speed. $speed is defined at top.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at 70 "$node_(1) setdest 42.00 25 $speed"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
defines the node size in nam<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">for
{set i 0} {$i < $val(nn)} {incr i} {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> $ns_ initial_node_pos $node_($i) 2<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">#
Tell nodes when the simulation ends<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">for
{set i 0} {$i < $val(nn) } {incr i} {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> $ns_ at $stopTime "$node_($i)
reset";<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">##to
stop simulation <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at $stopTime "stop"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at $stopTime "puts \"\nNS EXITING...\n\""<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
at $stopTime "$ns_ halt"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">proc
stop {} {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> global ns_ tracefd appTime val env<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> $ns_ flush-trace<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> close $tracefd<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set hasDISPLAY 0<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> foreach index [array names env] {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> if { ("$index" ==
"DISPLAY") && ("$env($index)" != "") } {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> set hasDISPLAY 1<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">puts
"\nStarting Simulation..."</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">$ns_
run<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
</div>
<div class="MsoNormal">
<span style="font-family: inherit;">===========================End====================<o:p></o:p></span><br />
<span style="font-family: inherit;"><br />
<b>Extra Features in the TCL</b></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">In the above two extra features have been added as bonus. </span><br />
<ol start="1" type="1">
<li class="MsoNormal"><span style="font-family: inherit;"><span style="color: blue;">Error
model</span><o:p></o:p></span></li>
</ol>
<div class="MsoNormal" style="margin-left: .5in; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;">
<span style="font-family: inherit;">Error
model has been added in the tcl file. UniformErrorProc defines the error mode
and error rate. The error rate is set to 5%. If someone don’t need error model
you can delete the UniformErrorProc. But make sure you delete “-IncomingErrProc
$opt(err) \” from node-config function also.<o:p></o:p></span></div>
<ol start="2" type="1">
<li class="MsoNormal"><span style="font-family: inherit;"><span style="color: blue;">Setdest</span><o:p></o:p></span></li>
</ol>
<div class="MsoNormal" style="margin-left: .5in; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;">
<span style="font-family: inherit;">Setdest
has been used in the tcl file. Setdest function is use for node mobility. Setdest
is used to move node from current </span>position<span style="font-family: inherit;"> to new position.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;">
<span style="font-family: inherit;">The
syntax is:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;">
<span style="font-family: inherit;"> $node_(1) setdest newXpos newYpos speed<o:p></o:p></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin-left: .5in; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;">
<span style="font-family: inherit;">for
example: setdest 50 50 2 ; will move
node 1 from current location to 50,50 at the speed of 2 m/s.</span></div>
<div class="MsoNormal" style="margin-left: .5in; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;">
<span style="font-family: inherit;">You can disable the node movement by just delete the setdest line.</span></div>
<span style="font-family: inherit;"><br /></span>
<br />
<span style="font-family: inherit;">P.S. </span>Queries<span style="font-family: inherit;"> are welcome. I will try to answer to my </span>earliest<span style="font-family: inherit;"> </span>convince. Thank you.<br />
<br />
<span style="font-size: 12.0pt; mso-bidi-font-size: 11.0pt;"><br /></span></div>
</div>
Anonymoushttp://www.blogger.com/profile/14778391253922551767noreply@blogger.com25tag:blogger.com,1999:blog-1777193137385072493.post-47578689000425650682013-12-04T00:44:00.000-08:002013-12-04T00:47:42.657-08:00How to install NO Ad-Hoc Routing Agent (NOAH) in NS-2.34<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
<span style="color: #0b5394;">NO Ad-Hoc Routing Agent (NOAH)</span></h2>
<span style="color: #000099; font-family: Helvetica, Arial, sans-serif;"></span><span style="background-color: white;"></span><span style="font-family: Helvetica, Arial, sans-serif;">NOAH is a wireless routing agent that (in contrast to DSDV, DSR, ...) only supports direct communication between wireless nodes or between base stations and mobile nodes in case Mobile IP is used. This allows to simulate scenarios where multi-hop wireless routing is undesired. NOAH does not send any routing related packets.</span><br />
<br />
<span style="font-family: Helvetica, Arial, sans-serif;"></span><br />
<ul>
<li>It has been updated to work with ns-2.26 - ns-2.30 and with non-Mobile IP scenarios. (For older versions of ns-2, take a look at <a href="http://www.informatik.uni-mannheim.de/informatik/pi4/projects/MobileIP/ns-extension/">http://www.informatik.uni-mannheim.de/informatik/pi4/projects/MobileIP/ns-extension/</a> but this version does not contain the bugfixes for non-Mobile IP scenarios.)</li>
<li>Further update to allow static multi-hop routes. The routes can be set up using the <tt>routing</tt> command which takes as parameters the number of destinations and then as many tuples of destination and next hop address. The following example sets up static routing for a line of nodes:<tt><pre># setup static routing for line of nodes
for {set i 0} {$i < $val(nn) } {incr i} {
set cmd "[$node_($i) set ragent_] routing $val(nn)"
for {set to 0} {$to < $val(nn) } {incr to} {
if {$to < $i} {
set hop [expr $i - 1]
} elseif {$to > $i} {
set hop [expr $i + 1]
} else {
set hop $i
}
set cmd "$cmd $to $hop"
}
eval $cmd
}</pre>
</tt></li>
</ul>
<div class="MsoNormal">
<b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; color: #000099; font-family: Helvetica, sans-serif; font-size: 13.5pt;">Step-by-step installation instructions for ns-2.34</span></b><b><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; color: #000099; font-family: Helvetica, sans-serif; font-size: 13.5pt;"><br /></span></b></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="background-color: white;"><tbody>
<tr><td style="padding: 7.5pt;" valign="top"><div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt;">Makefile.in<o:p></o:p></span></b></div>
</td><td style="padding: 7.5pt;" valign="top"><div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">add </span><span style="font-family: 'Courier New'; font-size: 10pt;">noah/noah.o \</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> to OBJ_CC and </span><span style="font-family: 'Courier New'; font-size: 10pt;">tcl/mobility/noah.tcl \</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> to NS_TCL_LIB<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: red; font-family: 'Times New Roman', serif; font-size: 12pt;">Note: make sure there is no space after "\"</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"><o:p></o:p></span></div>
</td></tr>
<tr><td style="padding: 7.5pt;" valign="top"><div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt;">noah/noah.{h,cc}<o:p></o:p></span></b></div>
</td><td style="padding: 7.5pt;" valign="top"><div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">add <a href="http://icapeople.epfl.ch/widmer/uwb/ns-2/noah/noah.h"><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">noah.h</span></a> and <a href="http://icapeople.epfl.ch/widmer/uwb/ns-2/noah/noah.cc"><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">noah.cc</span></a> to a new subdirectory noah/<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">Create directory in the folder ns-2.34<o:p></o:p></span></div>
</td></tr>
<tr><td style="padding: 7.5pt;" valign="top"><div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt;">tcl/mobility/noah.tcl<o:p></o:p></span></b></div>
</td><td style="padding: 7.5pt;" valign="top"><div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">add <a href="http://icapeople.epfl.ch/widmer/uwb/ns-2/noah/noah.tcl"><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">noah.tcl</span></a> to tcl/mobility/<o:p></o:p></span></div>
</td></tr>
<tr><td style="padding: 7.5pt;" valign="top"><div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt;">tcl/lib/ns-lib.tcl<o:p></o:p></span></b></div>
</td><td style="padding: 7.5pt;" valign="top"><div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">in line 197: add </span><span style="font-family: 'Courier New'; font-size: 10pt;">source ../mobility/noah.tcl</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">in 634: add<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> NOAH {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> set ragent [$self create-noah-agent $node]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;">line 778: add<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;">Simulator instproc create-noah-agent { node } {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> # Create a noah routing agent for this node<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> set ragent [new Agent/NOAH]<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> ## setup address (supports hier-addr) for noah agent<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> ## and mobilenode<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> set addr [$node node-addr]<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> $ragent addr $addr<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> $ragent node $node<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> if [Simulator set mobile_ip_] {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> $ragent port-dmux [$node demux]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> $node addr $addr<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> $node set ragent_ $ragent<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;"> return $ragent<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 10pt;">}<o:p></o:p></span></div>
</td></tr>
</tbody></table>
<div class="MsoNormal">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt;">Open terminal and go to the directory ns-2.34 and type follow commands<o:p></o:p></span></b></div>
<pre>./configure</pre>
<pre><o:p></o:p></pre>
<pre>make clean<o:p></o:p></pre>
<pre>make<o:p></o:p></pre>
<pre>
</pre>
<pre><b>If everything went then you have successfully installed NOAH routing protocol. </b></pre>
<pre><b>Congratulation. </b></pre>
<pre>
</pre>
<div class="MsoNormal">
<b><span style="font-family: 'Times New Roman', serif; font-size: 12pt;">Possible errors<o:p></o:p></span></b></div>
<pre style="background-color: #eeeeee; line-height: 13.5pt; vertical-align: baseline;"><code><span style="border: 1pt none windowtext; font-family: Consolas; font-size: 10.5pt; padding: 0in;">Makefile:13: *** commands commence before first target. Stop.</span></code><span style="border: 1pt none windowtext; font-family: Consolas; font-size: 10.5pt; padding: 0in;"><o:p></o:p></span></pre>
<div class="MsoNormal">
<br /></div>
<pre>The reason of this error is due to the possible space after “\” in these lines noah/noah.o \<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> or</span> tcl/mobility/noah.tcl \<o:p></o:p></pre>
<pre>Make sure u leave no space after “\”<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<br />
<div class="MsoNormal">
<br /></div>
<table bgcolor="white" border="0" cellpadding="10" cellspacing="0"></table>
</div>
Anonymoushttp://www.blogger.com/profile/14778391253922551767noreply@blogger.com1tag:blogger.com,1999:blog-1777193137385072493.post-48439979479656707702013-02-14T02:55:00.003-08:002013-02-14T03:10:34.731-08:00bash unexpected end of file problem<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<b>bash unexpected end of file problem</b></h2>
<br />
Other day I was working for my research in Ubuntu and I needed to automate a process. I decide to write a bash script but my while loop was not working at all. Any condition and loop I wrote, it gave me a unexpected end of file error. I try to google for more than an hour but nothing was helpful. Even though my syntax seems to be correct but the terminal was giving me same error again and again. I was not able to figure out what was causing the error but, finally I was able to solve it.<br />
<br />
There are several reasons for throwing this error when working with the bash script and mostly its due to syntax error. But, sometimes even though every syntax is correct, you may still get this error and those times are really frustrating. It took me more than 2 hours to figure out the problem.<br />
<br />
<b>Cause:</b><br />
I figure our the cause of this problem. It is due to the line ending used by various OS. I figure out that when we save our file in gedit (ubuntu), it has 3 line ending options as,<br />
1. Unix/linux<br />
2. Mac<br />
3. Windows.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-x_fARdZleCo/URzCJBB2CvI/AAAAAAAAAoo/0Mj1mial3Lc/s1600/save.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="http://2.bp.blogspot.com/-x_fARdZleCo/URzCJBB2CvI/AAAAAAAAAoo/0Mj1mial3Lc/s400/save.jpeg" width="400" /></a></div>
<br />
<br />
By default, windows is selected as line ending, and if its the case then how much you write the correct syntax, bash will not run and give you the unexpected end of file error.<br />
<br />
<br />
<br />
<b>Solution:</b><br />
Just use the line ending as unix/linux and your bash script should work well this time. I hope this simple information is helpful.<br />
<br />
<br />
<br />
Thank you and have a nice day...<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/14778391253922551767noreply@blogger.com0tag:blogger.com,1999:blog-1777193137385072493.post-48381934428911874382012-11-11T22:28:00.000-08:002013-12-04T00:44:13.745-08:00How to Install and Configure NS-2 with Eclipse in Linux <div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<b>Running NS-2</b></h2>
Ns-2 can be run both in windows or Linux platform.<br />
<b><br /></b>
<b>Best option</b><br />
<br />
<ul style="text-align: left;">
<li>Use Linux </li>
</ul>
<br />
<b>How to run NS-2 under Windows?</b><br />
<br />
<ul style="text-align: left;">
<li>Using Cygwin (not recommended)</li>
<li>Using Virtual machine</li>
<ul>
<li>Vmware station (not free)</li>
<li>WM player (free and recommended)</li>
<li>Virtualbox (free)</li>
</ul>
<li>others</li>
</ul>
<br />
<br />
<div>
<br /></div>
<b>Installation Procedures for NS-2 (ns-allinone-2.34)</b><br />
<b><br /></b>
<br />
<div class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;">
</div>
<strong>Step 1:</strong> <strong>Download </strong><br />
<div class="tweetmeme-button" id="tweetmeme-button-post-51" style="background: #fff; float: right; margin-bottom: 5px; margin-left: 10px; padding: 4px 0 2px 4px;">
<iframe frameborder="0" height="61" scrolling="no" src="http://api.tweetmeme.com/button.js?url=http%3A//salgaonkar.wordpress.com/2010/05/10/how-to-install-ns-2-34-on-ubuntu-9-10/&style=normal&source=%u201Drupesh_in%u201D&alias=http%3A//wp.me/pSWey-P&o=http%3A//www.google.com.np/url%3Fsa%3Dt%26rct%3Dj%26q%3Dhow%2520to%2520install%2520ns2.34%26source%3Dweb%26cd%3D4%26cad%3Drja%26ved%3D0CCkQFjAD%26url%3Dhttp%253A%252F%252Fsalgaonkar.wordpress.com%252F2010%252F05%252F10%252Fhow-to-install-ns-2-34-on-ubuntu-9-10%252F%26ei%3DHJigUMfkOOS6iwKV0oGYBA%26usg%3DAFQjCNHRPZDJ8fE7QOSP7gW0hhW1rptaCA&b=1" width="50"></iframe>
</div>
<br />
download the latest ns2 copy . their are two methods to do that<br />
1. go to terminal and type<br />
<pre>wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.34.tar.gz
</pre>
2. u can download it from <a href="http://sourceforge.net/project/showfiles.php?group_id=149743&package_id=169689&release_id=684492" target="_blank" title="ns2.34">here</a><br />
<strong>Step 2: Extract</strong><br />
extract the tar file in home directory i.e. /home/username<br />
OR<br />
try this in terminal<br />
<pre>tar -xzvf ns-allinone-2.34.tar.gz
</pre>
<strong>step 3 :install</strong><br />
<strong>just type following commands<br />
</strong>
<br />
<pre>cd ns-allinone-2.34
sudo apt-get install build-essential autoconf automake libxmu-dev
./install
</pre>
<strong>Step 4: Set environment variables </strong><br />
<pre>$ gedit ~/.bashrc
</pre>
Add the following lines to the end of the file. Remember replace
“/your/path” by the folder where you have stored extracted the ns-2 file<br />
<pre></pre>
<pre># LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.34/otcl-1.13
NS2_LIB=/your/path/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/your/path/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/your/path/ns-allinone-2.34/bin:/your/path/ns-allinone-2.34/tcl8.4.18/unix:/your/path/ns-allinone-2.34/tk8.4.18/unix
NS=/your/path/ns-allinone-2.34/ns-2.34/
NAM=/your/path/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM
</pre>
<br />
Ensure that it immediately takes effect:<br />
<pre>$ source ~/.bashrc
</pre>
<strong><br /></strong>
<strong>Note</strong>: the previous step is important; else you cannot successfully run ns-2.<br />
(Alternatively, you may have to restart your X-windows, that is logout, and then login, or restart your computer.)<br />
Now, the installation has been completed. Try:<br />
<pre>$ ns
</pre>
The “%” symbol appears on the screen. Type “<strong>exit</strong>” to quit.<br />
<h2>
<span style="font-size: small;">
Validation (optional)</span></h2>
To run the ns validation suite:<br />
<pre>$ cd ns-2.34
$ ./validate
</pre>
<br />
<a name='more'></a><b>Configuring Eclipse to work with NS2</b><br />
<br />
For most users of NS2, it would be easier if they can use a popular IDE to work with the files.<br />
Here are the step by step instructions to set up NS-2.34 with Eclipse 3.5 in Ubuntu Linux.<br />
<br />
<strong>Setting up Eclipse:</strong><br />
<ol>
<li>Download <a href="http://www.eclipse.org/downloads/" target="_blank">Eclipse SDK</a></li>
<li>Extract the SDK to a folder</li>
<li>Open Eclipse</li>
<li>Go to Help -> Install New Software. In the Work With bar type this:<br />
<strong><a href="http://download.eclipse.org/tools/cdt/releases/galileo" rel="nofollow" target="_blank">http://download.eclipse.org/tools/cdt/releases/galileo</a></strong></li>
<li>Choose CDT Main Features and CDT Optional Features. Install them.<br />
CDT stands for “C/C++ Development Tooling”</li>
<li>If you do not have a working internet connection in the system you
have installed Eclipse, instead of steps 4 and 5, download the CDT from
the above mentioned site. Then move to Install New Software (see step 4)
-> Add and add the archive downloaded.</li>
</ol>
<br />
<b>Enabling debugging in NS2</b><br />
<ol>
<li>Edit Makefile:
<ul>
<li>Open “…/ns-allinone-2.34/ns-2.34/Makefile.in”and</li>
<li>Add these lines anywhere near the top of the file:<code>CCOPT = -g</code><br />
<code>DEFINE = -DNDEBUG </code><br />
<code>DEFINE = -DDEBUG</code></li>
<li>Navigate to …/ns-allinone-2.34/ns-2.34 and run “./configure”</li>
</ul>
</li>
<li>Navigate to the NS-2 folder using terminal and type ./install</li>
<li>Also, follow the instructions are displayed at the end of a
successful installation. These instructions are to modify the PATH
variable and other environment variables as needed.</li>
</ol>
<br />
<ol>
</ol>
<strong>Adding NS-2 as a Project in Eclipse:</strong><br />
<ol>
<li>Open Eclipse</li>
<li>Set the workspace as the ns installation path( /home/username/ns-allinone-2.34 ) by selecting File -> Switch Workspace</li>
<li>Choose File -> New -> Project -> C++ Project</li>
<li>Select Project Type as Makefile Project -> Empty C++ Project.<br />
Toolchains: Linux GCC</li>
<li>Enter Project Name as ns-2.34</li>
<li>Uncheck “Use default location” then browse to the directory NS-2 source directory ( …/ns-allione-2.34/ns-2.34 )</li>
<li>Select “Next” and “Finish.</li>
<li>From the workspace, Selecting the NS-2 Project and choosing Project -> Build All should not give Error.</li>
<li>Running the project must open the console with the NS-2 prompt, %</li>
</ol>
<strong>Setting Debug Configuration:</strong><br />
<ol>
<li>Select Run -> Debug Configurations</li>
<li>Choose C/C++ Application. Type in any name.</li>
<li>Under the Main tab, Choose the following:<br />
Project as ns-2.34.<br />
C/C++ Application as ns. (Search Project and Choose this)</li>
<li>Under the Debugger tab, choose GDB Debugger. Uncheck the “Stop on startup at” option.</li>
<li>Apply and Debug.</li>
</ol>
<hr />
<strong>Update from Readers: Changes to be made in Makefile.in file:</strong><br />
Add -g to the line <code>CCOPT = @V_CCOPT@</code><br />
<pre>CCOPT = @V_CCOPT@ <span style="color: red;">-g</span></pre>
Add <code>-DNDEBUG -DDEBUG</code> to the end of the following line:<br />
<pre>DEFINE = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS@-DNS_DIFFUSION
-DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE@-DUSE_SINGLE_ADDRESS_SPACE -Drng_test <span style="color: red;">-DNDEBUG -DDEBUG</span></pre>
<hr />
<br />
<strong>Useful tips: </strong><br />
Apart from doing "make clean" every time you make changes to the c++ files, you can just delete the *.o files in that folder and just do make only. This will save your development time.<br />
<strong><br /></strong>
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/14778391253922551767noreply@blogger.com4