trymjb  
                
                  
                    May 22, 2021,  3:31pm
                   
                  1 
               
             
            
              Hi!
I wanted to investigate the airtime from various SF/payload combinations, so I implemented a python script calculating Time-on-air from the equations presented here LoRaWAN: Equal time-on-air for different sized payloads - #4 by trymjb 
However, when I compare the results to the airtime calculator provided by TTN, the results differ…
One example is with SF=7, payload = 7, BW = 125 kHz and region = EU868. TTN gives me 56.6ms, and my calculations yield 36ms. What could cause this issue?
CRC = 1
             
            
              
            
           
          
            
              
                Jeff-UK  
              
                  
                    May 22, 2021,  3:43pm
                   
                  2 
               
             
            
              Have you allowed for the (~13 Byte IIRC) header under LoRaWAN Spec?
             
            
              
            
           
          
            
              
                trymjb  
              
                  
                    May 22, 2021,  4:01pm
                   
                  3 
               
             
            
              
 Jeff-UK:
 
(~13 Byte IIRC)
 
 
Are you reffering to The preamble length? (8+4.25) In that case yes
             
            
              
            
           
          
            
              
                descartes  
              
                  
                    May 22, 2021,  4:11pm
                   
                  4 
               
             
            
              No, not the preamble, the LoRaWAN header - the bit that says what the device is, the count etc.
I think many of us use this for comparing payload changes:
https://avbentem.github.io/airtime-calculator/ttn/eu868/2 
             
            
              
            
           
          
            
              
                trymjb  
              
                  
                    May 22, 2021,  4:19pm
                   
                  5 
               
             
            
              @Jeff-UK  @descartes  If i understand it correctly, then The header is accounted for in The IH parameter from The equation posted above (IH = 0: enabled)
Yes the header is enabled (explicit
             
            
              
            
           
          
            
              
                descartes  
              
                  
                    May 22, 2021,  4:25pm
                   
                  6 
               
             
            
              Bit hard to tell, the image you uploaded was too big for the forum so I can’t see the whole formula.
But to be clear, if you have IH = 0, that’s enabling the header??
             
            
              
            
           
          
            
              
                trymjb  
              
                  
                    May 22, 2021,  5:39pm
                   
                  7 
               
             
            
              
Yes.
The equations for total airtime comes from the sx1276 datasheet
This link LoRaWAN Airtime calculator,LoRa Packet duration calculation  gives me the same answer that I calculate, however it is different compared to the TTN calculator.
Maybe it is possible to view the source code for the calculator to see how they do it?
             
            
              
            
           
          
            
            
              There seems to be a fair bit of confusion here.
At the LoRa level there is an optional header but that only has a small affect on total air time.
LoRaWAN (which is different to LoRa!) adds 13 bytes or so to the length of the actual data payload.
The calculations in the SX127x datasheets know nothing about LoRaWAN.
             
            
              3 Likes 
            
            
           
          
            
              
                Jeff-UK  
              
                  
                    May 22, 2021, 11:16pm
                   
                  9 
               
             
            
              Hi @trymjb  now you see why, in 1st reply to your original post after you said
“(I am writing about it in my masters thesis 
I suggested
  
  
     
 
And gave you some big clues
“from the LoRaWAN specs and 1st principles ” Note Not just the LoRa/Device specs
“spoilers: LoRaWAN Headers, Payload format and structures, Forward error correct/CRC check/Coding scheme etc. yields a SF specific staircase/quantised increase in total payload/on airtime ”
Good luck with the rest of your thesis 
             
            
              1 Like 
            
            
           
          
            
              
                trymjb  
              
                  
                    May 23, 2021, 11:19am
                   
                  10 
               
             
            
              Alright! Now it is more clear
Thanks Jeff