lorawan-stack icon indicating copy to clipboard operation
lorawan-stack copied to clipboard

Display both AFcntDown and NFcntDown on the device console

Open StevenCellist opened this issue 1 year ago • 3 comments

Summary

Display the application downlink frame counter as well as the network downlink frame counter in the device console, next to the uplink frame counter.

Current Situation

Currently, the single downlink frame counter only keeps track of the application downlink frame counter, and does not show anything related to the network frame counter. To find out the actual FCnt and keep track of network downlinks, one has to leave the console open to catch a network downlink, which shows the actual FCnt. Although, even this event only shows a complete FCnt, not a separation between AFcnt and NFcnt.

Why do we need this? Who uses it, and when?

Adding the network downlink frame counter aids easier analysis of behaviour of individual nodes, e.g. performance under ADR. Some RF environments are quite unstable, causing many ADR downlinks; being able to compare these 'hidden' downlinks quantitively will help a lot. It also helps validating correct behaviour of nodes in general.

Proposed Implementation

Change the current downlink frame counter such that it shows the AFcnt / NFcnt values when hovering over it with the cursor, or duplicate the downlink arrow, with e.g. one with N and one with A next to it, with a complete separation between the two.

Contributing

  • [ ] I can help by doing more research.
  • [ ] I can help by implementing the feature after the proposal above is approved.
  • [ ] I can help by testing the feature before it's released.

Code of Conduct

StevenCellist avatar Feb 21 '24 10:02 StevenCellist

and does not show anything related to the network frame counter. To find out the actual FCnt and keep track of network downlinks, one has to leave the console open to catch a network downlink, which shows the actual FCnt.

So the issue is that the network downlinks are only counted when the Console is open?

KrishnaIyer avatar Feb 22 '24 12:02 KrishnaIyer

No, sorry for not explaining clear enough. By that, I mean the following: image The frame counter at the top displays N/A (because I didn't send any downlink, i.e. AFcntDown = N/A), but the network has sent 143 downlinks, which I can only find by leaving the console open to catch these downlinks. Because in the JSON, it shows f_cnt = 142. There currently is no way to see this real number of downlinks except for leaving the console open (for possibly, hopefully a very long time!) to catch one of these downlinks.

And sadly, the information in the JSON doesn't even discern AFcntDown and NFcntDown; in the next screenshot there is a device where I have sent a downlink through the console, but a network downlink reports the same f_cnt value as the full_f_cnt value. image

I hope this explains what I would like to see improved!

Edit: note that these devices run an actual LoRaWAN v1.1 stack that really discerns these two counters!

StevenCellist avatar Feb 22 '24 12:02 StevenCellist

Ok noted. This looks like a bug.

@ryaplots: What field is used by the Console to display the downlink frame counter?

KrishnaIyer avatar Feb 22 '24 12:02 KrishnaIyer

@StevenCellist: We looked into this and it's indeed true that we only display the application frame counter for LW1.1 devices. We should perhaps add two frame counters here if the device is LW 1.1. @kschiffer what's your suggestion?

KrishnaIyer avatar Mar 06 '24 13:03 KrishnaIyer

@KrishnaIyer that would be very much appreciated! My ideas would be a) two downlink counters side by side, or b) showing the separate counters upon mouse hover.

StevenCellist avatar Mar 06 '24 13:03 StevenCellist

Yeah let's store and display both downlink counters:

image

@StevenCellist would this serve your needs sufficiently?

kschiffer avatar Mar 07 '24 06:03 kschiffer

@kschiffer yes perfect! The only thing I wonder, is if this is clear enough for new users, as to what they should look at, but I myself would be very happy with it.

StevenCellist avatar Mar 07 '24 06:03 StevenCellist

Yeah, we'll add a detailed description to the tooltip (help icon) as well.

kschiffer avatar Mar 07 '24 07:03 kschiffer

What should be the text of this detailed description? @KrishnaIyer @kschiffer

ryaplots avatar Apr 05 '24 08:04 ryaplots

I think this following makes sense:

Nwk: frame counter for network downlinks (FPort = 0) App: frame counter for application downlinks (FPort >=1)

KrishnaIyer avatar Apr 05 '24 08:04 KrishnaIyer

@kschiffer @ryaplots first and foremost thank you very much for implementing the separate counters: makes my life much easier and looks great! I'm sorry for bumping this; however, it seems the implementation is not yet perfect. I'd like to show two cases:

  • When no (App) downlink is sent, the arrow and n/a text is missing - see the following screenshot Screenshot 2024-05-03 082641 There is some sort of n/a going on, which I think would be for the Nwk counter, as this following device has no downlinks at all: image It just doesn't appear to be working well for the App downlinks.

  • When a new downlink occurs while the Console is open (at least for Network downlink; didn't test Application downlink yet as otherwise the above screenshot does not occur), the frame counters do weird things - see the following screenshot Screenshot 2024-05-03 090523 The AFcntDown value takes the new value of NFcntDown, while the previous value stays the same... this may have something to do with the f_cnt / full_f_cnt field not showing any distinction between App/Nwk downlinks, but I am not aware of the details on these fields.

And in some case, which I don't know how to reproduce yet (screenshot from a couple days ago), the counters get the same value even though the App should still be at n/a: WhatsApp Image 2024-05-01 at 23 02 34_b2b25487 This is likely in the same ballpark as the previous point.

If I can help by sharing access to these LW v1.1 devices (or maybe you can already access them, dunno), let me know please! Would be happy to test :)

StevenCellist avatar May 03 '24 07:05 StevenCellist