## 3 Methodology
### Time on Air Constraints of Communication Based on LoRa  
To optimize the overall energy consumption in the network, LoRaWAN facilitates the control of the air time and data rate [3]. To effectively manage the regulatory constraints of time on air and receiver sensitivity, it is necessary to be able to calculate the total on-the-air transmission time of a LoRa packet for a given configuration of communication parameters, i.e., spreading factor (SF), coding rate (CR) and signal bandwidth (BW), as defined hereafter. For calculating the time on air, it is convenient to define the symbol duration \(\mathrm{T_{symb}}\). The symbol duration of a LoRa symbol is defined as [76]:  
\[\mathrm{T_{symb}}=\frac{2^{\mathrm{SF}}}{\mathrm{BW}}, \tag{10}\]  
This is the time taken to send chirps at the chirp rate, recalling that the bandwidth defines the chirp rate. The symbol duration is based on the spreading factor (SF) and the bandwidth (BW). Each LoRa symbol comprises \(2^{\mathrm{SF}}\) chirps, each covering the entire bandwidth. Every LoRa packet consists of a preamble and data. The preamble contains only upchirps, while the data part comprises upchirps with discontinuities (the position of the discontinuities in frequency is what encodes the transmitted information). Therefore, LoRa packet duration can be calculated as the sum of the duration of the preamble and the transmitted packet. The preamble length is calculated as follows [54]:  
\[\mathrm{T_{preamble}}=\left(\mathrm{n_{preamble}}+4.25\right)\mathrm{T_{symb}}, \tag{11}\]  
where \(\mathrm{n_{preamble}}\) is the number of programmed preamble symbols. The payload duration depends upon the header mode enabled, implicit (headerless) or explicit (with header) modes. The number of symbols that make up the packet payload and header are given by [54]:  
\[\mathrm{payloadSymbNb}=8+\mathrm{max}(\mathrm{ceil}\left(\frac{8\mathrm{PL}-4 \mathrm{SF}+28+16-20\mathrm{H}}{4(\mathrm{SF}-2\mathrm{DE})}\right)(\mathrm{ CR}+4),0), \tag{12}\]  
with the following dependencies: the number of payload bytes PL, the spreading factor SF, the header (H = 0 when header is enabled, and H = 1 when no header is present), the data rate optimization (DE = 1 when the low data rate optimization is enabled, DE = 0 when it is disabled), and the coding rate CR (from 1 to 4). If the time on air requires reduction, and the packet length is known in advance, then the header information can be removed once the destination of the packet is known. The payload duration is then the symbol period multiplied by the number of payload symbols [54]. \[\mathrm{T_{payload}}=\mathrm{payloadSymbNb}\mathrm{\text{-}}\mathrm{Tsymb}, \tag{13}\] \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{6}{c}{**Packet Payload Format: 6-Byte Payload**} \\ \hline
**Measured Parameter** & **Battery** & **Temperature** & **Humidity** & **Atmospheric Pressure** & **Irradiation** & **Rain** \\ \hline Bit start position & 1 st bit & 6 th bit & 14 th bit & 23 rd bit & 35 th bit & 44 th bit \\ No. of bits & 5 & 8 & 9 & 12 & 9 & 5 \\ Value in binary & 10100 & 10000110 & 01101111 & 1001011011 & 000000001 & 00000000 \\ Value in units & 4 & 27.0 & 44.6 & 100,987 & 3 & 0 \\ Units & V & \({}^{\circ}\)C & \% & Pa & W/m\({}^{2}\) & Pulses \\ Resolution & 0.05 & 0.5 & 0.2 & 17 & 3 & 1 \\ Max no. of values & 32 & 256 & 512 & 4096 & 512 & 32 \\ Min–max value & 3–4.55 & \(-\)40–87.5 & 0–102.2 & 60,000–129,632 & 0–1536 & 0–32 \\ Req min–max values & 3–4.5 & \(-\)50–80 & 0–100 & 60,000–128,000 & 0–1500 & 0–25 \\ Check & OK & OK & OK & OK & OK & OK \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Packet payload of 6 bytes. Then, the time-on-air, or packet duration, is simply the sum of the preamble and payload duration [54]:  
\[\mathrm{T_{packet}=T_{preamble}+T_{payload}}, \tag{14}\]  
LoRaWAN devices must comply with the regulations imposed in the industrial, scientific, and medical (ISM) radio bands in which they operate [3]. These regulations include a limitation in the duty cycle of transmission and excited transmit power [77].