riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
202 stars 128 forks source link

Measure CAM's age: from sendCam() of transmiters to indicated() of receivers. #291

Closed HuyTyskland closed 1 year ago

HuyTyskland commented 1 year ago

Hello everyone,

Currently, I want to implement the way to measure the age of a CAM: from sendCam() of its transmitter to indicate() of its receiver.

I notice, and based on this issue, I can get the time, in ms, when a CAM is generated by accessing the genDeltaTime. By changing mTimer->getTimeFor(mVehicleDataProvider->updated()) to mTimer->getCurrentTime() as in here, I can get the simulation time. To measure that CAM's age, at its receiver, I subtracted the simTime().inUnit(SIMTIME_MS) by the generationDeltaTime as in here.

However, the results, starting from minus values, kept increasing. I believe my way to do as I want (measuring age of a CAM) is not the right way.

Is there a more proper way to do this? or did I have some error in the way I do it? or there is already a signal emitted for such measure?

Best regards, Huy Nguyen.

HuyTyskland commented 1 year ago

@awillecke @riebl Sorry if this message bothers you guys. Would you mind suggesting me on this matter?

riebl commented 1 year ago

You are not bothering me, it's just that I don't have as much spare time to spend on Artery as I would like to. I think you are looking for Timer::reconstructMilliseconds which creates a time stamp from a time delta fragment in milliseconds, as genDeltaTime is. Artery can also measure quite precisely (i.e., better than ms granularity) the link latency, see https://github.com/riebl/artery/blob/4bc468e372091fa392d43c5fc3358821a21534c9/scenarios/car2car-grid/omnetpp.ini#LL25C1-L25C82

HuyTyskland commented 1 year ago

Hello @riebl Thank you for your answer. I can do it now.