網(wǎng)絡(luò)仿真工具NS3的培訓(xùn)文檔課件_第1頁
網(wǎng)絡(luò)仿真工具NS3的培訓(xùn)文檔課件_第2頁
網(wǎng)絡(luò)仿真工具NS3的培訓(xùn)文檔課件_第3頁
網(wǎng)絡(luò)仿真工具NS3的培訓(xùn)文檔課件_第4頁
網(wǎng)絡(luò)仿真工具NS3的培訓(xùn)文檔課件_第5頁
已閱讀5頁,還剩113頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論