Hi,
       Thanks again for the advice. Your suggestion certainly took care of
the error message, but unfortunately nothing is being written to the output
file. Do you have an example of dump-routes that I could use?

I was able to route traffic from base stations to wireless nodes within
range. I also performed successful routing between wireless nodes using
intermediate nodes. However, the problem resides in sending packets from a
base station to a wireless node that requires an additional hop (in my
diagram below, it would be W(0)-->MH(1) ). Maybe the wireless nodes are not
forwarding the information regarding MH(1) to the base stations, or else the
base stations are not propagating that information to the rest of the wired
nodes.

Does anyone know if there is a bug in the simulator implementation or a way
to check for this either by looking at the trace file or by any other
function in tcl? Has anyone been able to try this experiment before? Thank
you.

Best regards,
                  Eric


2009/8/17 zhujian <everysmile...@163.com>

>  I think that the line $dr dump-routes $fh should modified to $node
> dump-routes $fh
>
>
>
> *发件人:* Eric Miedzowicz [mailto:emie...@gmail.com]
> *发送时间:* 2009年8月17日 11:53
> *收件人:* zhujian
> *主题:* Re: 答复: [ns] Routing to a base station through intermediate nodes.
>
>
>
> Zhujian,
>             Thank you for your prompt response. I am trying to verify the
> routing table. I used an example posted in the mailing list as follows:
>
> set fh [open dyn.trc w]
>
> proc rtdump {node fh} {
> global ns_
>     set now [$ns_ now]
>     puts "Routing table of node $node at time $now"
>     set dr [$node rtObject?]
>     $dr dump-routes $fh
> }
>
> $ns_ at 99.5 "rtdump $MH(1) $fh"
>
> However, when I run the script I get the following error:
>
> INITIALIZE THE LIST xListHead
> *** NOTE: no connection pattern specified.
> *** NOTE: no scenario file specified.
> Starting Simulation...
> channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
> highestAntennaZ_ = 1.5,  distCST_ = 550.0
> SORTING LISTS ...DONE!
> Routing table of node _o133 at time 99.5
> ns: rtdump _o133 file5: invalid command name ""
>     while executing
> "$dr dump-routes $fh"
>     (procedure "rtdump" line 8)
>     invoked from within
> "rtdump _o133 file5"
>
> Do you know a way to show the routing table for a wireless node? Is it
> possible to deduce it from the output traces? Thank you.
>
> Best regards,
>                      Eric
>
> 2009/8/16 zhujian <everysmile...@163.com>
>
> Maybe you can checking the routing.
>
> -----邮件原件-----
> 发件人: ns-users-boun...@isi.edu [mailto:ns-users-boun...@isi.edu] 代表 Eric
> Miedzowicz
> 发送时间: 2009年8月17日 7:14
> 收件人: ns-users@ISI.EDU
> 主题: [ns] Routing to a base station through intermediate nodes.
>
>
>
> Hi!
>
>    I am new to ns-2 and I need to simulate a wired-wireless network. I am
> using the wireless3.tcl script as a model and I need to be able to use both
> base stations to route traffic to different wireless nodes, depending on
> their location. In my example, I use 3 wireless nodes (MH) and 2 base
> stations (HA and FA, as shown below).
>
>                   W(0)
>                      |
>                   W(1)
>                     /\
>               HA    FA
>
>        MH(0)            MH(2)
>                  MH(1)
>
> In my script I was able to send traffic from MH(2) to W(0) (through FA),
> from MH(0) to W(0) (through HA) and even from MH(0) to MH(2), using MH(1)
> as
> an intermediate node. When MH(1) is within range from FA, it sends packets
> normally. However, when move it out of range from the base station, in
> order
> to use an intermediate node, it is not able to find its way. Below you will
> find the code I am using.
>
> You will notice that I am not using the base station definitions shown in
> wireless3.tcl and wired-cum-wireless-sim.tcl. I did try them at first, but
> the results were the same. Could somebody please help me? Has anyone tried
> this experiment before in order to send me a sample script? I am using
> ns-2.34.
>
> set opt(chan)   Channel/WirelessChannel        ;# channel type
> set opt(prop)   Propagation/TwoRayGround       ;# radio-propagation model
> set opt(netif)  Phy/WirelessPhy                ;# network interface type
> set opt(mac)    Mac/802_11                     ;# MAC type
> set opt(ifq)    Queue/DropTail/PriQueue        ;# interface queue type
> set opt(ll)     LL                             ;# link layer type
> set opt(ant)    Antenna/OmniAntenna            ;# antenna model
> set opt(ifqlen)         50                     ;# max packet in ifq
> set opt(nn)             3                      ;# number of mobilenodes
> set opt(adhocRouting)   DSDV                   ;# routing protocol
>
> set opt(cp)     ""                             ;# cp file not used
> set opt(sc)     ""                             ;# node movement file.
>
> set opt(x)      670                            ;# x coordinate of topology
> set opt(y)      670                            ;# y coordinate of topology
> set opt(seed)   0.0                            ;# random seed
> set opt(stop)   250                            ;# time to stop simulation
>
> set opt(ftp1-start)      100.0
>
> set num_wired_nodes      2
> #set num_bs_nodes       2  ; this is not really used here.
>
> # ======================================================================
>
> # check for boundary parameters and random seed
> if { $opt(x) == 0 || $opt(y) == 0 } {
>    puts "No X-Y boundary values given for wireless topology\n"
> }
> if {$opt(seed) > 0} {
>    puts "Seeding Random number generator with $opt(seed)\n"
>    ns-random $opt(seed)
> }
>
> # create simulator instance
> set ns_   [new Simulator]
>
> # set up for hierarchical routing
> $ns_ node-config -addressType hierarchical
>
> AddrParams set domain_num_ 3           ;# number of domains
> lappend cluster_num 2 1 1              ;# number of clusters in each domain
> AddrParams set cluster_num_ $cluster_num
> lappend eilastlevel 1 1 4 1
> AddrParams set nodes_num_ $eilastlevel ;# of each domain
>
> set tracefd  [open wireless7-out.tr w]
> set namtrace [open wireless7-out.nam w]
> $ns_ trace-all $tracefd
> $ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)
>
> # Create topography object
> set topo   [new Topography]
>
> # define topology
> $topo load_flatgrid $opt(x) $opt(y)
>
> # create God
> #   2 for HA and FA
> create-god [expr $opt(nn) + 2]
>
> #create wired nodes
> set temp {0.0.0 0.1.0}           ;# hierarchical addresses
> 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) \
>                 -propType $opt(prop) \
>                 -phyType $opt(netif) \
>                 -channelType $opt(chan) \
>         -topoInstance $topo \
>                 -wiredRouting ON \
>         -agentTrace ON \
>                 -routerTrace ON \
>                 -macTrace ON
>
> # Create HA and FA
> set HA [$ns_ node 1.0.0]
> set FA [$ns_ node 1.0.1]
> $HA random-motion 0
> $FA random-motion 0
>
> # Position (fixed) for base-station nodes (HA & FA).
> $HA set X_ 100.000000000000
> $HA set Y_ 200.000000000000
> $HA set Z_ 0.000000000000
>
> $FA set X_ 500.000000000000
> $FA set Y_ 200.000000000000
> $FA set Z_ 0.000000000000
>
> # create a mobilenode that would be moving between HA and FA.
> # note address of MH indicates its in the same domain as HA.
> $ns_ node-config -wiredRouting OFF
> #de aca
> set temp {1.0.2 1.0.3 1.0.4}
> set init_x 100.0
>
> for {set j 0} {$j < $opt(nn)} {incr j} {
>    set MH($j) [ $ns_ node [lindex $temp $j]]
>
>    $MH($j) random-motion 0
>    $MH($j) set X_ [expr $init_x + $j * 200.0]
>    $MH($j) set Y_ 100.0
>    $MH($j) set Z_ 0.0
>  }
>
> $MH(1) set Y_ 40.000000000000
>
> # create links between wired and BaseStation nodes
> $ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail
> $ns_ duplex-link $W(1) $HA 5Mb 2ms DropTail
> $ns_ duplex-link $W(1) $FA 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) $FA orient right-down
>
> # setup TCP connections between a wired node and the MobileHost
> Agent/TCP set packetSize_    512
> set tcp1 [new Agent/TCP]
> $tcp1 set class_ 2
>
> set sink1 [new Agent/TCPSink]
> $ns_ attach-agent $MH(2) $tcp1
> $ns_ attach-agent $W(0) $sink1
> $ns_ connect $tcp1 $sink1
> set ftp1 [new Application/FTP]
> $ftp1 attach-agent $tcp1
> $ns_ at $opt(ftp1-start) "$ftp1 start"
>
> set tcp2 [new Agent/TCP]
> $tcp2 set class_ 2
> set sink2 [new Agent/TCPSink]
> $ns_ attach-agent $MH(1) $tcp2
> $ns_ attach-agent $W(0) $sink2
> $ns_ connect $tcp2 $sink2
> set ftp2 [new Application/FTP]
> $ftp2 attach-agent $tcp2
> $ns_ at $opt(ftp1-start) "$ftp2 start"
>
> set tcp3 [new Agent/TCP]
> $tcp3 set class_ 2
> set sink3 [new Agent/TCPSink]
> $ns_ attach-agent $MH(0) $tcp3
> $ns_ attach-agent $MH(2) $sink3
> $ns_ connect $tcp3 $sink3
> set ftp3 [new Application/FTP]
> $ftp3 attach-agent $tcp3
> $ns_ at $opt(ftp1-start) "$ftp3 start"
>
> # source connection-pattern and node-movement scripts
> if { $opt(cp) == "" } {
>    puts "*** NOTE: no connection pattern specified."
>        set opt(cp) "none"
> } else {
>    puts "Loading connection pattern..."
>    source $opt(cp)
> }
> if { $opt(sc) == "" } {
>    puts "*** NOTE: no scenario file specified."
>        set opt(sc) "none"
> } else {
>    puts "Loading scenario file..."
>    source $opt(sc)
>    puts "Load complete..."
> }
>
> # Define initial node position in nam
>
> for {set i 0} {$i < $opt(nn)} {incr i} {
>
>    # 10 defines the node size in nam, must adjust it according to your
>    # scenario
>    # The function must be called after mobility model is defined
>
>    $ns_ initial_node_pos $MH($i) 10
> }
>
> # Tell all nodes when the siulation ends
> for {set i 0} {$i < $opt(nn) } {incr i} {
>    $ns_ at $opt(stop).0 "$MH($i) reset";
> }
> $ns_ at $opt(stop).0 "$HA reset";
> $ns_ at $opt(stop).0 "$FA reset";
>
> $ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
> $ns_ at $opt(stop).0001 "stop"
> proc stop {} {
>    global ns_ tracefd namtrace
>    close $tracefd
>    close $namtrace
> }
>
> # some useful headers for tracefile
> puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp \
>    $opt(adhocRouting)"
> 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
>
> Thank you very much.
>
> Best regards,
>                  Eric
>
>
>

Reply via email to