Reputation: 47
I am using Veins framework with OMNET++ to simulate a highway scenario.
I am using cOutVector
to collect the results from my experiments.
I have more than 1000 nodes (vehicles), and the cOutVector
collects results individually for each module (node). However, I need to collect the overall results.
For example, How many beacons were received by all nodes? Is there anyway of collecting such results?
Upvotes: 1
Views: 5014
Reputation: 1565
In OMNeT++ the output results can be saved in two different types, and thus, file formats:
*.sca
) - contain summary data (mean, sum, count, max, min) for the whole simulation run*.vec
) - contain fine-grained data (in form of time series) for each second of the simulation runThe output file formats are tightly coupled with the statistic
mechanisms of OMNeT++. The statistics allow you to store different result recording modes, such as: count, sum, mean, vector.
In your case you would need to look at the sum
for each of your nodes.
@statistic[foo](record=count,mean,vector);
These OMNeT++ mechanism seem complicated in the beginning, but they are rather easy once you wrap your head around. Also, they are very powerful giving insights to many aspects of your simulations.
Unfortunately, it is impossible to provide a "ready-to-use" solution for your case without knowing your code.
Upvotes: 8
Reputation: 128
For example, How many beacons were received by all nodes? Is there anyway of collecting such results?
You can create a static variable and everytime a node receive one beacon you increase the value of this variable.
For example: (on app_name.h)
static int beaconCount; // in protected
int app_name::beaconCount = 0; // in the and of app_name.h, before #endif.
(on app_name.cc)
void app_name::onBeacon(WaveShortMessage* wsm) {
app_name::beaconCount++; // received one beacon
}
After this you can print the beaconCount
in the function finish() or save in save file.
void app_name:: finish(){
if(strcmp(findHost()->getFullName(), "car[0]") == 0){ // For only the car[0] print the final value
cout << "Count of beacons received by all node:" << beaconCount << endl;
}
}
Upvotes: 2
Reputation: 11
Q: Do you mean you want to collect aggregate stats of all nodes?
If so then I suggest you to use R, which provides more functionalities and customization. Though, you'll need time to learn the basic operation. There is tutorial in the omnetpp-resultfile Github page.
Upvotes: 1