OMNet++ 学习小结(三)

一、Omnetpp.ini 的句法

比较长的句子可以用反斜线“/”隔断

以“#”起头的为注释,不影响整个文件

例如:

[General]

# this is a comment

foo="this is a single value /

for the foo parameter"

[General] # duplicate sections are merged

bar="belongs to the same section as foo"

在一个.ini文件中可以用Include关键字引进别的.ini文件有点类似C/C++语法

例如:.

..

include parameters.ini

include per-run-pars.ini

...

 

二、omnetpp.ini中包含的几个部分

如下:

[General]/[Run 1][Run 2].../[Cmdenv]/[Tkenv]/[Parameters]/[OutVectors]

1、几个General中比较常用的选项:

1)Network也就是仿真NED文件中设置的网络名 

2)Sim-time-limit和cpu-time-limit主要设置运行的时间,可以用ms/s/h等单位

3)Output-vector-file/output-scalar-file/snapshot-file用于设置输出文件

4)Preload-ned-files设置仿真中用的NED文件

 

 

三、例子:

[General]

preload-ned-files=*.ned

network = fifonet            //运行在NED中描述的fifonet网络中

sim-time-limit = 100h

cpu-time-limit= 300s

ini-warnings = no

[Cmdenv]

runs-to-execute = 1,2

#express-mode = yes

module-messages = yes

event-banners = yes

[Tkenv]

#default-run=1

[Run 1]

description="low job arrival rate"

**.gen.sendIaTime = exponential(0.1)

**.gen.msgLength = 100

**.fifo.bitsPerSec = 1000

output-vector-file = fifo-r1.vec

[Run 2]

description="high job arrival rate"

**.gen.sendIaTime = exponential(0.01)

**.gen.msgLength = 10

**.fifo.bitsPerSec = 1000

output-vector-file = fifo-r2.vec

以上是omnet++/samples/fifo仿真模型的ini文件中的内容

下图是该模型的网络描述NED文件,

可以发现,可以直接根据网络描述中各个模型的名称或参数直接在ini文件中进行设置

例如:

*.gen.sendIaTime = exponential(0.1)          //设置generator中的sendIaTime

**.gen.msgLength = 100                       //设置generator中的msgLength

**.fifo.bitsPerSec = 1000

 

 

 

四、命令行接口模式的一些特性

:进入C:/OMNET++/samples/fiifo/fifo -h 

不仅可以看到命令的帮助信息,还可以看到该仿真模型fddi的网络环境和模块参数:

(当然,要在仿真编译过后以上命令才有效)

The following components are available:

  networks:

    fifonet

  module types:

    FFSink

    FFGenerator

    FFBitFifo

    FFPacketFifo

    FifoNet

发布了24 篇原创文章 · 获赞 3 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/saeba5566/article/details/6207957