eegea
unread,Mar 18, 2022, 5:45:06 AM3/18/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to OMNeT++ Users
Hi all,
I have been wondering how to dynamically create a vector of modules with Omnet 6. I need to create some modules from the info (such as position) that I get from a txt file.
In previous versions it was possible to just add a
node[nodes]: Host {
}
in the network NED and just use:
cModule* mod = nodeType->create(moduleName.c_str(), parentmod, nodeVectorIndex);
mod->finalizeParameters();
mod->getDisplayString().parse(moduleDisplayString.c_str());
mod->buildInside();
In the module where I read the file. It just increased the elements of the list. Now, in omnet 6, in cmodule.cc lines 253 to 256 it checks if the node[] vector exists and the size that it was given in the NED. It refuses to create the module if the index is already occupied (is there any way to force not to create the Host before my file manager?) or if the index is greater than the maximum size. If the @dynamic tag is added to the NED, the it complains that no submodule named "node" is present because it ignores it in cnednetworkbuilder.cc l. 788.
It is inconvenient because I have to fix the maximum size in advance. And it seems that it is not possible to add nodes to that vector from a truly dynamic source, like from a message from a SUMO TraCI server.
Of course, I can just add submodules to the parent module without a vector. But this is also inconvenient, when you go to analyze the results file and it is no longer sorted by module vector and so on.
So, is there any way to do this that I am not aware of?
Thanks a lot