📄 cac.tcl~
字号:
# excute call admission control based on Equivalent Bandwidth of each traffic type proc CAC { trafname EquivBW endT} { global ns av_BW Block_sess Arv_sess Active_sess upvar $trafname traf set Arv_sess [expr $Arv_sess + 1] if { $av_BW < $EquivBW } { # if no more available BW, block the traffic set started 0; # blocked = true set Block_sess [expr $Block_sess + 1] } else { # traffic access OK set started 1; # blocked = false set Active_sess [expr Active_sess + 1]; # increase current active conncetions number set av_BW [expr $av_BW - $EquivBW]; # available BW reduce by appication equivalent bendwidth $ns at-now "$traf start" #puts "sess # $Access_sess start at [$ns now], started= [$traf set started]" #puts "sess # [$traf set id_] start at [$ns now], started= [$traf set started]" # $ns after 0.03 "$traf start"; # 30ms delay for PDP context 30ms delay for PDP context # only if traffic access the network, it can start and stop $ns at $endT "End $traf $EquivBW " #$ns at [$traf set EndT] "End $traf $EquivBW $Access_sess" } return $started}proc End { traf eb } { global ns av_BW Active_sess set av_BW [expr $av_BW + $eb ]; # available BW increase by appication equivalent bendwidth due to the conncetion release set Active_sess [expr Active_sess - 1]; # decrease current active connections number $ns at-now "$traf stop" #puts "sess # $SessID stop at [$ns now] "}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -