Varying message size

94 views
Skip to first unread message

Ioannis Venetis

unread,
May 20, 2013, 3:17:09 AM5/20/13
to castalia-...@googlegroups.com
Hello everyone,

I am developing a mobile agent application using Castalia. I have already calculated the path that the mobile agent should follow, starting from the sink. The agent should collect some data when visiting each node and append it to the data already collected from previous nodes. This means of course that the size of the message that is transmitted from one node to the next increases after each hop. Moreover, the length of the path is not known a priori. The mobile agent should visit all nodes of my network, whose number might change between different simulations. Therefore, the size of the path is only known after all nodes report to the sink.

Now I am stuck how to represent such a message in Castalia and how to send it from one node to the next one. What I need to do is to send the whole path and the collected data to the next node. I think that a structure like the following will do:

struct {
int CurrentSizeOfMessage;
int PointsIntoArrayOfNextLineAndShowsNextNodeOfPath;
Path_t ArrayOfStructuresThatRepresentPath[];
int ArrayOfDataThatChangesSize[];
}

My idea is to change at each node the value of "CurrentSizeOfMessage" according to the data collected and use this value during transmission. I assume that setByteLength() should be used to declare the size of the message transmitted.

I will also update the second variable to point to the next node of the path. Hence, when the next node receives the message, it will know where to send the message.

But as you see, I need to fill in two arrays whose size I don't know in advance. How do I declare a message of this type, how do I fill it and how do I change at every hop the size of the message that has to be transmitted (setByteLength()?)?

Of course, if you have any other suggestion about how to proceed with this I would be interested to hear it.

Best regards,

Ioannis E. Venetis


Thanassis Boulis

unread,
May 21, 2013, 7:02:11 AM5/21/13
to castalia-...@googlegroups.com
You should read the OMNeT manual on messages to understand what is allowed a bit better.

We have discussed variable arrays in messages before in this forum, here's part of a thread:
-------
The OMNeT manual has information on this.

In Castalia we do use dynamic arrays in msg files. Look at Mac802154Packet.msg
you can see the line.

   GTSspec GTSlist[];

This is a dynamic array of a structures (the struct is defined in the message as well)

Then in Mac_802.15.4_Module.cc you can see how we use it. for example
 
beaconPacket->setGTSlistArraySize(GTSlist.size());
for (int i = 0; i < (int)GTSlist.size(); i++) {
if (CAPlength > GTSlist[i].length) {
CAPlength -= GTSlist[i].length;
GTSlist[i].start = CAPlength + 1;
beaconPacket->setGTSlist(i,GTSlist[i]);
 } else {
GTSlist[i].length = 0;
trace() << "Internal ERROR: GTS list corrupted";
}
}

"GTSlist" above is an internal variable (a C++ vector) which we use to fill the message field
------

Reply all
Reply to author
Forward
0 new messages