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

📄 topology.tcl

📁 R. Lo Cigno, P. Larcheri 802.11e closed-loop scheduling Description: ns-2 package for 802.11e clo
💻 TCL
字号:
# Hierarchical routing configurationAddrParams set domain_num_                      2                               ;# Number of domainslappend cluster_num                             1 1                             ;# Number of clusters in each domainAddrParams set cluster_num_ $cluster_numlappend eilastlevel                             1 [expr $opt(nn) + $opt(bs)]    ;# Number of nodes in each clusterAddrParams set nodes_num_ $eilastlevel# Wired nodes creationset num_wired_nodes 1   ;# Number of wired nodesset temp {0.0.0}        ;# Hierarchical address of the wired node (domain/cluster/node)for {set i 0} {$i < $num_wired_nodes} {incr i} {        set W($i) [$ns_ node [lindex $temp $i]]}# Base-station creationif {$opt(macstandard) == 1 && $opt(num_tc) != 1} {	set opt(num_tc) 1        puts "\nNOTE: Mac Standard must have only one AC"	puts "\n      ---> AC set to $opt(num_tc)\n"        #exit 1}#----------------------------------------------------------------------------------------#                    Wireless Node Configuration#----------------------------------------------------------------------------------------##                   OPTION TYPE     DESCRIPTION & VALUE USED IN THE SIMULATION#                  -------------   ----------------------------------------------## $ns_ node-config -adhocRouting    Routing Agent: DSDV#                  -llType          LLC sublayer: LL#                  -ifqType         Interface Queue: Queue/DropTail/BS#                  -ifqLen          Max. Interface Queue size: configurable#                  -macType         MAC sublayer: Mac/802_11HC (for Hybrid Coordinator)#                                   MAC sublayer: Mac/802_11   (for Wireless STAs)#                  -antType         Antenna type: Antenna/OmniAntenna#                  -propInstance    Radio Propagation model: Propagation/TwoRayGround#                  -phyType         Network Interface: Phy/WirelessPhy#                  -channel         Channel type: Channel/WirelessChannel#                  -topoInstance    Topography: $topo#                  -wiredRouting    Wired Routing: ON for BS, OFF for WSs#                  -agentTrace      Agent tracing: OFF#                  -routerTrace     Routing tracing: OFF#                  -macTrace        MAC tracing: OFF#                  -IncomingErrProc Error Model: ChnErrProc#----------------------------------------------------------------------------------------$ns_ node-config        -adhocRouting           $opt(adhocRouting) \                        -llType                 $opt(ll) \                        -ifqType                $opt(ifq) \                        -ifqLen                 $opt(bsqlen) \                        -macType                $opt(macHC) \                        -antType                $opt(ant) \                        -propInstance           [new $opt(prop)] \                        -phyType                $opt(netif) \                        -channel                [new $opt(chan)] \                        -topoInstance           $topo \                        -wiredRouting           ON \                        -agentTrace             OFF \                        -routerTrace            OFF \                        -macTrace               OFF \                        -IncomingErrProc        $opt(err)puts $file(finish) "#\n#\tMAC parameters :\n#"#--------------------------------------------------------------------------------------------------------------------------------------##                                                    EDCF Parameters Configuration                                                     ##--------------------------------------------------------------------------------------------------------------------------------------##                                                                                                                                      ## In this example: four Access Categories                                                                                              ##                                                                                                                                      ##               category 0 (TCP up)            category 1 (TCP down)           category 2 (VoIP up)          category 3 (VoIP down)    ##                                                                                                                                      ##    AIFS               70us                            70us                           50us                           50us             ##    CWmin              127                             63                             31 (was 7)                     3                ##    CWmax              8191                            2047                           511                            127 (was 255)    ##    SRL                7                               7                              7                              7                ##    LRL                4                               4                              4                              4                ##                                                                                                                                      ##--------------------------------------------------------------------------------------------------------------------------------------#set tc_par(0,aifs)      0.000070set tc_par(0,cwmin)     127set tc_par(0,cwmax)     8191set tc_par(0,srl)       7set tc_par(0,lrl)       4set tc_par(0,tout)      2000.0set tc_par(1,aifs)      0.000070set tc_par(1,cwmin)     63set tc_par(1,cwmax)     2047set tc_par(1,srl)       7set tc_par(1,lrl)       4set tc_par(1,tout)      2000.0set tc_par(2,aifs)      0.000050set tc_par(2,cwmin)     31set tc_par(2,cwmax)     511set tc_par(2,srl)       7set tc_par(2,lrl)       4set tc_par(2,tout)      0.4set tc_par(3,aifs)      0.000050set tc_par(3,cwmin)     3set tc_par(3,cwmax)     127set tc_par(3,srl)       7set tc_par(3,lrl)       4set tc_par(3,tout)      0.4Queue/DropTail/BS set mapping_APvoip    3Queue/DropTail/BS set mapping_APcbr     3Queue/DropTail/BS set mapping_APtcp     1Queue/DropTail/BS set mapping_APack     0Queue/DropTail/BS set mapping_WSvoip    2Queue/DropTail/BS set mapping_WScbr     2Queue/DropTail/BS set mapping_WStcp     0Queue/DropTail/BS set mapping_WSack     1set num_n 0set BS(0) [$ns_ node 1.0.0]classify $BS(0) $num_n "BS0"$obj(ifq,0) init-llc $opt(bsburst)      ;# Activation/Deactivation of bursting transmission capability$obj(mac,0) set-vocoder $voicepkt $framing			;# Informs the BS about the size of voice packets (bytes) and								;# framing time (secs) according to the selected vocoder (see param.tcl)if {$opt(macstandard) == 0} {        $obj(mac,0) init-mac $opt(num_tc) $opt(txoplmt)         ;# Sets the number of Access Categories and the TXOPlimit value        foreach tc [lessof $opt(num_tc)] {                $obj(ifq,0) add-queue $tc $tc_par($tc,tout) $opt(bsqlen)       ;# Adds a new queue for each Access Category		$obj(mac,0) set-qos $tc $tc_par($tc,aifs) $tc_par($tc,cwmin) \                        $tc_par($tc,srl) $tc_par($tc,lrl) $tc_par($tc,cwmax)    ;# Sets the QoS parameters of the MAC sublayer        }	if {$opt(cap_start) != 0} {                $obj(mac,0) set-cap $opt(cap_interval) $opt(nccop)      ;# Sets the Controlled Access Period interval                                                                        ;# and the number of CCOPs during each CCI                $ns_ at $opt(cap_start) "$obj(mac,0) cap-start"         ;# Starts the CAP mechanism at $opt(cap_start)                $ns_ at $opt(cap_stop) "$obj(mac,0) cap-stop"           ;# Stops the CAP mechanism at $opt(cap_stop)        }        if {$opt(pcf_start) != 0} {                $ns_ at $opt(pcf_start) "$obj(mac,0) pcf-start"         ;# Starts the PCF mechanism at $opt(pcf_start)                $ns_ at $opt(pcf_stop) "$obj(mac,0) pcf-stop"           ;# Stops the PCF mechanism at $opt(pcf_stop)        }} elseif {$opt(macstandard) == 1} {        if {$opt(bsburst) != 0} {		set opt(bsburst) 0                puts "\nNOTE: With Standard MAC you can not use bsburst"		puts "\n      ---> bsburst set to $opt(bsburst)\n"		#exit 1        }        $obj(ifq,0) add-queue 0 $tc_par(0,tout) [expr $opt(bsqlen) * $opt(num_tc)]      ;# 802.11b MAC needs a single queue	$obj(mac,0) init-mac 1 $opt(txoplmt)                            		;# 802.11b has only one access category        $obj(mac,0) set-qos 0 $tc_par(0,aifs) $tc_par(0,cwmin) \                        $tc_par(0,srl) $tc_par(0,lrl) $tc_par(0,cwmax)}incr num_n# Creating links between the wired node and the base-station        Queue/DropTail set limit_       150     ;# Max. queue size on wired links        $ns_ duplex-link $W(0) $BS(0) [expr $opt(bandwidth) * 5] 20ms DropTail   ;# Wired link parameters: full-duplex, bandwidth 55Mbit/s,                                                                                 ;#    propagation delay 2ms, queue type DropTail# Mobilenodes configuration$ns_ node-config        -ifqLen         $opt(ifqlen) \                        -macType        $opt(mac) \                        -wiredRouting   OFF             ;# Deactivation of wired routingset temp ""foreach fid [range 1 $opt(nn)] {        lappend temp "1.0.$fid"         ;# Hierarchical address of WSs (domain/cluster/node)}if {$opt(wtburst) != 0 && $opt(macstandard) == 1} {	set opt(wtburst) 0        puts "\nNOTE: With Standard MAC you can not use wtburst"	puts "\n      ---> wtburst set to $opt(wtburst)\n"        #exit 1}foreach j [lessof $opt(nn)] {        set node_($j) [$ns_ node [lindex $temp $j]]        $node_($j) base-station [AddrParams addr2id [$BS(0) node-addr]]         ;# Defines the base-station for each mobilenode        classify $node_($j) $num_n "WN$j"	if {$j < $opt(nn2)} {							;# Sets the datarate for the current station (see param.tcl)		set rate $datarate_slow	} else {		set rate $datarate_fast	}	$obj(mac,$num_n) set-datarate $rate					;# Communicates the datarate to the station	$obj(mac,0) STA_datarate [$obj(mac,$num_n) mac-addr] $rate		;# Communicates the datarate to the BS        if {$opt(macstandard) == 0 && $opt(legacy) <= 0} {                $obj(ifq,$num_n) init-llc $opt(wtburst)                 ;# Activation/Deactivation of bursting transmission capability                $obj(mac,$num_n) init-mac $opt(num_tc) $opt(txoplmt)    ;# Sets the number of Access Categories and the TXOPlimit value                foreach tc [lessof $opt(num_tc)] {                        $obj(ifq,$num_n) add-queue $tc $tc_par($tc,tout) $opt(ifqlen)               ;# Adds a new queue for each Access Category			$obj(mac,$num_n) set-qos $tc $tc_par($tc,aifs) $tc_par($tc,cwmin) \                                        $tc_par($tc,srl) $tc_par($tc,lrl) $tc_par($tc,cwmax)    ;# Sets the QoS parameters of the MAC sublayer                }		if {1 || [expr $j % 4] == 0 || [expr $j % 4] == 2} {               ;# If this is a UDP uplink station:			$obj(mac,0) cf-poll [$obj(mac,$num_n) mac-addr] 2	   ;# inserts Multimedia Access Category 2 of the node                }                                                                  ;# into the Hybrid Coordinator's Polling List        } else {                incr opt(legacy) -1                $obj(ifq,$num_n) init-llc 0         ;# Activation/Deactivation of bursting transmission capability                $obj(ifq,$num_n) add-queue 0 $tc_par(0,tout) [expr $opt(ifqlen) * $opt(num_tc)]        ;# 802.11b MAC needs a single queue		$obj(mac,$num_n) init-mac 1 $opt(txoplmt)                                              ;# 802.11b has only one access category                $obj(mac,$num_n) set-qos 0 $tc_par(0,aifs) $tc_par(0,cwmin) \                        $tc_par(0,srl) $tc_par(0,lrl) $tc_par(0,cwmax)                $obj(mac,$num_n) set-legacy                                        ;# Informs HCF that this node is a legacy station        }	# Adding a new Error Model module between the wireless station and the base-station        $opt(timer_list) add-timer [$obj(mac,0) id] [$obj(mac,$num_n) id] $opt(pbg_G) $opt(pbg_B) $opt(pgb_G) $opt(pGB)        incr num_n}$obj(mac,0) evalX $datarate_fast $datarate_slow	$opt(nn2) $opt(tcp_size)	;# Informs the HC about fast and slow data rates (see param.tcl),										;# about the number of stations with slow datarate and about the										;# TCP data packet size (in bytes) so that it can calculate the X										;# parameter, the Beacon interval duration and each station's CFP										;# TXOP limit for the current network configuration# The following cycle adds a new independent Error Model module for each pair of WSs.# Given N nodes, the number of Error Model created is N(N-1)/2, since they are full-duplexforeach j [range 1 $opt(nn)] {        foreach k [range [expr $j + 1] $opt(nn)] {                $opt(timer_list) add-timer [$obj(mac,$j) id] [$obj(mac,$k) id] $opt(pbg_G) $opt(pbg_B) $opt(pgb_G) $opt(pGB)        }}$ns_ at $opt(start) "$opt(timer_list) start"  ;# Starts the state transition of each Error Model module

⌨️ 快捷键说明

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