-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class C downlinks being formatted as Class A #7227
Comments
So according to the LoRa Basics Station documentation, the gateway by default holds the Downlink for 1 sec (configurable) if there are collisions for RX2, and if the downlink is aimed at RX1, then there is one retry in the next RX2 window.
Is this the reattempt that you are referring to?
This is by design. The Things Stack as an LNS has the best context on current and future downlinks for each gateway and it can calculate collisions and also hold long downlinks in the future. |
The gateway retry behaviour that you are referring to works if you are dealing with only one gateway. If you have multiple gateways that an end device can be served by (also if some of those are via peering with other networks), only the LNS has sufficient context to schedule downlinks effectively. The LoRa Basics Station has no feedback mechanism to indicate to the LNS what the size of the buffer is and what is the current capacity. Without this feedback, the LNS may simply try to keep scheduling downlinks and many of them may fail because the gateway is trying to backoff and retry. But if the LNS controls the scheduling (as is the case with TTS), it has the full context of all the downlinks to be sent per gateway and it can switch to a different gateway (if available) if the current one has a potential collision.
This simply means that there was a collision. If this was a Class C downlink, you would probably get a different error message after you've exhausted the retries. And during that time when you are still retrying, other downlinks might end up with collisions. As I see it, this is just a symptom of the problem and not the root cause.
Ok that's then the core issue that we need to understand. How many downlinks are you trying concurrently, which region are you in and do you have a separate antenna specific for downlinks? |
First I'll respond to your comment then I'll answer your questions.
I understand that at a high level, the LNS takes control of this scheduling (and that only it has sufficient information to accomplish this due to multiple gateways etc), but once its distributed its downlinks to the gateways, shouldn't you also allow the gateway to make adjustments (i.e., reschedule Class C downlinks) as necessary to make it work? Like, the TTS does its best to schedule across all possible gateways, but once it gets to the intended gateway, locally the gateway can make minor adjustments. But to your questions:
Scenario: 5 Class C end nodes being serviced by one nearby gateway. I am trying to send a downlink to each one so that they receive the downlink as simultaneously as possible (I am aware of the limitations of LoRaWAN so am accepting of variations in this simultaneity). All are able to reliably send uplinks and receive downlink independently, however when I try to send 5 simultaneous downlinks, the only about 50% (so 2-3) devices will receive it. How many downlinks concurrently: 1 downlink to each device = 5 total Below are error logs from the Basics Station when I try to perform this task. As you can see, the gateway is receiving the downlinks, but are getting conflicts so are missing some.
|
The core of the issue here is that the LBS spec currently does not have an immediate NACK mechanism to indicate to the LNS that a downlink cannot be scheduled so that the LNS can immediately retry other options. This is why the LNS keeps track of the downlinks for any particular gateway and controls the downlinks.
1 second is not really a minor adjustment. TTS can schedule some Class C downlinks with a delay of 530 ms (this is default and configurable) and so when the gateway is retrying the current downlink, TTS can schedule the next one which may increase the chance of collisions. I think we should focus on the issue of why your downlinks are failing first.
Ok how are you scheduling them? The specific API calls with the timing would be helpful. When you say simultaneous, what is the gap between downlinks? |
Sure! So when I am just doing individual testing:
When I am trying to send simultaneous downlinks to all end devices in the applications:
Currently we do not use any delay between updating each device so it happens 'simultaneously' (or as fast as the loop updates them). We have previously tested adding in a delay in the loop (up to 2 seconds delay per iteration) but did not see any improvement in the reliability. |
Ok and what is the exact RPC call? |
Here is the Azure function:
Every time the IoT hub is updated with a new message (e.g., an uplink), it will check to see if the "reported" value contains an "active" message. If it does then it will propagate that "active" message to all the other devices in the application by updating the "desired" values. The use of the "reported" and "desired" device twin values is part of the Azure IoT Hub integration with TTS. |
I'd need to see the contents of the exact JSON this function is sending actually. |
Hi, See an example of a JSON sent to the TTS from an Azure function to update send a downlink. Some identifying info removed.
|
Hey sorry for the delay in my response. I mean The Things Stack Downlink message (ex: https://www.thethingsindustries.com/docs/integrations/webhooks/scheduling-downlinks/#scheduling-downlinks). |
No problem. Just to clarify we are using the IoT Hub integration (https://www.thethingsindustries.com/docs/integrations/cloud-integrations/azure-iot-hub/device-twin/), so differs slightly. I think in any case, TTS is failing to properly schedule these packets thats leading to collisions. |
Summary
I am trying to send downlinks to a Class C device from TTS Cloud to a RAK7268 setup as a Basics Station. While the downlinks are being received, I believe they are being sent as Class A downlinks rather than Class C. The problem this causes is that if there is a scheduling conflict on the gateway, it does not reattempt like expected for Class C downlinks, but rather rejects it after the first attempt.
I believe this is caused by the fact that the Basics Station formatter
FromDownlink
does not have a Class C implementation, and therefore defaults to Class A downlinks. As you can see in the code, the downlinkDeviceClass
is formatted either only Class A or Class B.Here is a log of a downlink message received on the gateway after I sent a downlink from TTS Cloud to a Class C end device. As you can see the
dC
key is 0 (Class A) and should instead be 2 (Class C)See here for Basics Station documentation and expected downlink for a Class C device where
dC
is 2.Is there a potential workaround?
Steps to Reproduce
dC
key valueCurrent Result
Downlinks sent to Class C devices are classified as Class A downlinks
Expected Result
Downlinks sent to Class C devices are classified as Class C downlinks
Relevant Logs
No response
URL
No response
Deployment
The Things Stack Cloud
The Things Stack Version
No response
Client Name and Version
No response
Other Information
No response
Proposed Fix
No response
Contributing
Validation
Code of Conduct
The text was updated successfully, but these errors were encountered: