[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Question about wireless support in ns 2.1b7 / nam 1.0a9
You can't work with a multicast and wireless environment at the same time.
The BSs nodes and Mobile nodes don't support multicast...
Hope it helps.
Cheers,
Ana
>From: [email protected]
>To: [email protected]
>Subject: [ns] Question about wireless support in ns 2.1b7 / nam 1.0a9
>Date: Wed, 28 Jun 2000 03:11:34 -0700 (PDT)
>
>[LinuxPPC 2.2.16 / 224MB RAM / gcc 2.95.2 / glibc 2.1.3-4b]
>
>I'm trying to merge the mcast.tcl and wireless2.tcl scripts to simulate a
>multicast to a group of wireless machines, but keep having problems
>creating the base station node (line 139) once I add the "-multicast on"
>flag to the simulation creator. Here is the code:
>
>#
># Copyright (c) 1996 Regents of the University of California.
># All rights reserved.
>#
># Redistribution and use in source and binary forms, with or without
># modification, are permitted provided that the following conditions
># are met:
># 1. Redistributions of source code must retain the above copyright
># notice, this list of conditions and the following disclaimer.
># 2. Redistributions in binary form must reproduce the above copyright
># notice, this list of conditions and the following disclaimer in the
># documentation and/or other materials provided with the distribution.
># 3. All advertising materials mentioning features or use of this software
># must display the following acknowledgement:
># This product includes software developed by the MASH Research
># Group at the University of California Berkeley.
># 4. Neither the name of the University nor of the Research Group may be
># used to endorse or promote products derived from this software without
># specific prior written permission.
>#
># THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
># ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
># IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>PURPOSE
># ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
># FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>CONSEQUENTIAL
># DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
># OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
># HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
>STRICT
># LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
># OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
># SUCH DAMAGE.
>#
># @(#) $Header: /usr/src/mash/repository/vint/ns-2/tcl/ex/mcast.tcl,v 1.12
>1999/09/10 22:08:41 haoboy Exp $
># updated to use -multicast on and allocaddr by Lloyd Wood
>
>#
># Simple multicast test. It's easiest to verify the
># output with the animator.
># We create a four node start; start a CBR traffic generator in the center
># and then at node 3 and exercise the join/leave code.
>#
># See tcl/ex/newmcast/mcast*.tcl for more mcast example scripts
>
># ======================================================================
># Define options
># ======================================================================
>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) 15 ;# number of
>mobilenodes
>set opt(adhocRouting) DSDV ;# routing protocol
>
>set opt(cp) "" ;# connection pattern
>file
>set opt(sc) "scen" ;# node movement file.
>
>set opt(x) 2000 ;# x coordinate of topology
>set opt(y) 2000 ;# y coordinate of topology
>set opt(seed) 0.0 ;# seed for random number
>gen.
>set opt(stop) 500 ;# time to stop simulation
>
>set opt(ftp1-start) 160.0
>set opt(ftp2-start) 170.0
>set opt(udp-start) 0
>
>set num_wired_nodes 2
>set num_bs_nodes 1
>
>#
>============================================================================
># 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)
>}
>
>
>set ns [new Simulator -multicast on]
>
>$ns node-config -addressType hierarchical
>AddrParams set domain_num_ 2 ;# number of domains
>lappend cluster_num 2 1 ;# number of clusters in each domain
>AddrParams set cluster_num_ $cluster_num
>lappend eilastlevel 1 1 [expr $opt(nn) + 1] ;# number of nodes in each
>cluster
>AddrParams set nodes_num_ $eilastlevel ;# of each domain
>
>set tracefd [open out.tr w]
>set namtrace [open 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
>create-god $opt(nn)
>set god_ [God instance]
>
>#create wired nodes
>set temp {0.0.0 0.1.0} ;# hierarchical addresses for wired domain
>for {set i 0} {$i < $num_wired_nodes} {incr i} {
> set W($i) [$ns node [lindex $temp $i]]
>}
>
># configure for base-station node
>
>$ns node-config -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 OFF \
> -macTrace OFF
>
>$ns color 1 red
># prune/graft packets
>$ns color 30 purple
>$ns color 31 bisque
>
>set temp {1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
>1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19
>1.0.20}
> ;# hier address to be used for
>wireless
> ;# domain
>set BS(0) [$ns node [lindex $temp 0]]
>$BS(0) random-motion 0 ;# disable random motion
>
>#provide some co-ord (fixed) to base station node
>$BS(0) set X_ 1.0
>$BS(0) set Y_ 2.0
>$BS(0) set Z_ 0.0
>
>#configure for mobilenodes
>$ns node-config -wiredRouting OFF
>
> for {set j 0} {$j < $opt(nn)} {incr j} {
> set node_($j) [ $ns node [lindex $temp \
> [expr $j+1]] ]
> $node_($j) base-station [AddrParams set-hieraddr \
> [$BS(0) node-addr]]
>}
>
>
>$ns duplex-link $W(0) $W(1) 5Mb 2ms DropTail
>$ns duplex-link $W(1) $BS(0) 5Mb 2ms DropTail
>
>$ns duplex-link-op $W(0) $W(1) orient down
>$ns duplex-link-op $W(1) $BS(0) orient left-down
>
>set mproto DM
>set mrthandle [$ns mrtproto $mproto {}]
>set group0 [Node allocaddr]
>
>set udp0 [new Agent/UDP]
>$ns attach-agent $node_(1) $udp0
>$udp0 set dst_addr_ $group0
>$udp0 set dst_port_ 0
>set cbr0 [new Application/Traffic/CBR]
>$cbr0 attach-agent $udp0
>
>
>set rcvr [new Agent/LossMonitor]
>
>for {set j 0} {$j < $opt(nn)} {incr j} {
> $ns attach-agent $node_($j) $rcvr
> $ns at 1.2 "$node_($j) join-group $rcvr $group0"
>}
>
>$ns at 1.0 "$cbr0 start"
>
>$ns at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns halt"
>$ns at $opt(stop).0001 "finish"
>
>proc finish {} {
> global ns
> $ns flush-trace
>
> puts "running nam..."
> exec nam out.nam &
> exit 0
>}
>
>$ns run
>
________________________________
Ana Delgado
Centre for Telecommunications Research
King's College London
London England
[email protected]
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com