在OMNeT ++中的节点之间交换数据 [英] Exchange data between nodes in 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
文件轻松定义具有任何内容的自定义消息.看看《模拟手册》中相应章节的相应章节 .
这样,您可以通过添加两个名为re
和im
的类型为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屋!