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

下载本文档

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

文档简介

ns-3TrainingComputerandCommunicationNetworkLabDepartmentofElectricalEngineeringNationalSunYat-SenUniversity5/13/2013ns-3TrainingTopicsGettingStartedns-3Whatisns-3?InstallationAFirstns-3ScriptTwotutorialexamplesAsimpleexampleforthisprojectCompletetheremainingparts2TopicsGettingStartedns-32GettingStartedns-3GettingStartedns-3Whatisns-3?ns-3isadiscrete-eventnetworksimulatorforInternetsystemsns-3allowsresearcherstostudyInternetprotocolsandlarge-scalesystemsinacontrolledenvironmentns-3isanewsimulator(notbackwards-compatiblewithns-2)ns-3isafree,opensourcesoftwareprojectorganizedaroundresearchcommunitydevelopmentandmaintenancethetargetusercommunityisnetworkingresearchersandeducators4Whatisns-3?ns-3isadiscretExtensibleSoftwareCore5ExtensibleSoftwareCore5NodeBasicsAnns-3Nodeisahuskofacomputertowhichapplications,stacks,andNICsareadded6NodeBasicsAnns-3NodeisahTracingandStatisticsTracingisastructuredformofsimulationoutputExample(fromns-2):Problem:Tracingneedsvarywidelywouldliketochangetracingoutputwithouteditingthecorewouldliketosupportmultipleoutputs7TracingandStatisticsTracingns-3HasANewTracingModelns-3solution:decoupletracesourcesfromtracesinksBenefit:Customizabletracesinks8ns-3HasANewTracingModelnsDownloadingns-39Downloadingns-39ProblemsunderWindowsCygwinorMinGWIfyoudouseCygwinorMinGWanduseLogitechproductsitcancauseCygwinorMinGWDLLstodieinmysteriouswayNotethatNSCisnotsupportedonOSXorCygwin.NetworkSimulationCradle10ProblemsunderWindowsCygwinoBuildingns-3(1/5)11#./build.pyBuildingns-3(1/5)11#./buildBuildingns-3(2/5)12#./waf-doptimizedconfigurens-3usesthewafbuildsystemBuildingns-3(2/5)12#./waf-Buildingns-3(3/5)13#./waf-ddebugconfigureBuildingns-3(3/5)13#./waf-Buildingns-3(4/5)14#./test.py-ccoreBuildingns-3(4/5)14#./test.Buildingns-3(5/5)15Buildingns-3(5/5)15RunningaScript16./waf--runhello-simulatorRunningaScript16./waf--runBuildingYourScript17#cpexamples/tutorial/first.ccscratch/myfirst.cc./wafBuildingYourScript17#cpexaBuildingYourScript18#./waf--runscratch/myfirstBuildingYourScript18#./wafAFirstns-3Script/ns-allinone-3.10/ns-3.10/examples/tutorialfirst.ccthird.ccAFirstns-3Script/ns-allinoBoilerplateThefirstlineinthefileisanemacsmodeline.

Thens-3simulatorislicensedusingtheGNUGeneralPublicLicense.

20BoilerplateThefirstlineintModuleIncludesThecodeproperstartswithanumberofincludestatements.

../../build/debug/ns321ModuleIncludesThecodeproperNs3NamespaceThenextlineinthefirst.ccscriptisanamespacedeclaration.

Logging

22Ns3NamespaceThenextlineinMainFunctionsThenextlinesofthescriptyouwillfindare,

23ns3提供的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.MainFunctionsThenextlinesoTopologyHelpersCreatethens-3Nodeobjectsthatwillrepresentthecomputersinthesimulation.

Weareconstructingapointtopointlink

24TopologyHelpersCreatethens-TopologyHelpersWewillneedtohavealistofalloftheNetDeviceobjectsthatarecreated

25TopologyHelpersWewillneedtInternetStackHelperProtocolstacksinstalledonournodes

TCP,UDP,IP,etc.Ipv4AddressHelper

maketheassociationbetweenanIPaddressandadevice26InternetStackHelperProtocolApplicationsTwospecializationsofthecorens-3classApplicationcalledUdpEchoServerApplicationUdpEchoClientApplicationUdpEchoServerHelper

27ApplicationsTwospecializationApplicationsUdpEchoClientHelper

28ApplicationsUdpEchoClientHelpeSimulatorWhatweneedtodoatthispointistoactuallyrunthesimulation.

scheduledeventsinthesimulatorat1.0seconds,2.0secondsandtwoeventsat10.0seconds

29SimulatorWhatweneedtodoatBuildingYourScriptDropyourscriptintothescratchdirectory

Nowbuildyourfirstexamplescriptusingwaf

30BuildingYourScriptDropyourBuildingYourScriptYoucannowruntheexample

31BuildingYourScriptYoucannoBuildingaWirelessNetworkTopologyAddtheWifiandthemobilitymodules

Thenetworktopologyillustrationfollows:32BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyForenablingordisablingloggingcomponentsandforchangingthenumberofdevicescreated

33BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyPartoftheWifinetwork

ConfigurethePHYandchannelhelpers

YetAnotherNetworkSimulatorM.LacageandT.R.Henderson,“YetAnotherNetworkSimulator,”WNS2ns-2:TheIPNetworkSimulator,Italy,2006./files/wns2-yans.pdf34BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyCreateachannelobjectandassociateittoourPHYlayerobjectmanager

NqosWifiMacHelperobjecttosetMACparameters

ratecontrolalgorithmAARF(AdaptiveAuto-RateFallback)algorithm35BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyTheSSIDoftheinfrastructurenetwork

Createthewifidevicesofthesestations

36BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyConfiguretheAP(accesspoint)node

SharesthesamesetofPHY-levelAttributes(andchannel)asthestations

37BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologySetsomeAttributescontrollingthe“positionallocator”functionality

38Thenumberofobjectslayedoutonaline.BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyNeedtotellthemhowtomoveRandomWalk2dMobilityModelrandomdirectionrandomspeed

Rectangle(double_xMin,double_xMax,double_yMin,double_yMax)

39BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyWanttheaccesspointtoremaininafixedpositionduringthesimulation

Protocolstacks

40BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyassignIPaddressestothedeviceinterfaces

41BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyEnableinternetworkrouting

Createjustenoughtracingtocoverallthreenetworks

42BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyRunthesimulation,cleanupandthenexittheprogram

Output

43BuildingaWirelessNetworkToReadthepcapfiles

44Readthepcapfiles44Plotfigures

45Plotfigures45AnExampleofMANETReference/ns-allinone-3.10/ns-3.10/examples/wireless/wifi-hidden-terminal.ccAnExampleofMANETReferenceCodes(1/7)47Codes(1/7)47Codes(2/7)48Codes(2/7)48Codes(3/7)49Codes(3/7)49Codes(4/7)50Codes(4/7)50Codes(5/7)51Codes(5/7)51Codes(6/7)52Codes(6/7)52Codes(7/7)53Codes(7/7)53Result54Result54Needtodo……(1/3)Transmissionrangeofanodens3::RangePropagationLossModelMaxRangeNodemovingspeedns3::RandomWaypointMobilityModelSpeedPauseNodedataratens3::ConstantRateWifiManager55Needtodo……(1/3)TransmissionNeedtodo……(2/3)RTSretrylimitns3::UanMacRcRetryRateBuffersizens3::TcpSocketSndBufSizeAODVhelloperiodsns3::aodv::RoutingProtocolHelloInterval56Needtodo……(2/3)RTSretryliNeedtodo……(3/3)Uniformdistributioninasquarewith500metersns3::RandomRectanglePositionAllocator

ns3::UniformVariable57Needtodo……(3/3)UniformdistQ&A58Q&A58演讲完毕,谢谢观看!演讲完毕,谢谢观看!ns-3TrainingComputerandCommunicationNetworkLabDepartmentofElectricalEngineeringNationalSunYat-SenUniversity5/13/2013ns-3TrainingTopicsGettingStartedns-3Whatisns-3?InstallationAFirstns-3ScriptTwotutorialexamplesAsimpleexampleforthisprojectCompletetheremainingparts61TopicsGettingStartedns-32GettingStartedns-3GettingStartedns-3Whatisns-3?ns-3isadiscrete-eventnetworksimulatorforInternetsystemsns-3allowsresearcherstostudyInternetprotocolsandlarge-scalesystemsinacontrolledenvironmentns-3isanewsimulator(notbackwards-compatiblewithns-2)ns-3isafree,opensourcesoftwareprojectorganizedaroundresearchcommunitydevelopmentandmaintenancethetargetusercommunityisnetworkingresearchersandeducators63Whatisns-3?ns-3isadiscretExtensibleSoftwareCore64ExtensibleSoftwareCore5NodeBasicsAnns-3Nodeisahuskofacomputertowhichapplications,stacks,andNICsareadded65NodeBasicsAnns-3NodeisahTracingandStatisticsTracingisastructuredformofsimulationoutputExample(fromns-2):Problem:Tracingneedsvarywidelywouldliketochangetracingoutputwithouteditingthecorewouldliketosupportmultipleoutputs66TracingandStatisticsTracingns-3HasANewTracingModelns-3solution:decoupletracesourcesfromtracesinksBenefit:Customizabletracesinks67ns-3HasANewTracingModelnsDownloadingns-368Downloadingns-39ProblemsunderWindowsCygwinorMinGWIfyoudouseCygwinorMinGWanduseLogitechproductsitcancauseCygwinorMinGWDLLstodieinmysteriouswayNotethatNSCisnotsupportedonOSXorCygwin.NetworkSimulationCradle69ProblemsunderWindowsCygwinoBuildingns-3(1/5)70#./build.pyBuildingns-3(1/5)11#./buildBuildingns-3(2/5)71#./waf-doptimizedconfigurens-3usesthewafbuildsystemBuildingns-3(2/5)12#./waf-Buildingns-3(3/5)72#./waf-ddebugconfigureBuildingns-3(3/5)13#./waf-Buildingns-3(4/5)73#./test.py-ccoreBuildingns-3(4/5)14#./test.Buildingns-3(5/5)74Buildingns-3(5/5)15RunningaScript75./waf--runhello-simulatorRunningaScript16./waf--runBuildingYourScript76#cpexamples/tutorial/first.ccscratch/myfirst.cc./wafBuildingYourScript17#cpexaBuildingYourScript77#./waf--runscratch/myfirstBuildingYourScript18#./wafAFirstns-3Script/ns-allinone-3.10/ns-3.10/examples/tutorialfirst.ccthird.ccAFirstns-3Script/ns-allinoBoilerplateThefirstlineinthefileisanemacsmodeline.

Thens-3simulatorislicensedusingtheGNUGeneralPublicLicense.

79BoilerplateThefirstlineintModuleIncludesThecodeproperstartswithanumberofincludestatements.

../../build/debug/ns380ModuleIncludesThecodeproperNs3NamespaceThenextlineinthefirst.ccscriptisanamespacedeclaration.

Logging

81Ns3NamespaceThenextlineinMainFunctionsThenextlinesofthescriptyouwillfindare,

82ns3提供的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.MainFunctionsThenextlinesoTopologyHelpersCreatethens-3Nodeobjectsthatwillrepresentthecomputersinthesimulation.

Weareconstructingapointtopointlink

83TopologyHelpersCreatethens-TopologyHelpersWewillneedtohavealistofalloftheNetDeviceobjectsthatarecreated

84TopologyHelpersWewillneedtInternetStackHelperProtocolstacksinstalledonournodes

TCP,UDP,IP,etc.Ipv4AddressHelper

maketheassociationbetweenanIPaddressandadevice85InternetStackHelperProtocolApplicationsTwospecializationsofthecorens-3classApplicationcalledUdpEchoServerApplicationUdpEchoClientApplicationUdpEchoServerHelper

86ApplicationsTwospecializationApplicationsUdpEchoClientHelper

87ApplicationsUdpEchoClientHelpeSimulatorWhatweneedtodoatthispointistoactuallyrunthesimulation.

scheduledeventsinthesimulatorat1.0seconds,2.0secondsandtwoeventsat10.0seconds

88SimulatorWhatweneedtodoatBuildingYourScriptDropyourscriptintothescratchdirectory

Nowbuildyourfirstexamplescriptusingwaf

89BuildingYourScriptDropyourBuildingYourScriptYoucannowruntheexample

90BuildingYourScriptYoucannoBuildingaWirelessNetworkTopologyAddtheWifiandthemobilitymodules

Thenetworktopologyillustrationfollows:91BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyForenablingordisablingloggingcomponentsandforchangingthenumberofdevicescreated

92BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyPartoftheWifinetwork

ConfigurethePHYandchannelhelpers

YetAnotherNetworkSimulatorM.LacageandT.R.Henderson,“YetAnotherNetworkSimulator,”WNS2ns-2:TheIPNetworkSimulator,Italy,2006./files/wns2-yans.pdf93BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyCreateachannelobjectandassociateittoourPHYlayerobjectmanager

NqosWifiMacHelperobjecttosetMACparameters

ratecontrolalgorithmAARF(AdaptiveAuto-RateFallback)algorithm94BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyTheSSIDoftheinfrastructurenetwork

Createthewifidevicesofthesestations

95BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyConfiguretheAP(accesspoint)node

SharesthesamesetofPHY-levelAttributes(andchannel)asthestations

96BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologySetsomeAttributescontrollingthe“positionallocator”functionality

97Thenumberofobjectslayedoutonaline.BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyNeedtotellthemhowtomoveRandomWalk2dMobilityModelrandomdirectionrandomspeed

Rectangle(double_xMin,double_xMax,double_yMin,double_yMax)

98BuildingaWirelessNetworkToBuildingaWirelessNetworkTopologyWanttheaccesspointto

温馨提示

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

评论

0/150

提交评论