Hi every body 

I have to make a scenario for wlans with one AP and some nodes, for that i use 
the tcl below , but in it i didn't use "set udp [new-agent]

---tcl used------
 # --------------------------------------------------------------
 # My TCL code is in the following:
 # --------------------------------------------------------------

 # Define Options
 set val(chan)           Channel/WirelessChannel    ;# channel type
 set val(prop)           Propagation/TwoRayGround   ;# radio-propagation model
 set val(netif)          Phy/WirelessPhy            ;# network interface type
set val(mac)            Mac/802_11                 ;# MAC type
set val(ifq)            Queue/DropTail/PriQueue    ;# interface queue type
set val(ll)             LL                         ;# link layer type
set val(ant)            Antenna/OmniAntenna        ;# antenna model
 set val(ifqlen)        50               ;# max packet in ifq
set val(nn)               7               ;# number of mobile nodes
 set val(rp)            DumbAgent           ;# routing protocol
 set val(x)              600                   ;# X dimension of topography
 set val(y)            600                   ;# Y dimension of topography
set val(stop)           50               ;# time of simulation end


 #DSSS (IEEE802.11b)
   Mac/802_11 set SlotTime_          0.000020        ;# 20us
  Mac/802_11 set SIFS_              0.000010        ;# 10us
   Mac/802_11 set PreambleLength_    144             ;# 144 bit
   Mac/802_11 set PLCPHeaderLength_  48              ;# 48 bits
   Mac/802_11 set PLCPDataRate_      1.0e6           ;# 1Mbps
   Mac/802_11 set dataRate_          11.0e6          ;# 11Mbps
   Mac/802_11 set basicRate_         1.0e6           ;# 1Mbps
   Mac/802_11 set RTSThreshold_      3000         ;# Disable RTS/CTS
# frequency is 2.4 GHz
   Phy/WirelessPhy set freq_          2.4e+9

 # Main Program
 set ns [new Simulator]
 set tracefile [open Roaming-out.tr w]
set namtrace [open Roaming-out.nam w]
 $ns trace-all $tracefile
 $ns namtrace-all-wireless $namtrace $val(x) $val(y)

 $ns color 1 Blue

 # Set up topography object
 set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create god (node)
 create-god $val(nn)

 # Create channel
 set chan_1_ [new $val(chan)]
 # Configure the wireless nodes
    $ns node-config -adhocRouting $val(rp) \
           -llType $val(ll) \
            -macType $val(mac) \
            -ifqType $val(ifq) \
            -ifqLen $val(ifqlen) \
            -antType $val(ant) \
            -propType $val(prop) \
            -phyType $val(netif) \
            -topoInstance $topo \
            -agentTrace OFF \
            -routerTrace OFF \
            -macTrace ON \
            -movementTrace ON \
            -channel $chan_1_

 for {set i 0} {$i < $val(nn)} {incr i} {
    set node_($i) [$ns node]
    $node_($i) random-motion 0              ;# disable random motion
      set node_($i) [$node_($i) getMac 0]
  
 
 }

 #Set node_(0) and node_(1) as the APs

 set AP_ADDR1 [$node_(0) id]
 $node_(0) ap $AP_ADDR1
 $node_(0) ScanType PASSIVE
 #$node_(0) set BeaconInterval_ 0.2
 $node_(0) set X_ 100.0
 $node_(0) set Y_ 300.0
 $node_(0) set Z_ 0.0

 #set AP_ADDR2 [$node_(1) id]
  #$node_(1) ap $AP_ADDR2
  #$node_(1) ScanType PASSIVE
 #$node_(1) set BeaconInterval_ 0.2
 #$node_(1) set X_ 500.0
  #$node_(1) set Y_ 300.0
  #$node_(1) set Z_ 0.0
 $ns at 0.4 "$node_(1) ScanType ACTIVE"
 $ns at 0.5 "$node_(2) ScanType ACTIVE"
 $ns at 1.0 "$node_(3) ScanType ACTIVE"
 $ns at 1.5 "$node_(4) ScanType ACTIVE"
 $ns at 2.0 "$node_(5) ScanType ACTIVE"
 $ns at 2.5 "$node_(6) ScanType ACTIVE"
 $node_(1) set X_ 100.0
 $node_(1) set Y_ 100.0
 $node_(1) set Z_ 0.0
 $node_(2) set X_ 120.0
 $node_(2) set Y_ 190.0
 $node_(2) set Z_ 0.0
 $node_(3) set X_ 210.0
 $node_(3) set Y_ 210.0
 $node_(3) set Z_ 0.0
 $node_(4) set X_ 150.0
 $node_(4) set Y_ 350.0
 $node_(4) set Z_ 0.0
 $node_(5) set X_ 80.0
 $node_(5) set Y_ 450.0
 $node_(5) set Z_ 0.0
 $node_(6) set X_ 40.0
 $node_(6) set Y_ 200.0
 $node_(6) set Z_ 0.0


 # Define node initial position in nam
 for {set i 0} {$i < $val(nn)} {incr i} {
    # 1 defines the node size for name
    $ns initial_node_pos $node_($i) 20
 }

 # Telling nodes when the simulation ends
 for {set i 0} {$i < $val(nn)} {incr i} {
    $ns at $val(stop) "$node_($i) reset";
 }

 # ending nam and the simulation
 $ns at $val(stop) "$ns nam-end-wireless $val(stop)"
 $ns at $val(stop) "stop"
 $ns at 50.1 "puts \"end simulation\" ; $ns halt"
 proc stop {} {
    global ns tracefile namtrace
    $ns flush-trace
    close $tracefile
    close $namtrace
    exec nam Roaming-out.nam &
 }

 # informative headers for CMUTracefile
 puts $tracefile "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(rp)"
 puts $tracefile "M 0.0 prop $val(prop) ant $val(ant)"

 puts "Starting Simulation..."
 $ns run
--------- end tcl

I run this example, and the nam is ok, and the trace file is:

s 0.000550000 _0_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.001126000 _1_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.001126000 _2_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.001126000 _3_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.001126000 _4_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.001126000 _5_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.001126000 _6_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
s 0.100810000 _0_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.101386000 _1_ MAC  --- 0 BCN 72 [0 ffffffff 0 0] 
r 0.101386000 _2_ MAC  --- 0 BCN 72 [0 ffffffff 0 0]

-------------
i find it not logic since i don't used a traffic....

My problem that whan according an agents to nodes, I have a problem 
with attaching agent to nodes.

Please some help
 





      

Reply via email to