版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 浙江理工大學(xué)《語文教學(xué)理論與實(shí)踐(1)》2023-2024學(xué)年第一學(xué)期期末試卷
- 鄭州輕工業(yè)大學(xué)《軟件開發(fā)管理程》2023-2024學(xué)年第一學(xué)期期末試卷
- 小學(xué)學(xué)校章程
- 浙江電力職業(yè)技術(shù)學(xué)院《電視原理B》2023-2024學(xué)年第一學(xué)期期末試卷
- 漳州職業(yè)技術(shù)學(xué)院《信號與系統(tǒng)》2023-2024學(xué)年第一學(xué)期期末試卷
- 生產(chǎn)調(diào)度與庫存管理協(xié)同效應(yīng)
- 財務(wù)年終總結(jié)報告模板
- 雙十一新媒體營銷報告模板
- 生物醫(yī)療研究總結(jié)模板
- 房地產(chǎn)交易制度政策-《房地產(chǎn)基本制度與政策》模擬試卷2
- DB33T 2570-2023 營商環(huán)境無感監(jiān)測規(guī)范 指標(biāo)體系
- 上海市2024年中考英語試題及答案
- 房屋市政工程生產(chǎn)安全重大事故隱患判定標(biāo)準(zhǔn)(2024版)宣傳海報
- 房屋市政工程生產(chǎn)安全重大事故隱患判定標(biāo)準(zhǔn)(2024版)宣傳畫冊
- 垃圾車駕駛員聘用合同
- 2025年道路運(yùn)輸企業(yè)客運(yùn)駕駛員安全教育培訓(xùn)計劃
- 南京工業(yè)大學(xué)浦江學(xué)院《線性代數(shù)(理工)》2022-2023學(xué)年第一學(xué)期期末試卷
- 2024版機(jī)床維護(hù)保養(yǎng)服務(wù)合同3篇
- 《論拒不執(zhí)行判決、裁定罪“執(zhí)行能力”之認(rèn)定》
- 工程融資分紅合同范例
- 2024年貴州省公務(wù)員錄用考試《行測》真題及答案解析
評論
0/150
提交評論