signetlabdei / lorawan

An ns-3 module for simulation of LoRaWAN networks
GNU General Public License v2.0
182 stars 130 forks source link

how to set packet loss rate in lorawan module #120

Closed xiaoyaodiwang closed 2 years ago

xiaoyaodiwang commented 2 years ago

I'd like to explore what may happen in the case of packet loss, so I need to set PHY packet loss rate between two nodes. How to set packet loss rate between two nodes in lorawan module?

CodeZombie commented 2 years ago

Usually packet loss is a measurement of how many packets were successfully received vs how many were lost due to interference/collisions. You don't control packet loss directly, its just a result of many factors in the network.

It seems however that you want to set up the network in such a way that packets will intentionally be lost at a given rate. There's a number of ways you could do this, but they're all going to have different characteristics and side effects.

One simple way would be to modify the SimpleGateWayLoraPhy::EndReceive method to randomly pretend there was interference say, 75% of the time, and destroy uplink packets before they're received. This, however, still wont give you an exact 0.75 packet loss rate, as other factors could still cause interference/packet failure.

DvdMgr commented 2 years ago

I think @CodeZombie's reply is quite good, thanks for taking the time to address this question!