Hi ns-users,
I have installed in ns-2.30 pach MW-node, 
http://www.q2s.ntnu.no/~paquerea/ns.html
through my script, would purely like to simulate a net wireless, where 
presents of Access Point (2) and the mobile nodes(3). Access Point 
communicate between them through the standard 802.11a, while the mobile 
nodes only communicate cross Access Point with the standard 802.11b/gm. 
Therefore Access Point need 2 interfaces with different settings ( 
802.11a, 802.11b/g ) using pach and the commands I have found in the 
manual tried to set up all these elements in my script:

global val_
set val_(channel)        Channel/Wireless        ;# channel
set val_(propagation) Propagation/TwoRayGround ;# radio-propagation model

set val_a(phy)             Phy/WirelessPhy          ;# physical layer
set val_b(phy)             Phy/WirelessPhy          ;# physical layer

set val_a(mac)             Mac/802_11               ;# mac layer
set val_b(mac)             Mac/802_11               ;# mac layer

set val_(ifq)                  Queue/DropTail/PriQueue  ;# interface 
queue type
set val_(ll)                     LL                       ;# link layer type
set val_(antenna)         Antenna/OmniAntenna      ;# antenna model
set val_(ifqlen)             50                       ;# max packet in ifq

set val_(routing)          InterfaceWirelessRoutingProtocol       ;# routing

set val_(x)                    150
set val_(y)                    150
set val_(tr)                   esercizi/out4.tr                   ;# 
trace file
set val_(namtr)            esercizi/out4.nam                  ;# nam 
trace file
set val_(stopTime)       15


proc init {} {
    global val_ tracefd_ namfd_ ns_
    set ns_ [new Simulator]
    set tracefd_ [open ./$val_(tr) w]
    $ns_ trace-all $tracefd_
    set namfd_ [open ./$val_(namtr) w]
    $ns_ namtrace-all-wireless $namfd_ $val_(x) $val_(y)
}

proc finish {} {
    global val_ tracefd_ namfd_ ns_ node_
    for {set i 0} {$i < $val_(nMn) } {incr i} {
    $ns_ at $val_(stopTime) "$node_($i) reset"
    }
    $ns_ flush-trace
    close $tracefd_
    close $namfd_
    exit 0
}

global ns_

init


         $val_a(mac) set SlotTime_          0.000050        ;# 50us
         $val_a(mac) set SIFS_              0.000028        ;# 28us
         $val_a(mac) set PreambleLength_    0               ;# no preamble_
         $val_a(mac) set PLCPHeaderLength_  128             ;# 128 bits
         $val_a(mac) set PLCPDataRate_      1.0e6           ;# 1Mbps
         $val_a(mac) set dataRate_          54.0e6          ;# 54Mbps
         $val_a(mac) set basicRate_         1.0e6           ;# 1Mbps

###################802.11b/g
        
         $val_b(mac) set SlotTime_          0.000020        ;# 20us
         $val_b(mac) set SIFS_              0.000010        ;# 10us
         $val_b(mac) set PreambleLength_    144             ;# 144 bits 
preamble
         $val_b(mac) set PLCPHeaderLength_  48              ;# 48 bits
         $val_b(mac) set PLCPDataRate_      1.0e6           ;# 1Mbps
         $val_b(mac) set dataRate_          11.0e6          ;# 11Mbps or 
54Mbps(802.11g)
         $val_b(mac) set basicRate_         1.0e6           ;# 1Mbps

         $val_a(phy) set Pr_ 8.9175e-10 
         $val_a(phy) set Pt_ 0.2818
         $val_a(phy) set freq_ 5.0e+9
                        # Receive sensitivity.
     #./threshold.out -m TwoRayGround -r 0.95 -Pt 0.2818 -Gt 1 -Gr 1 -fr 
5.0e+9 200; Calcola RXThresh_
         $val_a(phy) set RXThresh_  1.60607e-10                        
         $val_a(phy) set CSThresh_ [expr 0.9*[$val_a(phy) set RXThresh_]]  

         $val_b(phy) set Pr_ 8.9175e-10 
         $val_b(phy) set Pt_ 0.007214    
         $val_b(phy) set freq_ 2.4e+9
         $val_b(phy) set RXThresh_  7.138e-11
         $val_b(phy) set CSThresh_ [expr 0.9*[$val_b(phy) set RXThresh_]]

########## 802.11g
         $val_b(phy) set DSSS_CWMin             15
         $val_b(phy) set DSSS_CWMax             1023
         $val_b(phy) set DSSS_SlotTime         0.000009   
         $val_b(phy) set DSSS_CCATime          0.000003   
         $val_b(phy) set DSSS_RxTxTurnaroundTime     0.000002   
         $val_b(phy) set DSSS_SIFSTime         0.000016    
         $val_b(phy) set DSSS_PreambleLength     96
         $val_b(phy) set DSSS_PLCPHeaderLength     40   
         #$val_b(phy) set DSSS_PLCPDataRate       6.0e6    // 6Mbps
         #$val_b(phy) set DSSS_MaxPropagationDelay    0.0000005    // 0.5us

#---create topography
set topography_ [new Topography]
$topography_ load_flatgrid $val_(x) $val_(y)

$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 1
lappend cluster_num 2
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 3 2
AddrParams set nodes_num_ $eilastlevel
puts "Configuration of hierarchical addressing done"


# init GOD
create-god 5

$ns_ wireless-config    -routing        $val_(routing)\
                        -mac            $val_a(mac)\
                        -phy            $val_a(phy) \
                        -channel        [new $val_(channel)] \
                        -propagation    [new $val_(propagation)] \
                        -topography     $topography_ \
                        -ll             $val_(ll) \
                        -ifq            $val_(ifq) \
                        -ifq-length     $val_(ifqlen) \
                        -antenna        $val_(antenna) \
                        -xyz-trace      on \
                        -ifq-trace      on \
                        -mac-trace      on \
                        -rtm-trace      on \
                        -eot-trace      off


#---portal node
$ns_ node-config -wireless +Portal
 set node_AP(0) [$ns_ node 1.1.0]                                      
   ;#Access Point(0)  with 2 interfaces
 
   set net_a(0) [$node_AP(0) add-interface "Wireless"]        ;# add 
wireless interface
   $node_AP(0) set-position 50.0 50.0 0.0

   ;#interface  802.11b/g
   $ns_ wireless-config     -channel  [new Channel/Wireless] \
                            -mac     $val_b(mac) \
                            -phy     $val_b(phy)

   set net_b(0) [$node_AP(0) add-interface "Wireless"]


#                         AP(1)
$ns_ wireless-config -channel  [new Channel/Wireless] \
                     -mac     $val_a(mac) \
                     -phy     $val_a(phy)

$ns_ node-config -wireless +Portal     ;# enable Portal support
set node_AP(1) [$ns_ node 1.2.0]

set net_a(1) [$node_AP(1) add-interface "Wireless"]            ;# add 
wireless interface
$node_AP(1) set-position [expr 80.0] 50.0 0.0

;#interface 802.11b/g
   $ns_ wireless-config     -channel [new Channel/Wireless] \
                            -mac     $val_b(mac) \
                            -phy     $val_b(phy)

   set net_b(1) [$node_AP(1) add-interface "Wireless"]

#---wireless and mobile node
# enable base wireless and mobility support

 $ns_ wireless-config -channel [new Channel/Wireless] \
                       -mac     $val_b(mac) \
                       -phy     $val_b(phy)

  $ns_ node-config -wireless +Base -mobility +Base
  set node_(0) [$ns_ node 1.1.1]

  set wif_b(0) [$node_(0) add-interface "Wireless"]           ;# add 
wireless interface
  $wif_b(0) add-default-route $node_AP(0)                        ;# use 
node_AP(0) as a base station

  $node_(0) set-position 5.0 5.0 0.0


  $ns_ wireless-config -channel  [new Channel/Wireless] \
                       -mac     $val_b(mac) \
                       -phy     $val_b(phy)

  $ns_ node-config -wireless +Base -mobility +Base
  set node_(1) [$ns_ node 1.1.2]

  set wif_b(0) [$node_(1) add-interface "Wireless"]           ;# add 
wireless interface
  $wif_b(0) add-default-route $node_AP(0)                        ;# use 
node_AP(0) as a base station

  $node_(1) set-position 20.0 5.0 0.0

 $ns_ node-config -wireless +Base -mobility +Base
  set node_(2) [$ns_ node 1.2.1]
  $ns_ wireless-config -channel  [new Channel/Wireless] \
                       -mac     $val_b(mac) \
                       -phy     $val_b(phy)

   set wif_b(1) [$node_(2) add-interface "Wireless"]           ;# add 
wireless interface
  $wif_b(1) add-default-route $node_AP(1)                         ;# use 
node_AP(1) as a base station

  $node_(2) set-position 100.0 0.0 0.0

 #----wireless nodes positioning
 # $node_(0) set-position [expr 50.0] 0.0 0.0

  #----mobility
  $ns_ at 0.0 "$node_(0) set-mobility [expr 60.0] [expr 60.0] 1.0"
  $ns_ at 10.0 "$node_(0) set-speed 0.5"

 $net_a(0) add-default-route $node_AP(1)
 $net_a(1) add-default-route $node_AP(0)
...............
..........

I would like to know:
1) is correct setting up the interfaces this way, according to the 
standards 802.11a, 802.11b/g?
2) must every access point have an interface for any other access point 
which communicates with? This way already with 3 access point the 
configuration becomes hard!
3) How do I structure the mechanism of handover?

Sorry for my English.
I infinitely thank you for any advice
Elena

Reply via email to