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

📄 soundsim.tcl

📁 在linux下开发的用于仿真ping协议的仿真文件
💻 TCL
字号:
#define optionsset val(chan) Channel/WirelessChannelset val(prop) Propagation/TwoRayGroundset val(netif) Phy/WirelessPhyset val(mac) Mac/802_11set val(ifq) Queue/DropTail/PriQueueset val(ll) LLset val(ant) Antenna/OmniAntennaset val(ifqlen) 50set val(nn) 9set val(rp) AODVset val(x) 500set val(y) 500set val(stop) 30.0set val(dataflow)  "./cbr-test-9"set val(scentest)   "./scen-9-test"#Main Program#Initialize Global Variablesset ns_ [new Simulator]set tracefd [open soundsim.tr w]#$ns_ use-newtrace$ns_ trace-all $tracefdset namtracefd [open soundsim.nam w]$ns_ namtrace-all-wireless $namtracefd $val(x) $val(y)proc finish {} {	global ns_ tracefd namtracefd	$ns_ flush-trace	close $tracefd	close $namtracefd	exec nam soundsim.nam &	exit 0}#Set topography objectset topo [new Topography]$topo load_flatgrid $val(x) $val(y)#Create God存储了节点的总数,各个节点之间的最短路径等信息set god_ [create-god $val(nn)]#config the nodes $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)\-channelType $val(chan)\-topoInstance $topo\-agentTrace ON\-routerTrace ON\-macTrace OFF\-movementTrace ONfor {set i 0} {$i<$val(nn)} {incr i} {	set node_($i) [$ns_ node]	$node_($i) random-motion 0}#Loading the scen test data scen-9-testsource $val(scentest)#Loading the connection data cbr-test-9source $val(dataflow)#Define node initial position in namfor {set i 0} {$i<$val(nn)} {incr i} {$ns_ initial_node_pos $node_($i) 40}#Tell the nodes when the simulation endsfor {set i 0} {$i<$val(nn)} {incr i} {$ns_ at $val(stop) "$node_($i) reset"}$ns_ at $val(stop) "finish"$ns_ run

⌨️ 快捷键说明

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