⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bs_ss.tcl~

📁 802.16 Qos仿真平台的c++实现
💻 TCL~
字号:

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_16            	    ;# 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)     3       	 			       ;# number of mobilenodes
set val(rp)     AODV     				       ;# routing protocol
set val(x)      800        		          ;# X dimension of topography
set val(y)      800       			          ;# Y dimension of topography
set val(stop)   10.0 					       ;# time of simulation end


set ns            [new Simulator]
set tracefd       [open bs_ss.tr w]
set namtrace      [open bs_ss.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

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

create-god $val(nn)

set chan0 [new $val(chan)]


$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) \
                -channel $chan0 \
                -topoInstance $topo \
                -agentTrace OFF \
                -routerTrace ON \
                -macTrace ON \
                -movementTrace OFF for {set i 0} {$i < $val(nn) } {incr i} {    set node_($i) [$ns node]    $node_($i) random-motion 0;}
#set node_(0) [$ns node]
$node_(0) set X_ 350
$node_(0) set Y_ 300
$node_(0) set Z_ 0.0$ns initial_node_pos $node_(0) 20
#set node_(1) [$ns node]
$node_(1) set X_ 100
$node_(1) set Y_ 300
$node_(1) set Z_ 0.0$ns initial_node_pos $node_(1) 20#set node_(1) [$ns node]
$node_(2) set X_ 600
$node_(2) set Y_ 300
$node_(2) set Z_ 0.0$ns initial_node_pos $node_(2) 20
set udp0 [new Agent/UDP]
$ns attach-agent $node_(2) $udp0
set null0 [new Agent/Null]
$ns attach-agent $node_(1) $null0
$ns connect $udp0 $null0
set cbr0 [new Application/Traffic/UGS]
$cbr0 attach-agent $udp0
$ns at 0.5 "$cbr0 start"
$ns at 10.0 "$cbr0 stop"set udp1 [new Agent/UDP]
$ns attach-agent $node_(1) $udp1
set null1 [new Agent/Null]
$ns attach-agent $node_(2) $null1
$ns connect $udp1 $null1
set cbr1 [new Application/Traffic/rtPS]
$cbr1 attach-agent $udp1
$ns at 0.5 "$cbr1 start"
$ns at 10.0 "$cbr1 stop"




for {set i 0} {$i < $val(nn)} {incr i} {
    $ns at 0.0 "$node_($i) reset";
}


$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at 10.0 "puts \"end simulation\" ; $ns halt"

proc stop {} {
    global ns tracefd namtrace
    $ns flush-trace
    close $tracefd
    close $namtrace
}
puts "Start Simulation..."
$ns run

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -