将数据导入OMNET ++ [英] Import data to OMNET++

查看:237
本文介绍了将数据导入OMNET ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在OMNET ++中为网络建模.我所拥有的是一个文本文件(可以是Excel文件格式),其中包含节点的名称,接口列表和接口连接.我想做的是编写一个程序(可能是一个插件)将此文件提供给OMNET ++,并(自动)基于此文件创建.ned和.cc.理由是节点/接口的列表很长,这使得手动操作变得很困难,并且连接的更改可能使重新创建它变得很困难,而取消它是自动完成的.您能否指向一些链接/网站/文档,以便我学习如何编写一个插件来读取信息并自动创建节点及其连接?显然,以后可以根据需要在插件中修改节点类型和特征.

I am trying to model a network in OMNET++. What I have is a text file (can be in an Excel file format) with nodes' names, list of interfaces, and interface connections. What I like to do is to write a program (perhaps a plug-in) to feed this file to OMNET++ and (automatically) create .ned and .cc based on this file. The rationale is that there is a long list of nodes/interfaces, that makes it difficult to do it manually, and possibly a change in the connections makes it difficult to recreate it, undelss it is done automatically. Could you point to some links/websites/documents, so that I learn how to write a plugin to read the information and create the nodes and their connections automatically? Obviously, the node types and characteristics could be modified in the plugin as necessary later.

(那里的一些其他信息)...

(some other information there)...

cr1.atl-cr1.hst cr1.atl cr1.hst 2488
cr1.kcy-cr1.wdc cr1.kcy cr1.wdc 2488
cr1.atl-cr2.atl cr1.atl cr2.atl 10000
cr2.atl-cr1.wdc cr1.wdc cr2.atl 2488
...

cr1.atl-cr1.hst cr1.atl cr1.hst 2488
cr1.kcy-cr1.wdc cr1.kcy cr1.wdc 2488
cr1.atl-cr2.atl cr1.atl cr2.atl 10000
cr2.atl-cr1.wdc cr1.wdc cr2.atl 2488
...

其中第二列是源节点,第三列是目的节点,第一列是链接(firstNode-secondNode).第四列是链接的容量/延迟或其他信息.

where the second column is the source node, the third column is the destination node, and the first column is the link (firstNode-secondNode). The 4th column is the capacity/delay or other information of the link.

推荐答案

如果您希望它尽可能地灵活,我建议编写一个小的Python脚本,该脚本读取.csv文件并根据需要呈现.ned文件.

If you want this to be as flexible as possible, I would recommend writing a small Python script that reads a .csv file and renders .ned files as needed.

您甚至可以考虑使用像Mako这样的模板引擎.从其网站上报价,Mako非常易于使用:

You might even consider using a templating engine like Mako. Quoting from its website, Mako is pretty straightforward to use:

from mako.template import Template
print(Template("hello ${data}!").render(data="world"))

这篇关于将数据导入OMNET ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆