riebl / artery

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

Introducing network perturbations #201

Closed MadeInPierre closed 3 years ago

MadeInPierre commented 3 years ago

Hi,

I currently have a running service that uses CAM messages. I would now like to study the influence of my scenario under different network perturbations, such as random packet loss and additional delay.

I would appreciate to know if there is a preferred way of introducing those network disturbances inside artery. For now I can manually program those in my service (using manual delays and callback skips), but I suppose it is possible to model them using the INET/Vanetza/Artery stack directly?

Thank you for your guidance.

riebl commented 3 years ago

I have no easy answer to your question, unfortunately. Where do you want the additional delay to occur? On the transmitter or the receiver side? If you are using INET radios you can configure node[*].wlan[*].radio.receiver.errorModel to use a stochastic error model instead of the default NIST error model.

MadeInPierre commented 3 years ago

Thank you for your reply. Unfortunately, I have not found any built-in error model with an optional delay included.

I have first tried to measure the delay when a CAM is received:

uint16_t currentDeltaTimeMod = countTaiMilliseconds(mTimer->getTimeFor(mVehicleDataProvider->updated()));
uint16_t camDeltaTimeMod     = (uint16_t)ca->asn1()->cam.generationDeltaTime;
uint16_t delay = currentDeltaTimeMod - camDeltaTimeMod;

and the delays are either 0, 10, 60 or 70ms pretty randomly. Would you have an idea on why those values are outputed?

I would like to have something pretty consistent by default, and then add e.g. 40 additional milliseconds to model processing delay, packet retries under network saturation, etc.

riebl commented 3 years ago

You may add additional transmission delays in InetRadioDriver::handleDataRequest: Replace the send(packet, "lowerLayerOut") call by sendDelayed. INET ships with inet.physicallayer.errormodel.packetlevel.StochasticErrorModel, which sounds to me like what you are looking for.

MadeInPierre commented 3 years ago

Thanks a lot, I hadn't noticed the sendDelayed() option! This indeed affects the overall transmission delay. The StochasticErrorModel lets me apply a Packet Delivery Ratio or Bit Error Rate (both are equivalent).

Last small issue: the delay randomly ranges from 0 to 70ms without any delay. Here are some logs, one line represents one CAM message received (receptionDeltaTime, generationDeltaTime and finally the difference):

image

If you have any idea on why this random delay is observed, this would be really helpful to understand. 0ms doesn't seem normal either.

riebl commented 3 years ago

Well, mVehicleDataProvider is only updated for each SUMO step and generationDeltaTime's ticks are milliseconds. That is not particularly useful for latency calculations. I suggest having a look at the car2car-grid scenarios which employs the router's LinkLatency statistic.

MadeInPierre commented 3 years ago

Thank you, I can now control the delay, packet ratio and log all of these: image

I hope I didn't skip any obvious documentation, if you have tips it'd probably reduce my numer of questions :)