ADR implementation - min and max number of retransmissions (min NbTrans and max NbTrans)

InnovationWorldsensi
Tue, 27 May 2025 14:13:54 +0000
The Things Stack v3

Hi all,

I have a question regarding ADR, specifically about the number of retransmissions (NbTrans).

According to the documentation here, The Things Stack follows an algorithm proposed by Semtech, which selects NbTrans from the set {1, 2, 3} based on packet loss. You can see the implementation in this section of the code:

github.com/TheThingsNetwork/lorawan-stack

pkg/networkserver/mac/adr.go

5a816e817

288. 		switch r := adrLossRate(adrUplinks...); {


289. 		case r < 0.05:


290. 			dev.MACState.DesiredParameters.ADRNbTrans = 1 + dev.MACState.DesiredParameters.ADRNbTrans/3


291. 		case r < 0.10:


292. 		case r < 0.30:


293. 			dev.MACState.DesiredParameters.ADRNbTrans = 2 + dev.MACState.DesiredParameters.ADRNbTrans/2


294. 		default:


295. 			dev.MACState.DesiredParameters.ADRNbTrans = maxNbTrans


296. 		}

However, TTN also allows setting custom minimum and maximum values for NbTrans. If custom values are configured, the behavior of the ADR algorithm isn’t entirely clear to me—especially since the original algorithm is limited to NbTrans equal to 1, 2, or 3.

Could someone clarify how the algorithm behaves when custom NbTrans limits are used?

Thanks!

1 post - 1 participant