Results Analysis in OMNET++

*爱你&永不变心* 提交于 2019-12-18 18:22:00

问题


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?


回答1:


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.




回答2:


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.




回答3:


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;
  }
}


来源:https://stackoverflow.com/questions/31368620/results-analysis-in-omnet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!