版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、ns-3 TrainingComputer and Communication Network LabDepartment of Electrical EngineeringNational Sun Yat-Sen University5/13/2013TopicspGetting Started ns-3nWhat is ns-3?nInstallationpA First ns-3 ScriptnTwo tutorial examplespA simple example for this projectnComplete the remaining parts2Getting Start
2、ed ns-3 Please read the following documentsns-3 overview/docs/ns-3-overview.ppt/docs/ns-3-overview.pdfns-3 Tutorial/docs/release/3.13/tutorial/ns-3-tutorial.pdfns-3 Manual/docs/release/3.13/manual/ns-3-manual.pdfWhat is ns-3
3、?pns-3 is a discrete-event network simulator for Internet systemsnns-3 allows researchers to study Internet protocols and large-scale systems in a controlled environmentnns-3 is a new simulator (not backwards-compatible with ns-2)pns-3 is a free, open source software project organized around researc
4、h community development and maintenancenthe target user community is networking researchers and educators4Extensible Software CorepWritten in C+ with optional Python interfacenextensively documented API (doxygen):n/doxygen-release/index.html5Node BasicspAn ns-3 Node is a husk of a
5、 computer to which applications, stacks, and NICs are added6Tracing and StatisticspTracing is a structured form of simulation outputpExample (from ns-2):pProblem: Tracing needs vary widelynwould like to change tracing output without editing the corenwould like to support multiple outputs7ns-3 Has A
6、New Tracing Modelpns-3 solution: decouple trace sources from trace sinkspBenefit: Customizable trace sinks8Downloading ns-3p/nLatest release: ns-3.16 (2012/12/21)9Problems under WindowspCygwin or MinGWpIf you do use Cygwin or MinGW and use Logitech productsnit can cause Cygwin or
7、MinGW DLLs to die in mysterious waypNote that NSC is not supported on OSX or Cygwin.nNetwork Simulation Cradle10Building ns-3 (1/5)11p# ./build.pyBuilding ns-3 (2/5)12p# ./waf -d optimized configurenns-3 uses the waf build systemBuilding ns-3 (3/5)13p# ./waf -d debug configureBuilding ns-3 (4/5)14p#
8、 ./test.py -c coreBuilding ns-3 (5/5)15Running a Script16p./waf -run hello-simulatorBuilding Your Script17p# cp examples/tutorial/first.cc scratch/myfirst.ccp./wafBuilding Your Script18p# ./waf -run scratch/myfirstA First ns-3 Script /ns-allinone-3.10/ns-3.10/examples/tutorialfirst.ccthird.ccBoilerp
9、latepThe first line in the file is an emacs mode line.n pThe ns-3 simulator is licensed using the GNU General Public License.n 20Module IncludespThe code proper starts with a number of include statements.n p././build/debug/ns321Ns3 NamespacepThe next line in the first.cc script is a namespace declar
10、ation.n pLoggingn 22Main FunctionspThe next lines of the script you will find are,n n 23ns3 提供的 log 訊息分成了以下幾個等級:1.NS_LOG_ERROR Log error messages; 2.NS_LOG_WARN Log warning messages; 3.NS_LOG_DEBUG Log relatively rare, ad-hoc debugging messages; 4.NS_LOG_INFO Log informational messages about program
11、 progress; 5.NS_LOG_FUNCTION Log a message describing each function called; 6.NS_LOG_LOGIC Log messages describing logical flow within a function; 7.NS_LOG_ALL Log everything. 8.NS_LOG_UNCOND Log the associated message unconditionally. Topology HelperspCreate the ns-3 Node objects that will represen
12、t the computers in the simulation.n pWe are constructing a point to point linkn 24Topology HelperspWe will need to have a list of all of the NetDevice objects that are createdn 25Internet Stack HelperpProtocol stacks installed on our nodesn pTCP, UDP, IP, etc.pIpv4AddressHelpern n pmake the associat
13、ion between an IP address and a device26ApplicationspTwo specializations of the core ns-3 class Application called nUdpEchoServerApplicationnUdpEchoClientApplicationpUdpEchoServerHelpern 27ApplicationspUdpEchoClientHelpern 28SimulatorpWhat we need to do at this point is to actually run the simulatio
14、n.n pscheduled events in the simulator at 1.0 seconds, 2.0 seconds and two events at 10.0 secondsn 29Building Your ScriptpDrop your script into the scratch directoryn pNow build your first example script using wafn n 30Building Your ScriptpYou can now run the examplen n 31Building a Wireless Network
15、 TopologypAdd the Wifi and the mobility modulesn pThe network topology illustration follows:32Building a Wireless Network TopologypFor enabling or disabling logging components and for changing the number of devices createdn 33Building a Wireless Network TopologypPart of the Wifi networkn pConfigure
16、the PHY and channel helpersn nYet Another Network SimulatorpM. Lacage and T. R. Henderson, “Yet Another Network Simulator,” WNS2 ns-2: The IP Network Simulator, Italy, 2006.phttp:/ a Wireless Network TopologypCreate a channel object and associate it to our PHY layer object managern pNqosWifiMacHelpe
17、r object to set MAC parametersn nrate control algorithmpAARF (Adaptive Auto-Rate Fallback ) algorithm35Building a Wireless Network TopologypThe SSID of the infrastructure networkn pCreate the wifi devices of these stationsn 36Building a Wireless Network TopologypConfigure the AP (access point) noden
18、 pShares the same set of PHY-level Attributes (and channel) as the stationsn 37Building a Wireless Network TopologypSet some Attributes controlling the “position allocator” functionalityn 38The number of objects layed out on a line.Building a Wireless Network TopologypNeed to tell them how to movenR
19、andomWalk2dMobilityModel prandom directionprandom speedn pRectangle (double _xMin, double _xMax, double _yMin, double _yMax)n 39Building a Wireless Network TopologypWant the access point to remain in a fixed position during the simulationn pProtocol stacksn 40Building a Wireless Network Topologypass
20、ign IP addresses to the device interfacesn 41Building a Wireless Network TopologypEnable internetwork routingn n pCreate just enough tracing to cover all three networksn n 42Building a Wireless Network TopologypRun the simulation, clean up and then exit the programn pOutputn 43Read the pcap filesp p 44Plot figuresp p 45An Examp
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 足球奖学金合同(2篇)
- 雨水收集池施工合同(2篇)
- 幼儿斑马 课件
- 第13课《唐诗五首·钱塘湖春行》八年级语文上册精讲同步课堂(统编版)
- 坚定跟党走课件
- 党课 制作课件
- 西京学院《自动控制原理实验》2022-2023学年期末试卷
- 西京学院《外贸函电》2021-2022学年期末试卷
- 4种高逼格的动画封面模板
- 部编版语文三年级上册第五单元基础知识复习卷含答案
- 工业机器人编程语言:RAPID(ABB):RAPID编程项目实战
- 2024年秋季新外研版三年级上册英语课件 Unit 6 第1课时(Get ready)
- 外研版(2024)七年级上册英语全册教案教学设计
- 2024至2030年中国股指期货行业市场全景评估及发展战略规划报告
- 2024-2030年中国母乳低聚糖(HMO)行业发展形势与未来前景展望报告
- 《江城子-密州出猎》1省名师课赛课获奖课件市赛课一等奖课件
- 人员、设备、资金等方面具有相应的履约能力的承诺书
- 人教版数学二年级上册第4单元 表内乘法一解决问题 第2课时说课稿
- 2024年常州信息职业技术学院高职单招笔试历年职业技能测验典型例题与考点解析含答案
- DB11T 2292-2024 市政工程施工组织设计管理规程
- 2024-2030年中国乌鸡产品晒市场营销模式与投资策略规划研究研究报告
评论
0/150
提交评论