计算Veins-LTE中SimpleServerApp的端到端延迟 [英] Calculating end-to-end delay for SimpleServerApp in Veins-LTE

查看:156
本文介绍了计算Veins-LTE中SimpleServerApp的端到端延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算Veins-LTE中SimpleServerApp的端到端延迟,但是我无法获得任何结果,当打开结果文件时,与该延迟有关的所有统计信息均为0或NaN. /p>

我查看了Tic-Toc教程,并尝试做类似的事情,但是那样一来,我什至没有得到统计信息:

在模块上:

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

以及在调用finish()时:

delayHist.recordAs("delayFinish");

其中

simtime_t delay;
cOutVector delayVector;
cLongHistogram delayHist;


然后我尝试从其他统计记录中复制该过程,但是我认为这种情况无法使用,因为我想发送较长的记录:

在NED文件上:

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

在模块上:

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


这就是我计算延迟的方法:

在发送模块上:

msg->setSendingTime();

在接收模块上:

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

我将不胜感激!

解决方案

自版本4.1以来,OMNeT ++引入了使用信号机制进行统计/度量收集和记录的概念.

简而言之,信号机制的工作原理如下:给定值附加到(内置类型的对象)信号上,并将此信息记录到输出文件(标量或矢量)中,以后可以分析以推断某些行为.

如果您真的不了解此机制的工作原理,请确保先阅读OMNeT ++手册的以下部分:

  1. 4.15基于信号的统计记录
  2. 12个结果记录和分析

一旦围绕这些概念,您将更容易获得输出结果方面想要的东西.


关于您的问题,是否要使用SimpleServerApp中的信号传递机制,首先必须.ned文件中声明信号和相应的统计信息:

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

然后您需要在.h声明信号变量:

simsignal_t nameOfMetricSignal;

然后.cc中的initialize()中注册信号,该名称与您在.ned中用于信号的名称相同:

nameOfMetricSignal = registerSignal("nameOfSignal");

最后,您要做的只是 emit()信号.即,将该值附加到信号上并进行记录.您要执行此操作的位置取决于您的实现.

emit(nameOfMetricSignal, theVariableToBeAttached);


对您来说,就像这样:

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


如果得到的0Nan可能是由于错误的数字除以信号类型而导致的,而不是变量的类型.另外,请确保在omnetpp.ini

中没有关闭矢量和标量记录(false)

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!

解决方案

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

这篇关于计算Veins-LTE中SimpleServerApp的端到端延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆