问题
in my simulation using OMNeT++, Veins, and SUMO i want run multiple applications according to their vehicle type, as specified in the .rou.xml
file using type="XXX"
For example:
<vehicle ... type="private" ... >
runsAPP_private
(using something like*.node[*].applType ="APP_private"
)<vehicle ... type="bus" ... >
runsAPP_bus
(using something like*.node[*].applType ="APP_bus"
)
How can I define this in omnetpp.ini
?
回答1:
Veins 4.6 allows you to set any or all of the moduleType
, moduleName
, and moduleDisplayString
parameters not just to a string (which will set the OMNeT++ module type, module name, and module display string to instantiate for every vehicle driving in the configured region of interest, respectively):
You can also set the moduleType
, moduleName
, and moduleDisplayString
parameters to what Veins calls a mapping. This will use different parameter values for different SUMO vehicle types.
The full details can be found in the source code here or on the Veins website. Here's the short version:
"a"
: assign value"a"
to all nodes (for backward compatibility)"a=b
: assign value"b"
to vehicle type"a"
. the presence of any other vehicle type in the simulation will cause the simulation to stop"a=b c=d
: assign value"b"
to vehicle type"a"
and"d"
to"c"
. the presence of any other vehicle type in the simulation will cause the simulation to stop"a=b c=d *=e"
: everything which is not of vehicle type"a"
or"b"
, assign value"e"
A module type of "0"
means to not instantiate this module.
In your specific case, it seems like it should be sufficient to use *.manager.moduleName = "XXX=busNode *=node"
and to configure *.busNode[*].applType = "APP_bus"
and *.node[*].applType = "APP_private"
.
回答2:
I have the same issue. I tried to set the modulename as Christoph's answer but the I got the following error: "keys of mappings of moduleType and moduleName are not the same" It seems that the Veins mapping feature maps a veins moduleType "org.car2x.veins.nodes.Car" to a veins module name.
However, I managed to solve this error by defining a veins module to match the same keys, so the final omnetpp.ini setting would be:
*.manager.moduleType = "XXX=org.car2x.veins.nodes.Car *=org.car2x.veins.nodes.Car"
*.manager.moduleName = "XXX=busNode *=node"
*.busNode[*].applType = "APP_bus"
*.node[*].applType = "APP_private"
来源:https://stackoverflow.com/questions/47515408/veins-multiple-applications-in-multiples-vehicle-types