版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
网络仿真工具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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 云南省曲靖市麒麟区第十中学2025-2026学年初三九月摸底考试文综试题含解析
- (正式版)DB22∕T 2782-2017 《犬瘟热病毒检测 荧光定量R∕T-PCR方法》
- 高等职业技术教育汽车检测与维修技术专业人才培养方案
- 2026年新护士职业规划与专业发展路径
- 2026年疾控中心传染病应急处置技术方案
- 庸懒散浮拖问题专项整治工作实施方案旅游管理局
- 《圆锥的认识》教学
- 公司孵化室承包协议书模板
- 学生团体联合会对外联络部重组为外联部与文艺部方案模板
- 石雕施工方案案例(3篇)
- SL-T 609-2025 水利水电工程鱼道设计导则
- 纸箱行业奖惩制度
- 职工食堂垃圾管理制度
- 2026年及未来5年市场数据中国铍矿石行业市场全景评估及发展前景预测报告
- 工程项目部质量责任制度
- 2025-2026学年八年级下册语文教学计划及进度表
- 2026年内蒙古公务员录用考试《行测》题(含答案)
- 2026及未来5年中国公安行业信息安全市场运行格局及发展趋向研判报告
- 2026年南京城市职业学院单招职业适应性考试题库及一套完整答案详解
- 更换引流袋技术操作
- 部编人教版小学4四年级《道德与法治》下册全册教案
评论
0/150
提交评论