没有合适的资源?快使用搜索试试~ 我知道了~
NS by example
5星 · 超过95%的资源 需积分: 10 68 下载量 178 浏览量
2009-10-02
23:32:36
上传
评论 2
收藏 630KB PDF 举报
温馨提示
试读
99页
NS2是一款优秀而经典的网络模拟工具,然后要学好并不容易,这份精致的NS by example提供入门到精通的帮助
资源推荐
资源详情
资源评论
1
NS by Example
Jae Chung
and
Mark Claypool
Purpose
NS (version 2) is an object-oriented, discrete event driven network
simulator developed at UC Berkely written in C++ and OTcl. NS is
primarily useful for simulating local and wide area networks. Although
NS is fairly easy to use once you get to know the simulator, it is quite
difficult for a first time user, because there are few user-friendly manuals.
Even though there is a lot of documentation written by the developers
which has in depth explanation of the simulator, it is written with the
depth of a skilled NS user. The purpose of this project is to give a new
user some basic idea of how the simultor works, how to setup simulation
networks, where to look for further information about network
components in simulator codes, how to create new network components,
etc., mainly by giving simple examples and brief explanations based on
2
our experiences. Although all the usage of the simulator or possible
network simulation setups may not be covered in this project, the project
should help a new user to get started quickly.
Overview
NS is an event driven network simulator developed at UC Berkeley that
simulates variety of IP networks. It implements network protocols such
as TCP and UPD, traffic source behavior such as FTP, Telnet, Web, CBR
and VBR, router queue management mechanism such as Drop Tail, RED
and CBQ, routing algorithms such as Dijkstra, and more. NS also
implements multicasting and some of the MAC layer protocols for LAN
simulations. The NS project is now a part of the VINT project that
develops tools for simulation results display, analysis and converters that
convert network topologies generated by well-known generators to NS
formats. Currently, NS (version 2) written in C++ and OTcl (Tcl script
language with Object-oriented extensions developed at MIT) is available.
This document talks briefly about the basic structure of NS, and explains
in detail how to use NS mostly by giving examples. Most of the figures
that are used in describing the NS basic structure and network
components are from the 5th VINT/NS Simulator Tutorial/Workshop
slides and the NS Manual (formerly called "NS Notes and
3
Documentation"), modified little bit as needed. For more information
about NS and the related tools, visit the VINT project home page.
Figure 1. Simplified User's View of NS
As shown in Figure 1, in a simplified user's view, NS is Object-oriented Tcl
(OTcl) script interpreter that has a simulation event scheduler and
network component object libraries, and network setup (plumbing)
module libraries (actually, plumbing modules are implemented as
member functions of the base simulator object). In other words, to use
NS, you program in OTcl script language. To setup and run a simulation
network, a user should write an OTcl script that initiates an event
scheduler, sets up the network topology using the network objects and
the plumbing functions in the library, and tells traffic sources when to
start and stop transmitting packets through the event scheduler. The
term "plumbing" is used for a network setup, because setting up a
network is plumbing possible data paths among network objects by
setting the "neighbor" pointer of an object to the address of an
4
appropriate object. When a user wants to make a new network object, he
or she can easily make an object either by writing a new object or by
making a compound object from the object library, and plumb the data
path through the object. This may sound like complicated job, but the
plumbing OTcl modules actually make the job very easy. The power of
NS comes from this plumbing.
Another major component of NS beside network objects is the event
scheduler. An event in NS is a packet ID that is unique for a packet with
scheduled time and the pointer to an object that handles the event. In
NS, an event scheduler keeps track of simulation time and fires all the
events in the event queue scheduled for the current time by invoking
appropriate network components, which usually are the ones who issued
the events, and let them do the appropriate action associated with
packet pointed by the event. Network components communicate with
one another passing packets, however this does not consume actual
simulation time. All the network components that need to spend some
simulation time handling a packet (i.e. need a delay) use the event
scheduler by issuing an event for the packet and waiting for the event to
be fired to itself before doing further action handling the packet. For
example, a network switch component that simulates a switch with 20
microseconds of switching delay issues an event for a packet to be
switched to the scheduler as an event 20 microsecond later. The
5
scheduler after 20 microsecond dequeues the event and fires it to the
switch component, which then passes the packet to an appropriate
output link component. Another use of an event scheduler is timer. For
example, TCP needs a timer to keep track of a packet transmission time
out for retransmission (transmission of a packet with the same TCP
packet number but different NS packet ID). Timers use event schedulers
in a similar manner that delay does. The only difference is that timer
measures a time value associated with a packet and does an appropriate
action related to that packet after a certain time goes by, and does not
simulate a delay.
NS is written not only in OTcl but in C++ also. For efficiency reason, NS
separates the data path implementation from control path
implementations. In order to reduce packet and event processing time
(not simulation time), the event scheduler and the basic network
component objects in the data path are written and compiled using C++.
These compiled objects are made available to the OTcl interpreter
through an OTcl linkage that creates a matching OTcl object for each of
the C++ objects and makes the control functions and the configurable
variables specified by the C++ object act as member functions and
member variables of the corresponding OTcl object. In this way, the
controls of the C++ objects are given to OTcl. It is also possible to add
member functions and variables to a C++ linked OTcl object. The objects
剩余98页未读,继续阅读
资源评论
- xxass2011-12-06挺好的,NS2入门基础教程
- wq123_2013-05-25例子很好,适合初学者
- umingyong2014-11-08现在正在学ns2,对入门很有帮助
- penghua4350459492015-11-27NS2入门的英语基础教程
leonard520
- 粉丝: 23
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功