Results Analysis in OMNET++

2019-02-11 09:33发布

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?

3条回答
劫难
2楼-- · 2019-02-11 10:05

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;
  }
}
查看更多
Luminary・发光体
3楼-- · 2019-02-11 10:08

In OMNeT++ the output results can be saved in two different types, and thus, file formats:

  1. Scalars (*.sca) - contain summary data (mean, sum, count, max, min) for the whole simulation run
  2. Vectors (*.vec) - contain fine-grained data (in form of time series) for each second of the simulation run

The 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.

  • To understand the difference between scalars and vectors read this.
  • To understand results recording using signals read this.
  • For a concrete example of how to use the signals and record a specific statistic & metric, check my detailed answer here.

Unfortunately, it is impossible to provide a "ready-to-use" solution for your case without knowing your code.

查看更多
一纸荒年 Trace。
4楼-- · 2019-02-11 10:10

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.

查看更多
登录 后发表回答