[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[n+1]: [ns] MAC-TDMA & Wireless



Hello,

I also want to use TDMA as MAC but ns crash when I use it:
Program received signal SIGSEGV, Segmentation fault.
0x80bf827 in MacTdma::radioSwitch (this=0x85d9300, i=1) at
mac-tdma.cc:454
454             EnergyModel *em = netif_->node()->energy_model();

I use ns-2.1b7 under Linux SuSe 6.3
to configure my nodes i do the following:
	1/ I create nodes from the wired domain:
	2/ I create Base-stations
	3/ I create mobile nodes

Rmq: if I use MAC/802_11 ns works fine.
	
---------- myscript.tcl ---------------
set opt(channels) "wireless_channel.tcl"  ;# param�tres des liaisons
radio
set opt(sources)  "sources.tcl"              ;# traffic dans le r�seau

set opt(cp)     ""               ;# connection pattern file
set opt(sc)     "scen-3-test"    ;# node movement file.

set opt(x)      670              ;# x coordinate of topology
set opt(y)      670              ;# y coordinate of topology
set opt(seed)   0.0              ;# seed for random number gen.
set opt(stop)   [lindex $argv 0] ;# time to stop simulation

set opt(nn)              3       ;# number of mobilenodes
set num_wired_nodes      3
set num_bs_nodes         1

puts "Loading wireless channels parameters. . ."
source $opt(channels)
puts "done"

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_ 2
lappend cluster_num 1
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 3 4
AddrParams set nodes_num_ $eilastlevel
	
# setup topography object
set topo	[new Topography]
# define topology
$topo load_flatgrid $opt(x) $opt(y)

# Create God
set god_ [create-god $opt(nn)]

# create nodes from the wired domain
set temp {0.0.0 0.0.1 0.0.2}
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns_ node [lindex $temp $i]] 
    $W($i) label "W $i"
}

# configure base stations nodes
$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 ON \
    -macTrace ON

set temp {1.0.0 1.0.1 1.0.2 1.0.3}   ;# hier address to be used for
wireless
                                     ;# domain
set BS(0) [$ns_ node [lindex $temp 0]]
$BS(0) random-motion 0               ;# mouvement pas al�atoire
$BS(0) label "BS0"
$BS(0) set X_ 5.0
$BS(0) set Y_ 2.0
$BS(0) set Z_ 0.0

# mobiles nodes
$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 addr2id \
				 [$BS(0) node-addr]]
    $node_($j) label "MN $j"
}

# links
$ns_ duplex-link $W(0) $W(2)  1Mb 10ms DropTail
$ns_ duplex-link $W(1) $W(2)  1Mb 10ms DropTail
$ns_ duplex-link $W(2) $BS(0) 1Mb 10ms DropTail

$ns_ duplex-link-op $W(0) $W(2)  orient left-down
$ns_ duplex-link-op $W(1) $W(2)  orient right-down
$ns_ duplex-link-op $W(2) $BS(0) orient down

$ns_ queue-limit $W(0) $W(2) 15
$ns_ queue-limit $W(1) $W(2) 15

$ns_ queue-limit $W(2) $BS(0) 16
$ns_ queue-limit $BS(0) $W(2) 16

puts "Loading traffic info. . ."
source $opt(sources)
puts "done"

----- wireless_channel.tcl ----------
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/Tdma
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(adhocRouting)   NOAH                       ;# routing protocol

Mac/Tdma set bandwidth_       512Kb

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.28183815
Phy/WirelessPhy set freq_ 914e+6 
Phy/WirelessPhy set L_ 1.0
Phy/WirelessPhy set bandwidth_ 1e5
----------------------------------------------

I already read the file in tcl/test: test-suite-wireless-tdma.tcl 
but i don't see what is wrong in my script.
Can someone help me?


Xuan Chen wrote:
> 
> Please refer to mac_tmda.{cc, h} for details. There is also a test suite
> for TDMA under ns/tcl/test.
> 
> Hope it helps,
> -chen xuan
> 
> On Tue, 24 Jul 2001 [email protected] wrote:
> 
> > Thanks Xuan Chen,
> >
> > Can you tell me more or where I can get more information on this?
> >
> > Regards,
> > Terence
> >
> > Quoting Xuan Chen <[email protected]>:
> >
> > > We also have a simple preamble-based TDMA supported in ns.
> > >
> > > On Tue, 24 Jul 2001 [email protected] wrote:
> > >
> > > > Hi Seniors,
> > > >
> > > > Can I use TDMA as MAC in a wireless simulation? It seems to work but
> > > my
> > > > colleague told me that only 802.11 is supported in MAC.
> > > >
> > > > Regards,
> > > > Terence
> > > >
> > >
> > > --
> > > Xuan Chen
> > > USC/ISI
> > >
> > >
> >
> >
> >
> > Regards,
> > Terence
> > DSO/DS/IEP
> > DID 7727252
> >
> 
> --
> Xuan Chen
> USC/ISI