Getting the SNR in a routing model

73 views
Skip to first unread message

Kory Hamzeh

unread,
Oct 15, 2023, 6:46:29 PM10/15/23
to ns-3-users
Hello,

I am new to ns-3. I am developing a routing model for adhoc wireless networks. The routing protocol sends and receives it's PDU packet over UDP. I need to get the SNR of the link when I receive a packet. I have read through the documentations and searched this list, but have not come up with a solution for getting the SNR. Any help and guidance would be greatly appreciated. Is there another routing model that fetches the SNR?

Thanks,
Kory.

Tommaso Pecorella

unread,
Oct 15, 2023, 8:36:28 PM10/15/23
to ns-3-users
Good question, and (unfortunately) it requires a complex answer.

Typically a routing protocol doesn't care about the link SNR, because routing is done at IP level, and it should be device-independent.
Said so, if your routing protocol is meant to be used for a specific interface type (let's say WiFi), it makes sense to use also the link quality information. As a matter of fact, many routing protocols for LLNs (i.e., 802.15.4 and similar) use something like that - it's just called differently: Link Quality (LQI).

Now, as far as I know WiFi (I'm assuming you want to use WiFi) doesn't forward that info in the normal data path. The WifiPhy/MonitorSnifferRx trace does provide this info, but pairing it with a packet at UDP level will be a serious pain, you'd have to receive the packet twice (one on the trace, one on the UDP socket), then discard everything you don't need (and they're a *lot* of packets), then... a real pain.

My suggestion is to open an issue on our tracker. Adding a SNR tag to the packets forwarded up in the stack should be fairly doable (by the Wifi module maintainers), and you'll have a much cleaner solution. My only real suggestion is to call it Link Quality instead of SNR, and to have it generic, i.e., something like [0...255] where 255 is exceptionally good, and 0 is really bad. That should be more than enough for routing decisions, and your protocol will be more flexible. As a hint. LrWpan uses a LqiTag, defined as "The LQI is the total packet success rate scaled to 0-255."

Kory Hamzeh

unread,
Oct 20, 2023, 12:10:04 AM10/20/23
to ns-3-users
Hi Tommaso,

Yes, this routing protocol is for wireless networks. I am in a time crunch and will probably have to add the SNR tag myself. It looks like adding the tag is trivial, but finding the correct point in the code to do it is a bit more tricky. I need to add it to packets going up the IP stack. Do you have any suggestions? If I end up with a clean solution, I will probably contribute it back to the ns-3 project.

Thanks,
Kory

Tommaso Pecorella

unread,
Oct 20, 2023, 5:55:21 AM10/20/23
to ns-3-users
I'd say in the Phy, most probably in the RxEnd function (dunno how's called exactly)
Reply all
Reply to author
Forward
0 new messages