网络仿真工具NS3培训文档_第1页
网络仿真工具NS3培训文档_第2页
网络仿真工具NS3培训文档_第3页
网络仿真工具NS3培训文档_第4页
网络仿真工具NS3培训文档_第5页
已阅读5页,还剩53页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

网络仿真工具NS3培训文档第一页,共58页。TopicsGettingStartedns-3Whatisns-3?InstallationAFirstns-3ScriptTwotutorialexamplesAsimpleexampleforthisprojectCompletetheremainingparts2第二页,共58页。GettingStartedns-3Pleasereadthefollowingdocumentsns-3overviewns-3Tutorialns-3Manual第三页,共58页。Whatisns-3?ns-3isadiscrete-eventnetworksimulatorforInternetsystemsns-3allowsresearcherstostudyInternetprotocolsandlarge-scalesystemsinacontrolledenvironmentns-3isanewsimulator(notbackwards-compatiblewithns-2)ns-3isafree,opensourcesoftwareprojectorganizedaroundresearchcommunitydevelopmentandmaintenancethetargetusercommunityisnetworkingresearchersandeducators4第四页,共58页。ExtensibleSoftwareCoreWritteninC++withoptionalPythoninterfaceextensivelydocumentedAPI(doxygen):5第五页,共58页。NodeBasicsAnns-3Nodeisahuskofacomputertowhichapplications,stacks,andNICsareadded6第六页,共58页。TracingandStatisticsTracingisastructuredformofsimulationoutputExample(fromns-2):Problem:Tracingneedsvarywidelywouldliketochangetracingoutputwithouteditingthecorewouldliketosupportmultipleoutputs7第七页,共58页。ns-3HasANewTracingModelns-3solution:decoupletracesourcesfromtracesinksBenefit:Customizabletracesinks8第八页,共58页。Downloadingns-3Latestrelease:ns-3.16

(2012/12/21)9第九页,共58页。ProblemsunderWindowsCygwinorMinGWIfyoudouseCygwinorMinGWanduseLogitechproductsitcancauseCygwinorMinGWDLLstodieinmysteriouswayNotethatNSCisnotsupportedonOSXorCygwin.NetworkSimulationCradle10第十页,共58页。Buildingns-3(1/5)#./build.py11第十一页,共58页。Buildingns-3(2/5)#./waf-doptimizedconfigurens-3usesthewafbuildsystem12第十二页,共58页。Buildingns-3(3/5)#./waf-ddebugconfigure13第十三页,共58页。Buildingns-3(4/5)#./test.py-ccore14第十四页,共58页。Buildingns-3(5/5)15第十五页,共58页。RunningaScript./waf--runhello-simulator16第十六页,共58页。BuildingYourScript#cpexamples/tutorial/first.ccscratch/myfirst.cc./waf17第十七页,共58页。BuildingYourScript#./waf--runscratch/myfirst18第十八页,共58页。AFirstns-3Script/ns-allinone-3.10/ns-3.10/examples/tutorialfirst.ccthird.cc第十九页,共58页。BoilerplateThefirstlineintheanemacsmodeline.

Thens-3simulatorislicensedusingtheGNUGeneralPublicLicense.

20第二十页,共58页。ModuleIncludesThecodeproperstartswithanumberofincludestatements.

../../build/debug/ns321第二十一页,共58页。Ns3NamespaceThenextlineinthefirst.ccscriptisanamespacedeclaration.

Logging

22第二十二页,共58页。MainFunctionsThenextlinesofthescriptyouwillfindare,

ns3提供的log訊息分成了以下幾個等級:NS_LOG_ERROR—Logerrormessages;NS_LOG_WARN—Logwarningmessages;NS_LOG_DEBUG—Logrelativelyrare,ad-hocdebuggingmessages;NS_LOG_INFO—Loginformationalmessagesaboutprogramprogress;NS_LOG_FUNCTION—Logamessagedescribingeachfunctioncalled;NS_LOG_LOGIC–Logmessagesdescribinglogicalflowwithinafunction;NS_LOG_ALL—Logeverything.NS_LOG_UNCOND–Logtheassociatedmessageunconditionally.23第二十三页,共58页。TopologyHelpersCreatethens-3Nodeobjectsthatwillrepresentthecomputersinthesimulation.

Weareconstructingapointtopointlink

24第二十四页,共58页。TopologyHelpersWewillneedtohavealistofalloftheNetDeviceobjectsthatarecreated

25第二十五页,共58页。InternetStackHelperProtocolstacksinstalledonournodes

TCP,UDP,IP,etc.Ipv4AddressHelper

maketheassociationbetweenanIPaddressandadevice26第二十六页,共58页。ApplicationsTwospecializationsofthecorens-3classApplicationcalledUdpEchoServerApplicationUdpEchoClientApplicationUdpEchoServerHelper

27第二十七页,共58页。ApplicationsUdpEchoClientHelper

28第二十八页,共58页。SimulatorWhatweneedtodoatthispointistoactuallyrunthesimulation.

scheduledeventsinthesimulatorat1.0seconds,2.0secondsandtwoeventsat10.0seconds

29第二十九页,共58页。BuildingYourScriptDropyourscriptintothescratchdirectory

Nowbuildyourfirstexamplescriptusingwaf

30第三十页,共58页。BuildingYourScriptYoucannowruntheexample

31第三十一页,共58页。BuildingaWirelessNetworkTopologyAddtheWifiandthemobilitymodules

Thenetworktopologyillustrationfollows:32第三十二页,共58页。BuildingaWirelessNetworkTopologyForenablingordisablingloggingcomponentsandforchangingthenumberofdevicescreated

33第三十三页,共58页。BuildingaWirelessNetworkTopologyPartoftheWifinetwork

ConfigurethePHYandchannelhelpers

YetAnotherNetworkSimulatorM.LacageandT.R.Henderson,“YetAnotherNetworkSimulator,”WNS2ns-2:TheIPNetworkSimulator,Italy,2006.34第三十四页,共58页。BuildingaWirelessNetworkTopologyCreateachannelobjectandassociateittoourPHYlayerobjectmanager

NqosWifiMacHelperobjecttosetMACparameters

ratecontrolalgorithmAARF(AdaptiveAuto-RateFallback)algorithm35第三十五页,共58页。BuildingaWirelessNetworkTopologyTheSSIDoftheinfrastructurenetwork

Createthewifidevicesofthesestations

36第三十六页,共58页。BuildingaWirelessNetworkTopologyConfiguretheAP(accesspoint)node

SharesthesamesetofPHY-levelAttributes(andchannel)asthestations

37第三十七页,共58页。BuildingaWirelessNetworkTopologySetsomeAttributescontrollingthe“positionallocator”functionality

Thenumberofobjectslayedoutonaline.38第三十八页,共58页。BuildingaWirelessNetworkTopologyNeedtotellthemhowtomoveRandomWalk2dMobilityModelrandomdirectionrandomspeed

Rectangle(double_xMin,double_xMax,double_yMin,double_yMax)

39第三十九页,共58页。BuildingaWirelessNetworkTopologyWanttheaccesspointtoremaininafixedpositionduringthesimulation

Protocolstacks

40第四十页,共58页。BuildingaWirelessNetworkTopologyassignIPaddressestothedeviceinterfaces

41第四十一页,共58页。BuildingaWirelessNetworkTopologyEnableinternetworkrouting

Createjustenoughtracingtocoverallthreenetworks

42第四十二页,共58页。BuildingaWirelessNetworkTopologyRunthesimulation,cleanupandthenexittheprogram

Output

43第四十三页,共58页。Readthepcapfiles

44第四十四页,共58页。Plotfigures

45第四十五页,共58页。AnExampleofMANETReference/ns-allinone-3.10/ns-3.10/examples/wireless/wifi-hidden-terminal.cc第四十六页,共58页。Codes(1/7)47第四十七页,共58页。Codes(2/7)48

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论