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

📄 example.tcl

📁 OPNET 中的Wimax模块, 主要用于wimax 无线网络仿真,以及普通无线网络仿真.
💻 TCL
📖 第 1 页 / 共 2 页
字号:
    # grant-size grant-interval queue_size latency minimum-bandwidth aggregate-request-interval debug rate_control rate"    $node_($j) configure-upflows $node_($j) "0 3 $W 0 4 1 1 20000 1 0 $nrtps_grant_interval 10000 0 $nrtps_minBW $nrtps_aggreq_interval 0 0 0"          $node_($j) configure-upflows $node_($j) "1 4 $BS 54 4 1 1 1000 1 0 0 10000 0 0 100 0 0 0"           #configure-downflows node "default sched-type dst-node pkt-type phs-type grant-size grant-interval     #queue_size latency minimum-bandwidth "    $node_($j) configure-downflows $node_($j) "1 4 $BS 54 4 0 0 10000 0 0"           $node_($j) startsim}set be_init [expr $nrtps_end]set be_end $opt(n-nodes)#BE connections configurationfor {set j $be_init} {$j < $be_end} {incr j} {    #configure-upflows node "default schedtype dst-node pkt-type phs-type frag-enable concat-enable concat_thresh piggy     # grant-size grant-interval queue_size latency minimum-bandwidth aggregate-request-interval debug rate_control rate"    $node_($j) configure-upflows $node_($j) "0 4 $W 0 4 1 1 20000 1 0 $be_grant_interval 10000 0 0 $be_aggreq_interval 0 0 0"          $node_($j) configure-upflows $node_($j) "1 4 $BS 54 4 1 1 1000 1 0 0 10000 0 0 100 0 0 0"           #configure-downflows node "default sched-type dst-node pkt-type phs-type grant-size grant-interval     #queue_size latency minimum-bandwidth "    $node_($j) configure-downflows $node_($j) "1 4 $BS 54 4 0 0 10000 0 0"           #configure-mapparams cmts-node time-covered map-interval num-contention-slots permap    #num-sm-slots permap short-grant-limit long-grant-limit bkoff-start bkoff-end    $node_($j) startsim}$BS startsimproc construct-arptable {} {    global BS node_ opt    [$BS set arptable_] construct-static-arptable    for {set j 0} {$j < $opt(n-nodes)} {incr j} {	[$node_($j) set arptable_] construct-static-arptable    }}construct-arptable#create links between wired and BS nodes$ns_ duplex-link $W $BS 100Mb 2ms DropTail#---------------------------------------------------------------------##              Configure the traffic flows                            ##---------------------------------------------------------------------##set up UGS uplink flowsset ugs_ul_sink [new Agent/LossMonitor]$ns_ attach-agent $W $ugs_ul_sinkfor {set j $ugs_init} {$j < $ugs_end} {incr j} {    set udp_ul_($j) [new Agent/UDP]    $udp_ul_($j) set packetSize_ 66    $udp_ul_($j) set class_ 0    $ns_ attach-agent $node_($j) $udp_ul_($j)    $ns_ connect $udp_ul_($j) $ugs_ul_sink    set voice_ul_($j) [new Application/Traffic/Exponential]    $voice_ul_($j) set packetSize_ 66    #rate -> packets 66 bytes in length are generated at fixed intervals of 20ms    $voice_ul_($j) set rate_ 26.4Kb      $voice_ul_($j) set burst_time_ 1.2    $voice_ul_($j) set idle_time_ 1.8    $voice_ul_($j) attach-agent $udp_ul_($j)    set rng_ul_($j) [new RNG]    $rng_ul_($j) seed predef [expr $base_seed+$j]    $voice_ul_($j) use-rng $rng_ul_($j)}# random number generatorset gna_ugs_ul [new RNG]$gna_ugs_ul seed predef [expr $base_seed + 1]for {set j $ugs_init} {$j < $ugs_end} {incr j} {    set stime [expr 0.1 + [$gna_ugs_ul uniform 0 1]]    $ns_ at  $stime  "$voice_ul_($j) start"}# set up rtPS uplink flowsset rtps_ul_sink [new Agent/LossMonitor]$ns_ attach-agent $W $rtps_ul_sinkset trace_file [new Tracefile]$trace_file filename nsvideo_baseball.datfor {set j $rtps_init} {$j < $rtps_end} {incr j} {    set udp_ul_($j) [new Agent/UDP]    #$udp_($j) set packetSize_ $packet_size    $ns_ attach-agent $node_($j) $udp_ul_($j)    $ns_ connect $udp_ul_($j) $rtps_ul_sink    set video_ul_($j) [new Application/Traffic/Trace]    $video_ul_($j) attach-tracefile $trace_file    $video_ul_($j) attach-agent $udp_ul_($j)}# random number generatorset gna_rtps_ul [new RNG]$gna_rtps_ul seed predef [expr $base_seed + 2] for {set j $rtps_init} {$j < $rtps_end} {incr j} {    set stime [expr 0.1 + [$gna_rtps_ul uniform 0 1]]    $ns_ at  $stime  "$video_ul_($j) start"}#set up ertPS uplink flowsset ertps_ul_sink [new Agent/LossMonitor]$ns_ attach-agent $W $ertps_ul_sinkfor {set j $ertps_init} {$j < $ertps_end} {incr j} {    set udp_ul_($j) [new Agent/UDP]    $ns_ attach-agent $node_($j) $udp_ul_($j)    $ns_ connect $udp_ul_($j) $ertps_ul_sink    set voip_ul_($j) [new Application/Traffic/Exponential]    $voip_ul_($j) set packetSize_ 66    #rate -> packets 66 bytes in length are generated at fixed intervals of 20ms    $voip_ul_($j) set rate_ 26.4Kb      $voip_ul_($j) set burst_time_ 1.2    $voip_ul_($j) set idle_time_ 1.8    $voip_ul_($j) attach-agent $udp_ul_($j)    set rng_ul_($j) [new RNG]    $rng_ul_($j) seed predef [expr $base_seed+$j]    $voip_ul_($j) use-rng $rng_ul_($j)}# random number generatorset gna_ertps_ul [new RNG]$gna_ertps_ul seed predef [expr $base_seed + 3]for {set j $ertps_init} {$j < $ertps_end} {incr j} {    set stime [expr 0.1 + [$gna_ertps_ul uniform 0 1]]    $ns_ at  $stime  "$voip_ul_($j) start"}#set up nrtPS uplink flowsset nrtps_ul_sink [new Agent/LossMonitor]$ns_ attach-agent $W $nrtps_ul_sinkfor {set j $nrtps_init} {$j < $nrtps_end} {incr j} {    set tcp_ul_($j) [new Agent/TCP]    $ns_ attach-agent $node_($j) $tcp_ul_($j)    $ns_ connect $tcp_ul_($j) $nrtps_ul_sink    set ftp_ul_($j) [new Application/FTP]    $ftp_ul_($j) attach-agent $tcp_ul_($j)}# random number generatorset gna_nrtps_ul [new RNG]$gna_nrtps_ul seed predef [expr $base_seed + 4]for {set j $nrtps_init} {$j < $nrtps_end} {incr j} {    set stime [expr 0.1 + [$gna_nrtps_ul uniform 0 1]]    $ns_ at  $stime  "$ftp_ul_($j) start"}#set up BE uplink flowsset be_ul_sink [new Agent/LossMonitor]$ns_ attach-agent $W $be_ul_sinkfor {set j $be_init} {$j < $be_end} {incr j} {    set be_tcp_ul_($j) [new Agent/TCP]    $ns_ attach-agent $node_($j) $be_tcp_ul_($j)    $ns_ connect $be_tcp_ul_($j) $be_ul_sink    set be_ftp_ul_($j) [new Application/FTP]    $be_ftp_ul_($j) attach-agent $be_tcp_ul_($j) }# random number generatorset gna_be_ul [new RNG]$gna_be_ul seed predef [expr $base_seed + 5]for {set j $be_init} {$j < $be_end} {incr j} {    set stime [expr 0.1 + [$gna_be_ul uniform 0 1]]    $ns_ at  $stime  "$be_ftp_ul_($j) start"}for {set i 0} {$i < $opt(n-nodes) } {incr i} {    $ns_ at $opt(stop).0000010 "$node_($i) reset";}$ns_ at $opt(stop).0000010 "$BS reset"; $ns_ at $opt(stop).0000011 "puts \"NS EXITING...\" ; $ns_ halt"puts "Starting Simulation..."$ns_ run

⌨️ 快捷键说明

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