Calculating end-to-end delay for SimpleServerApp i

2019-01-09 17:09发布

问题:

I'm trying to calculate end-to-end delay for SimpleServerApp in Veins-LTE and I'm unable to get any results, when I open the result file all the statistics related to the delay are 0 or NaN.

I looked in the Tic-Toc tutorial and tried to do something like that, but that way I didn't even get the statistics:

On the module:

delayVector.record(delay);
delayHist.collect(delay);

and when calling finish():

delayHist.recordAs("delayFinish");

where

simtime_t delay;
cOutVector delayVector;
cLongHistogram delayHist;

Then I tried to copy the procedure from other statistic recording, but I think that can't be used in my case, because I want to send a long:

On the NED file:

@signal[delay](type="long");
@statistic[delay](title="delay"; source="delay"; record=vector, stats, histogram);

On the module:

emit(delay,delay); //where the first delay is the signal and the second one, the value.

That's what I do to calculate the delay:

On the sending module:

msg->setSendingTime();

On the receiving module:

simtime_t delay = simTime() - msg->getSendingTime();

I'd appreciate any help!

回答1:

Since version 4.1 OMNeT++ introduced the concept of statistics/metrics collection and recording using the signal mechanisms.

In brief the signal mechanism works as follows: a given value is attached to a (built-in object of type) signal and this information is recorded to output files (either as scalars or as vectors) which later on can be analysed in order to infer certain behaviour.

If you don't understand really how this mechanisms work please make sure to first read the following sections of the OMNeT++ manual:

  1. 4.15 Signal-Based Statistics Recording
  2. 12 Result Recording and Analysis

Once you wrap your head around this concepts you will feel more comfortable to get what you want in terms of output results.


As far as your question is concerned if you want to use the signalling mechanisms in the SimpleServerApp you will first have to declare the signals and the corresponding statistic in the .ned file:

@signal[nameOfSignal](type="sameAsTypeOfVariable");
@statistic[nameOfStatistic](title="nameToAppearInTheOutputFile"; source="nameOfTheSourceOfThisStatistic"; record=typeOfStat1, typeOfStat2, typeOfStat2);

Then you need to declare the signal variable in .h:

simsignal_t nameOfMetricSignal;

Then register the signal in the initialize() in .cc same as the name that you used in the .ned for the signal:

nameOfMetricSignal = registerSignal("nameOfSignal");

Lastly all you have to do is emit() the signal. That is, attach the value to the signal and let it be recoreded. The location where you want to do that depends on your implementation.

emit(nameOfMetricSignal, theVariableToBeAttached);


For you that would be something like:

  1. NED:

@signal[delay](type="float");

@statistic[delay](title="delay"; source="delay"; record=mean, sum, stats, vector);

  1. .h simsignal_t delaySignal;
  2. .cc delaySignal = registerSignal("delay");
  3. .cc emit(delaySignal, delay);

If you are getting 0 or Nan that could be due division by wrong number, wrong type of signal compared to the type of the variable. Also make sure vector and scalar recording in not turned off (false) in the omnetpp.ini



标签: omnet++