在OMNeT ++中的节点之间交换数据 [英] Exchange data between nodes in OMNeT++

查看:251
本文介绍了在OMNeT ++中的节点之间交换数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OMNeT ++来模拟网络.节点之间交换的消息是整数和复数类型.

I'm using OMNeT++ to simulate a network. The messages exchanged between nodes are type integer and complex number.

由于cMessage无法接受整数和复杂数据,因此如何在不同节点之间交换数据类型.

How can I exchange the type of data between different nodes, because cMessage cannot accept integer and complex data.

推荐答案

您可以使用.msg文件轻松定义具有任何内容的自定义消息.看看《模拟手册》中相应章节的相应章节 . 这样,您可以通过添加两个名为reim的类型为double的字段来定义复杂"类型的消息. 消息编译器将根据此定义生成cMessage的子类,您可以将其用于节点之间的通信.

You can easily define custom messages with any content using .msg files. Take a look at the corresponding chapter in the Simulation Manual. This way you can define your "complex" type message, by adding two fields of type double, named for example re and im. The message compiler will generate a subclass of cMessage from this definition, which you can use for communication between nodes.

这篇关于在OMNeT ++中的节点之间交换数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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