Hello Everyone,

I am doing a simulation on wireless mesh
network. I have created a scenario. But  i have few problems. Hope you
will help me.My problems are...

1. In case of wireless to wireless transmission my code is not using
any base stations. So I want to change the transmission range of the
mobile nodes (so that they use the base station for wireless to
wireless transmission.)

2. why my nodes are overlapped. Though i have set the node position??

3. Is the Base station creation have any problem??

4.Finally what is the function of 

Phy/WirelessPhy set CSThresh_ 
Phy/WirelessPhy set RXThresh_
Phy/WirelessPhy set Pt_
 
Phy/WirelessPhy set Pt_ 

these variables?? From where I can change the value of these  variables?

Please answer my questions. I have 10 days left for submitting my project.

My code is given below...

################################################################
# wireless simulation related parameters                       #
################################################################
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)             9                          ;# number of mobilenodes
set opt(adhocRouting)   DSDV                       ;# routing protocol
set opt(x)             670                        ;# x coordinate of topology
set opt(y)         
 670                        ;# y coordinate of topology

set opt(cp)             ""                         ;# connection pattern file
set opt(sc)         ""                   ;# node movement file. 

set opt(seed)   0.0                            ;# seed for random number gen.
set opt(stop)  
 5                            ;# time to stop simulation

set opt(ftp1-start)      1.7
set opt(ftp2-start)      3.0
set opt(ftp3-start)      2.0
set opt(ftp4-start)      2.5

set num_wired_nodes      3
set num_bs_nodes         3

################################################################
# Initialization                                               #
# 1. create
 simulator                                          #
# 2. tracing                                                   #
# 3. define topography                                         #
################################################################
set ns_        [new
 Simulator]

set tracefd     [open mesh.tr w]
$ns_ trace-all   $tracefd
set namtracefd    [open mesh.nam w]
$ns_ namtrace-all-wireless $namtracefd $opt(x) $opt(y)

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

create-god [expr $opt(nn) + $num_bs_nodes]

# 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)
}

################################################################
# Define/create/initialize
 nodes                               #
# 1. define nodes                                              #
# 2. create nodes                                              #
# 3. disable random
 motion                                     #
# 4. coordinates of wilress nodes                              #
# 5. nam setting, size and position                            #
################################################################

# set up for hierarchical routing
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 4           ;# number of domains
lappend cluster_num 3 1 1
 1            ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 1 4 4 4        ;# number of nodes in each cluster 
AddrParams set nodes_num_ $eilastlevel ;# of each domain


#create wired nodes
set temp {0.0.0 0.1.0 0.2.0}        ;# hierarchical addresses for wired domain
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns_ node [lindex $temp $i]] 
}

$W(0) set X_ 95.0
$W(0) set Y_ 146.0
$W(0) set Z_ 0.0

$W(1) set X_ 36.0
$W(1) set Y_ 113.0
$W(1) set Z_ 0.0

$W(2) set X_ 24.0
$W(2) set Y_ 62.0
$W(2) set Z_ 0.0

# 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 ON \
                 -macTrace ON 

#create base-station node

set temp1 {1.0.0 1.0.1 1.0.2 1.0.3}   ;# hier address to be used for wireless
                     ;# domain
set temp2 {2.0.0 2.0.1 2.0.2 2.0.3}

set temp3 {3.0.0 3.0.1 3.0.2 3.0.3}

set BS(0) [$ns_ node [lindex $temp1 0]]
$BS(0) random-motion
 0               ;# disable random motion
set BS(1) [$ns_ node [lindex $temp2 0]]
$BS(1) random-motion 0               ;# disable random motion
set BS(2) [$ns_ node [lindex $temp3 0]]
$BS(2) random-motion 0               ;# disable random motion

# create mobilenodes in the same domain as BS(0)  
# note the position and movement of mobilenodes is as defined
# in $opt(sc)

#configure for mobilenodes
$ns_ node-config -wiredRouting OFF


  for {set j 0} {$j < 3} {incr j} {
    set node_($j) [ $ns_ node [lindex $temp1 \
        [expr $j+1]] ]
    $node_($j) base-station [AddrParams addr2id \
   
     [$BS(0) node-addr]]
}

for {set j 3} {$j < 6} {incr j} {
    set node_($j) [ $ns_ node [lindex $temp2 \
        [expr $j-2]] ]
    $node_($j) base-station [AddrParams addr2id \
        [$BS(1) node-addr]]
}

for {set j 6} {$j < 9} {incr j} {
    set node_($j) [ $ns_ node [lindex $temp3 \
        [expr $j-5]] ]
    $node_($j) base-station [AddrParams addr2id \
        [$BS(2) node-addr]]
}

#provide some co-ord (fixed) to base station node
$BS(0) set X_ -43.0
$BS(0) set Y_ 138.0
$BS(0) set Z_ 0.0

$BS(1) set X_ -55.0
$BS(1) set Y_ 35.0
$BS(1) set Z_ 0.0

$BS(2) set X_ 128.0
$BS(2) set Y_ 42.0
$BS(2) set Z_ 0.0

#create links between wired and BS nodes

$ns_
 duplex-link $W(0) $W(1) 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $W(2) 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $BS(0) 5Mb 2ms DropTail
$ns_ duplex-link $W(2) $BS(1) 5Mb 2ms DropTail
$ns_ duplex-link $W(2) $BS(2) 5Mb 2ms DropTail

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

################################################################
# Define initial node position in nam                          #
################################################################

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

    $ns_ initial_node_pos $node_($i) 10
}     

$node_(0) set X_  -21.0
$node_(0) set Y_  162.0
$node_(0) set Z_    0.0

$node_(1) set X_ 
 -98.0
$node_(1) set Y_  146.0
$node_(1) set Z_    0.0

$node_(2) set X_  -70.0
$node_(2) set Y_  102.0
$node_(2) set Z_    0.0

$node_(3) set X_ -122.0
$node_(3) set Y_   14.0
$node_(3) set Z_    0.0

$node_(4) set X_  -60.0
$node_(4) set Y_  -10.0
$node_(4) set Z_    0.0

$node_(5) set X_  -11.0
$node_(5) set Y_    4.0
$node_(5) set Z_    0.0

$node_(6) set X_ -104.0
$node_(6) set Y_   -2.0
$node_(6) set Z_    0.0

$node_(7) set X_  182.0
$node_(7) set Y_    7.0
$node_(7) set Z_    0.0

$node_(8) set X_  190.0
$node_(8) set Y_   70.0
$node_(8) set Z_    0.0

################################################################
# Create traffic:
 TCP connection                               #
################################################################

####### Source Node 0 of BS 0--> wired 0  ########
set tcp1 [new Agent/TCP/Newreno]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $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"

####### Source wired 1--> Node 2 of BS 1  ########
set tcp2 [new Agent/TCP/Newreno]
$tcp2 set class_ 2
set sink2 [new Agent/TCPSink]
$ns_ attach-agent $W(1) $tcp2
$ns_ attach-agent $node_(5) $sink2
$ns_ connect $tcp2 $sink2
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
$ns_ at
 $opt(ftp2-start) "$ftp2 start"

####### Source Node 1 BS 1--> Node 2 of BS 2  ########
set tcp3 [new Agent/TCP/Newreno]
$tcp3 set class_ 2
set sink3 [new Agent/TCPSink]
$ns_ attach-agent $node_(4) $tcp3
$ns_ attach-agent $node_(7) $sink3
$ns_ connect $tcp3 $sink3
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
$ns_ at $opt(ftp3-start) "$ftp3 start"

####### Source Node 0 BS 2--> Node 1 of BS 0  ########
set tcp4 [new Agent/TCP/Newreno]
$tcp4 set class_ 2
set sink4 [new Agent/TCPSink]
$ns_ attach-agent $node_(6) $tcp4
$ns_ attach-agent $node_(1) $sink4
$ns_ connect $tcp4 $sink4
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
$ns_ at $opt(ftp4-start) "$ftp4 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..."
}


################################################################
# Schedule events                                              #
################################################################
#$ns_ at 0.5
 "$node_(1) setdest 250.0 250.0 400.0"
#$ns_ at 2.0 "$node_(0) setdest 130.0 30.0  400.0"
#$ns_ at 1.0 "$node_(2) setdest 30.0  130.0 400.0"

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

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

################################################################
# 'stop' procedure                                             #
################################################################
proc stop {} {
   
 global ns_ tracefd namtracefd
    $ns_ flush-trace
    close $tracefd
    close $namtracefd
    exec nam mesh.nam &
    exit 0
}

# informative headers for CMUTracefile
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)"


################################################################
# start the simulation                                         #
################################################################
puts "Starting Simulation..."
$ns_
 run

#############################

Thanks in advance....

, Sajeeb Saha
10th Batch,CSEDU
+8801914754181



      New Email addresses available on Yahoo!
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/

Reply via email to