Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
841 views
in Technique[技术] by (71.8m points)

omnet++ - Calculating end-to-end delay for SimpleServerApp in Veins-LTE

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 analyzed in order to infer certain behavior.

If you don't understand really how this mechanism works 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 these 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 recorded. 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 to division by wrong number, wrong type of signal compared to the type of the variable. Also, make sure vector and scalar recording is not turned off (false) in the omnetpp.ini


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...