[ns] what is invalid command "PLevels" and how to install semi package
Nikheel Kumar
iamnikheel at gmail.com
Fri Apr 17 02:29:02 PDT 2009
*hello friends,
i want to simulate various wireless scenario, i m using semipackage
"ns-afedcf" i don't know how to install it in ns-2.31.here some lines of tcl
script "main.tcl" of package to access different wireless scenario:*
# Set defaults; its important to set defaults before parsing
# command line arguments, so that defaults can be overridden
set mode DCF ;# mode for this test DCF/PCF
set pcf_period 0 ;# CFP period for pcf mode
set pcf_duration 0 ;# CFP duration for pcf mode
set endtime 15.0 ;# duration of the simulation
set title_ "snenario-test" ;# default title for the
scenario
set idea_mac 0 ;# default cleverness of mac
;# 0 - normal
;# 1 - persistent slotting
;# 0 - PDCF
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(rp) DSDV ;#
set val(x) 50
set val(y) 50
Phy/WirelessPhy set CPThresh_ 2000
Phy/WirelessPhy set per_ 0.0
Mac/802_11 set bandwidth_ 36Mb
PLevels set max_plevels_ 8
PLevels set plevels_ 8
MAC_MIB set RTSThreshold_ 3000
MAC_MIB set ShortRetryLimit_ 7
MAC_MIB set LongRetryLimit_ 4
PHY_MIB set MinimumBandwidth_ 6Mb
PHY_MIB set SlotTime_ 0.000009
PHY_MIB set SIFS_ 0.000016
PHY_MIB set PreambleLength_ 20 ;#20us
PHY_MIB set PLCPHeaderLength_ 4 ;#4us
PHY_MIB set CCATime_ 3 ;#4us
PHY_MIB set RxTxTurnaroundTime_ 1 ;#1us
PHY_MIB set CWMin_0 31
PHY_MIB set CWMax_0 1023
PHY_MIB set CWMin_1 31
PHY_MIB set CWMax_1 1023
PHY_MIB set CWMin_2 15
PHY_MIB set CWMax_2 31
PHY_MIB set CWMin_3 7
PHY_MIB set CWMax_3 15
PHY_MIB set CWMin_4 0
PHY_MIB set CWMax_4 0
PHY_MIB set CWMin_5 0
PHY_MIB set CWMax_5 0
PHY_MIB set CWMin_6 0
PHY_MIB set CWMax_6 0
PHY_MIB set CWMin_7 0
PHY_MIB set CWMax_7 0
PHY_MIB set Aifsn_0 2
PHY_MIB set Aifsn_1 1
PHY_MIB set Aifsn_2 1
PHY_MIB set Aifsn_3 1
PHY_MIB set Aifsn_4 0
PHY_MIB set Aifsn_5 0
PHY_MIB set Aifsn_6 0
PHY_MIB set Aifsn_7 0
PHY_MIB set BackoffThresh_0 1 ;# 1 enable the
dynamic threshold for priority 0, 0 disable
PHY_MIB set BackoffThresh_1 1 ;# 1 enable the
dynamic threshold for priority 1, 0 disable
PHY_MIB set BackoffThresh_2 1 ;# 1 enable the
dynamic threshold for priority 2, 0 disable
PHY_MIB set BackoffThresh_3 1 ;# 1 enable the
dynamic threshold for priority 3, 0 disable
PHY_MIB set BackoffThresh_4 1 ;# 1 enable the
dynamic threshold for priority 4, 0 disable
PHY_MIB set BackoffThresh_5 1 ;# 1 enable the
dynamic threshold for priority 5, 0 disable
PHY_MIB set BackoffThresh_6 1 ;# 1 enable the
dynamic threshold for priority 6, 0 disable
PHY_MIB set BackoffThresh_7 1 ;# 1 enable the
dynamic threshold for priority 7, 0 disable
#PHY_MOB set CWPFactor_0 2 ;# 1 for linear, 2 default (binary
exponential) #
###########################################################################################
# Usage
if {$argc < 1} {
puts stderr "usage: ns $argv0 <scenario> \[list of options\]"
puts stderr " options:"
puts stderr " varName=varValue"
puts stderr " vectorName=value0,value1,value2..."
puts stderr " option example:"
puts stderr " num_nodes=15"
exit 1;
}
###########################################################################################
# Load up the scenario; allow it to override the above defaults
set scenario [lindex $argv 0]
set num_nodes [lindex $argv 1]
set random_num [lindex $argv 2]
puts "% set scenario $scenario"
puts "Running scenario $scenario"
puts "num_nodes $num_nodes"
source $scenario-scenario.tcl
###########################################################################################
# Parse remaining command line arguments to override any defaults
###########################################################################################
# Setup other vars
puts "Creating $num_nodes nodes"
# cookie appended to scenario name for filenames that are created
if {[info exists cookie]} {
set outfile_ $scenario.$cookie
} else {
set outfile_ $scenario
}
# num_bss_nodes describes the number of nodes in the BSS; the
# remaining nodes are ADHOC; default: all nodes are in the BSS
if {![info exists num_bss_nodes]} {
set num_bss_nodes $num_nodes
}
###########################################################################################
# Primary simulation objects
set ns_ [new Simulator]
$ns_ use-newtrace
set tracefd [open $outfile_.tr w]
$ns_ trace-all $tracefd
# set namtrace [open $outfile_.nam w]
# $ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create God
create-god $num_nodes
###########################################################################################
# Generic WLAN simulation objects
# Create channel #1
set chan_1_ [new $val(chan)]
# Configure nodes to be "attached" to channel #1
$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 ON \
-routerTrace ON \
-macTrace ON \
-movementTrace OFF \
-channel $chan_1_
# Create nodes with IFQ send tracing enabled,
# random motion disabled
for {set i 0} {$i < $num_nodes} {incr i} {
set node_($i) [$ns_ node]
$node_($i) add-ifq-send-trace
$node_($i) random-motion 0
# set initial position for NAM
$ns_ initial_node_pos $node_($i) 20
# Provide initial (X,Y, for now Z=0) co-ordinates
set diff [expr ($i + 1) / 2]
if {[expr $i % 2] == 0} {
set diff [expr -$diff]
}
$node_($i) set X_ [expr $num_nodes + $diff]
$node_($i) set Y_ [expr $num_nodes + $diff]
$node_($i) set Z_ 0.0
}
# make node_(0) the AP for nodes in BSS
#set AP_ $node_(0)
#set AP_MAC [$AP_ getMacAddr]
#for {set i 0} {$i < $num_bss_nodes} {incr i} {
# $node_($i) setMac bss_id $AP_MAC
# $node_($i) setMac cfp 0.150 0.001
#}
###########################################################################################
# Scenario specific simulation objects (agents etc.)
create_scenario
###########################################################################################
# Modifications to the mac and/or other stuff dictated by the scenario!
for {set i 0} {$i < $num_nodes} {incr i} {
#if {$idea_mac} {
#$node_($i) setMac IdeaMac $idea_mac
#puts "% node_($i) setMac IdeaMac $idea_mac"
#}
for {set p 0} {$p < [PLevels set plevels_]} {incr p} {
set difs_p [format "difs_%d" $p]
if {[info exists $difs_p]} {
set v [set $difs_p]
$node_($i) setMac difs $p $v
puts "% node_($i) setMac difs $p $v"
}
}
#if {$mode == "PCF"} {
#$node_($i) CFP $pcf_period $pcf_duration
#if {$i == 0} {
# puts "% node_($i) CFP $pcf_period $pcf_duration"
#}
#}
}
if {$title_ != ""} {
set titlefd [open $outfile_.title w]
puts $titlefd "$title_"
close $titlefd
}
# to set a different CWMin for a particular node
# priority level parameter is optional (0 by default)
# use same method for CWMax/CWOffset/difs also
# for difs: to increase/decrease by n, say +2 slots
# $node_($i) setMac CWMin [priority level] 15
# to set number of priority levels supported on a paricular node
# $node_($i) setPLevels 4
###########################################################################################
# End of simulation conditions/operations
for {set i 0} {$i < $num_nodes } {incr i} {
$ns_ at $endtime "$node_($i) reset";
}
$ns_ at $endtime "do_stop"
set delta 0.01
set endtime [expr $endtime + $delta]
$ns_ at $endtime "do_halt"
proc do_stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
proc do_halt {} {
global ns_
puts "NS EXITING..."
$ns_ halt
}
###########################################################################################
# Start up the simulation
puts "Starting Simulation..."
$ns_ run
*i got following error while running above tcl script:-*
$ ns main.tcl
invalid command name "PLevels"
while executing
"PLevels set max_plevels_ 8"
*what is this error and how ican install this semipackage????
plz help me* *as soon as possible.*
More information about the Ns-users
mailing list