Exchange data between nodes in OMNeT++

2019-08-17 17:36发布

问题:

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

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

回答1:

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.