omnet++手册

上传人:简****9 文档编号:101952832 上传时间:2019-09-30 格式:PPT 页数:180 大小:2.20MB
返回 下载 相关 举报
omnet++手册_第1页
第1页 / 共180页
omnet++手册_第2页
第2页 / 共180页
omnet++手册_第3页
第3页 / 共180页
omnet++手册_第4页
第4页 / 共180页
omnet++手册_第5页
第5页 / 共180页
点击查看更多>>
资源描述

《omnet++手册》由会员分享,可在线阅读,更多相关《omnet++手册(180页珍藏版)》请在金锄头文库上搜索。

1、OmNeT+手册,带有列表的标题和内容版式,在此处添加第一个要点 在此处添加第二个要点 在此处添加第三个要点,什么是OMNeT+?,OMNeT+是面向对象的模块化离散事件网络仿真框架。 不是:不是仿真器 是:一个写仿真模型的基础架构和工具,提供组件和模块,像LEGO积木块一样,OMNeT+应用领域,有通用架构,应用各种领域: 有线和无线通信网络的建模 协议建模 排队网建模 多处理器和其他分布式硬件系统的建模 硬件架构的验证 复杂软件系统各方面性能评价 采用离散事件方法的任何系统 通过交换消息映射为实体通信的任何系统,OMNeT+模型,OMNeT+模型是由模块组成的,模块之间通过消息传递方式进行

2、通信。 OMNeT+的整个模型称为network 模型结构通过NED语言描述 Messages代表网络中的帧或者包、排队 网络中的工作或者客户 Gates是模块的输入输出接口 Connection(link)用于对物理链路建模, channel具有参数:数据率(data rate)、传播延时(propagation delay)、误码率(bit error rate)、误包率(packet error rate),connection支持这些参数 Module也有参数,在NED文件中指定,或者在配置文件omnetpp.ini中指定,OMNeT+模型,参数的类型:string、numeric、b

3、oolean、XML数据树 网络模型拓扑结构使用NED语言描述,算法编程,模型模块中包含算法; 仿真对象由C+类描述 OMNeT+模型包含如下几个部分: (1)NED语言拓扑描述,.ned文件; (2)消息定义,.msg文件; (3)简单模块源代码,.h/.cc文件。 仿真系统包含的组建: (1)仿真内核:管理仿真和仿真类库 (2)用户接口:用于仿真执行,用于调试、显示、批处理仿真执行,NED语言,NED代表网络描述,是用户描述仿真结构的语言。 OMNeT+中,NED可以声明简单模块、连接以及它们组合的复合模块等等。 NED语言的特征:继承性、基于组件、接口、层级、包结构、内部类型、元数据注解

4、(属性) NED语言有树形代表的等价形式,可以序列化为XML,NED语言表示真实的通信网,通信网描述:包含很多节点;每个节点有一个运行的应用程序,应用程序随机发送数据包;节点也是路由;假设应用程序时数据包基础的通信,所以传输层细节可以不用考虑。 建模方法: 首先,建立一个network; 然后,定义一个网络 引入信道Channel 建立App、Rounting、Queue等模块 建立节点复合模块 所有对象组合在一起,定义一个网络,network Network submodules: node1:Node; node2:Node; node3:Node; . connections node1

5、.port+datarate=100Mbps; node2.port+; node2.port+datarate=100Mbps; node4.port+; node4.port+datarate=100Mbps; node6.port+; . Network的类型是network,node1、node2.的类型为Node,Node在下面定义。然后定义节点之间的连接,连接点称为gate,port+的意思是将一个gate加入到port中,datarate=100Mbps; 代表数据率为100Mbps,定义信道,每个连接重复写数据率是很麻烦的,所以,创建一个新的信道类型封装数据率设置 networ

6、k Network types: channel c extends ned.DatarateChannel datarate=100Mbps; submodules: node1:Node; node2:Node; node3:Node; . connections: node1.port+Cnode2.port+ . ,简单模块定义,定义流量生成器、路由、队列包等类型 simple App parameters: int destAddress; . display(“i=block/browser”); gates: input in; output out; simple Routin

7、g. simple Queue. 模块App、Routing、Queue名以大写开头 以开头的单词称为“属性”,定义Node复合模块,将App、Routing和Queue组成Node模块 module Node parameters: int address; display(“i=misc/node_vs,gold”); gates: inout port; submodules: app:App; routing:Routing; queuesizeof(port):Queue; connections: routing.localOutapp.in; routing.localInque

8、uei.in; routing.iniporti; ,简单模块的定义,使用simple关键字,复合模块的定义,复合模块将其他模块组成一个单元 module Host types: parameters: gates: . submodules: connections: ,组装复合模块的例子,module WirelessHostBase gates: input radioIn; submodules: tcp: TCP; ip: IP; wlan: Ieee80211; connections: tcp.ipOut ip.tcpIn; tcp.ipIn wlan.ipIn; ip.nicI

9、n+ - wlan.ipOut; wlan.radioIn - radioIn; ,组装复合模块的例子,module WirelessHost extends WirelessHostBase submodules: webAgent: WebAgent; connections: webAgent.tcpOut tcp.appIn+; webAgent.tcpIn - tcp.appOut+; ,组装复合模块的例子,module DesktopHost extends WirelessHost gates: inout ethg; submodules: eth: EthernetNic;

10、connections: ip.nicOut+ eth.ipIn; ip.nicIn+ ethg; ,信道channels,信道封装与连接有关的参数和行为 信道后边有C+类定义 默认的类名是NED中的类型名;如果有class和namespace属性,默认的类名可以不是NED中的类型名 系统内置预定义的信道:ned.IdealChannel,ned.DelayChannel,ned.DatarateChannel。如果引入ned包import ned.*,则不需要写前面的ned.。 IdealChannel没有任何参数 DelayChannel有2个参数:delay、disabled Datar

11、ateChannel的参数datarate、ber、per,创建一个新的信道,channel Ethernet100 extends ned.DatarateChannel datarate=100Mbps; delay=100us; ber=1e-10; 通过子类化来添加参数和属性,也可以修改已有的属性 channel DatarateChannel2 extends ned.DatarateChannel double distance unit(m); delay = this.distance / 200000km*1s; 添加cost属性 channel Backbone exten

12、ds ned.DatarateChannel backbone; double cost = default(1); ,参数,参数是模块的变量,用于构建拓扑结构,作为C+代码的输入 参数的类型有:doubel,int,bool,string,xml。也可以声明为volatile 单位可以使用unit属性来指定 参数可以从NED文件或者配置文件omnetpp.ini中读取值,参数,simple App parameters: string protocol; / protocol to use: “UDP“ / “IP“ / “ICMP“ / . int destAddress; / desti

13、nation address volatile double sendInterval unit(s) = default(exponential(1s);/ time between generating packets volatile int packetLength unit(byte) = default(100B);/ length of one packet volatile int timeToLive = default(32);/ maximum number of network hops to survive gates: input in; output out; 上

14、面的模块有5个参数,其中三个有默认值,,参数赋值,参数赋值有几个途径:从NED代码赋值、从配置文件omnetpp.ini、从用户交互赋值 NED赋值的几个位置:在继承的子类中、NED类型实例化的子模块和连接定义中、包含子模块或者连接的网络和复合模块中。 (1)继承的子类中 simple PingApp extends App parameters: protocol = “ICMP/ECHO“ sendInterval = default(1s); packetLength = default(64byte); ,参数赋值,(2)在复合模块中的子模块中 module Host submodul

15、es: ping : PingApp packetLength = 128B; / always ping with 128-byte packets . (3)在网络的子模块中 network Network submodules: host100: Host ping.timeToLive = default(3); ping.destAddress = default(0); . ,参数赋值,(4)在网络或复合模块的参数快中 network Network parameters: host*.ping.timeToLive = default(3); host049.ping.destA

16、ddress = default(50); host50.ping.destAddress = default(0); submodules: host100: Host; . *-任何索引下标 是索引下标范围 *.、049.称为模式赋值或者深度赋值 *.用于匹配多路元素,network Network parameters: host*.ping.timeToLive = default(3); host049.ping.destAddress = default(50); host50.ping.destAddress = default(0); submodules: host0: Host; host1: Host; host2: Host; . host99:

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 管理学资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号