OMNetpp学习笔记

上传人:公**** 文档编号:512735104 上传时间:2023-04-17 格式:DOC 页数:14 大小:487.50KB
返回 下载 相关 举报
OMNetpp学习笔记_第1页
第1页 / 共14页
OMNetpp学习笔记_第2页
第2页 / 共14页
OMNetpp学习笔记_第3页
第3页 / 共14页
OMNetpp学习笔记_第4页
第4页 / 共14页
OMNetpp学习笔记_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《OMNetpp学习笔记》由会员分享,可在线阅读,更多相关《OMNetpp学习笔记(14页珍藏版)》请在金锄头文库上搜索。

1、OMnetpp 作为一种仿真工具(与ns2 , opnet 并列),在 P2P 仿真方面具有很大的优势。模块概念模块OMnetpp中功能被封装为一个个的模块。简单模块( simplemodules )为基本模块,每个 simplemodule 完成一个基本功能。Compound module 由多个 simple module组成。Messages, Gates, Linksmassage 是模块之间通信的媒介,可以包含复杂的结构体。Gates are the inputand outputinterfacesof modules;messages are sentout throughout

2、put gates and arrive through input gates.Each connection (also called link) is created within a single level of the modulehierarchy:withina compound module,one can connectthe correspondinggates of twosubmodules, or a gate of one submodule and a gate of the compound module。包传输模拟connections可以使用物理链路模拟。

3、支持的参数有:data rate,propagationdelay,biterror rate and packet error rate, and may be disabled.这些参数在channel对象中。参数Modules 可以拥有参数。 Parameters can be assigned in either the NED files or the configuration file .Topology Description MethodThe user defines the structure of the model in NED language descriptio

4、ns (Network Description).Programming the AlgorithmsSimulationobjects(messages,modules,queues etc.)are representedby C+ classes.They have been designedto work togetherefficiently,creatinga powerfulsimulationprogramming framework. The following classes are part of the simulation class library:module,

5、gate, parameter, channelmessage, packetcontainer classes . queue, array)data collection classesstatistic and distribution estimation classes (histograms, P2 algorithm for calculating quantiles etc.)transient detection and result accuracy detection classes使用 OMNetppbuilding and running simulations一个

6、OMNetpp model 由以下几部分组成:1. NED 语言拓扑描述( .ned 文件):使用参数, gates 等描述 module 结构。 NED文件可以用任意 text editor编辑,但 OMNetpp IDE 提供了两种方式:图形与文本。2.消息定义( .msg 文件)定义各种消息类型。OMNetpp 会将消息定义转换成C+类。3. 简单模块源文件(Simple module sources):C+文件仿真系统包括两部分:1. 仿真内核2. 用户接口3. NED 语言NED 概述NED特点:1)层次性:复杂模块由简单模块组成2)模块化3)接口4)继承性5)包结构的管理:如Jav

7、a6)内部类型:(可以定义局部变量)7) Metadata annotations(元数据注解?)NED 开始图 1网络举例这个网络描述如下:.connections:+ datarate=100Mbps; +;+ datarate=100Mbps; +;+ datarate=100Mbps; +;.channel类型可以定义channel类型.connections:+ C +;+ C +;+ C +;.一些简单模块(App, Routing, and Queue)简单模块定义有关键字:simple 。在这个例子中,我们定义了node 为简单模块(trafficgeneration, rou

8、ting, etc.其实也挺复杂的) 。应当定义一些简单模块,然后组合起来组成一个复合模块( compound module )。一个流量生成的简单模块,一个路由模块,一个队列模块。( Well have one simple module for traffic generation (App), one for routing(Routing), and one for queueing up packets to be sent out (Queue))simple Appparameters:int destAddress;.display(i=block/browser);gates

9、:input in;output out;simple Routing.simple Queue.这些放在,和文件中。NOTE:module类型名称首字母大写,gate , parameter 等用小写。 NED区分大小写。display()称作 display string,在图形环境中显示。i=.定义默认图标。一般的, 在 NED中-words 如display称作properties。用来注释metadata ,可以用于 files, modules, parameters, gates, connections, and other objects, and parameter val

10、ue复合模块module Nodeparameters:display(i=misc/node_vs,gold);gates:inout port;submodules:app: App;routing: Routing;queuesizeof(port): Queue;connections:- ; queuei.in;i - queuei.out; queuei.line porti;此为 node 的定义。复合模块可以和简单模块一样,有parameter ,gate 。简单模块simple Queueparameters:int capacity;display(i=block/queu

11、e);gates:input in;output out;以上是一个 Queue模块。参数都是可选的。 动作不在 NED语言中定义, 而是在 C+ 中定义。默认情况下, OMNetpp会在与 NED名字相同的 C+类中寻找(如此例, Queue)。也可以使用下面的方式指定:simple Queueparameters:int capacity;class(mylib:Queue);display(i=block/queue);gates:input in;output out;如果多个模块在同一名字空间中,则可以采用如下的方式namespace(mylib);simple App .simpl

12、e Router .simple Queue .这样 C+类为 mylib:App ,mylib:Routerandmylib:Queue 。类似于 C+中类的继承,简单模块之间也可以存在这样的关系:simple Queueint capacity;.simple BoundedQueue extends Queuecapacity = 10;该例 BoundedQueue给 capacity 设置了初始值,这个模块使用的类与 Queue 相同,都是 Queue。若要使用不同的类,则需要用以下方式:simple PriorityQueue extends Queueclass(PriorityQueue);此时, PriorityQueue使用的类为PriorityQueue。复合模块module WirelessHostBasegates:input radioIn;

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

最新文档


当前位置:首页 > 行业资料 > 国内外标准规范

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