预览加载中,请您耐心等待几秒...
1/3
2/3
3/3

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

#wrls1.tcl #A3-nodeexampleforad-hocsimulationwithDSDV #Defineoptions setval(chan)Channel/WirelessChannel;#channeltype setval(prop)Propagation/TwoRayGround;#radio-propagationmodel setval(netif)Phy/WirelessPhy;#networkinterfacetype setval(mac)Mac/802_11;#MACtype setval(ifq)CMUPriQueue;#interfacequeuetype setval(ll)LL;#linklayertype setval(ant)Antenna/OmniAntenna;#antennamodel setval(ifqlen)50;#maxpacketinifq setval(nn)3;#numberofmobilenodes setval(rp)DSR;#routingprotocol setval(x)500 ;#Xdimensionoftopography setval(y)400 ;#Ydimensionoftopography setval(stop) 150 ;#timeofsimulationend setns [newSimulator] settracefd[opensimple.trw] setwindowVsTime2[openwin.trw] setnamtrace[opensimwrls.namw] $nstrace-all$tracefd $nsnamtrace-all-wireless$namtrace$val(x)$val(y) #setuptopographyobject settopo[newTopography] $topoload_flatgrid$val(x)$val(y) create-god$val(nn) # #Creatennmobilenodes[$val(nn)]andattachthemtothechannel. # #configurethenodes $nsnode-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\ -agentTraceON\ -routerTraceON\ -macTraceOFF\ -movementTraceON for{seti0}{$i<$val(nn)}{incri}{ setnode_($i)[$nsnode] } #Provideinitiallocationofmobilenodes $node_(0)setX_5.0 $node_(0)setY_5.0 $node_(0)setZ_0.0 $node_(1)setX_490.0 $node_(1)setY_285.0 $node_(1)setZ_0.0 $node_(2)setX_150.0 $node_(2)setY_240.0 $node_(2)setZ_0.0 #Generationofmovements $nsat10.0"$node_(0)setdest250.0250.03.0" $nsat15.0"$node_(1)setdest45.0285.05.0" $nsat110.0"$node_(0)setdest480.0300.05.0" #SetaTCPconnectionbetweennode_(0)andnode_(1) settcp[newAgent/TCP/Newreno] $tcpsetclass_2 setsink[newAgent/TCPSink] $nsattach-agent$node_(0)$tcp $nsattach-agent$node_(1)$sink $nsconnect$tcp$sink setftp[newApplication/FTP] $ftpattach-agent$tcp $nsat10.0"$ftpstart" #Printingthewindowsize procplotWin