## 3 Methodology
### Selection of Adequate Parameters for LoRa-Based Communication
FEC requires error correction bits, redundant bits, to be added to the data. Thus, error coding incurs a transmission overhead. Although FEC reduces the data throughput, it increases the receiver's sensitivity. LoRa defined a set of values which are referred to as Code \(\in\) {1, 2, 3, 4} to calculate the Coding Rate (CR) based on the following equation [67]:  
\[\text{CR}=\frac{4}{4+\text{Code}} \tag{4}\]  
Hence, CR = {4/5, 4/6, 4/7, 4/8}, and it denotes that every four useful bits are encoded by 5, 6, 7, or 8 transmission bits, while the overhead ratio is 1.25, 1.5, 1.75, and 2, respectively. The coding rate could maximize the data rate if fewer code bits are used. The smaller the coding rate is, the higher the time on air is to transmit data, but the prolonged data transfer time will also affect the battery consumption. The packet header can be optionally included in the coding rate for use by the receiver. However, if more redundant bits are sent to the receiver, LoRa will consume more power. Therefore, in response to channel conditions, the coding rate and the robustness to interference can be changed. In addition, the relationship among LoRa transmission parameters is also relevant for energy consumption. If the bandwidth of LoRa is constant, the chirp rate differs according to the SF [67]:  
\[\text{R}_{\text{c}}=\text{BW}\cdot\text{R}_{\text{s}}=\frac{\text{BW}^{2}}{2^{ \text{SF}}}\left[\text{chirps}/\text{s}\right] \tag{5}\]  
For each SF, the orthogonality of the chirp prevents interference with any other [62]. Thus, when two or more transmitters use the same channel to transmit data with different SFs simultaneously, the packets do not interfere with each other [68]. With knowledge of the key LoRa parameters, bandwidth, and the spreading factor, the LoRa symbol rate can be controlled [54]:  
\[\text{R}_{\text{s}}=\frac{\text{BW}}{2^{\text{SF}}}\left[\text{symbols}/\text {s}\right] \tag{6}\]  
\[\text{SF}=\text{log}_{2}\left(\frac{\text{R}_{\text{c}}}{\text{R}_{\text{s}} }\right) \tag{7}\]  
Moreover, depending on the SF in use, LoRa bit rate ranges [54]:  
\[\text{R}_{\text{b}}=\text{SF}\cdot\frac{\left[\frac{4}{4+\text{CR}}\right]}{ \left[\frac{2^{\text{SF}}}{\text{BW}}\right]}\cdot 1000\left[\text{b}/\text{s}\right] \tag{8}\]  
Data rate (DR) can also be expressed considering LoRa transmission parameters [54]:  
\[\text{DR}=\text{SF}\cdot\frac{\text{BW}}{2^{\text{SF}}}\cdot\text{CR}\left[ \text{b}/\text{s}\right] \tag{9}\]The higher the SF and the lower the channel bandwidth, the lower the data rate is and, thus, the longer the data transmission time is [68]. The analysis of the effect of different values of SF and CR LoRa radio parameters on the consumed energy and range is performed in [69]. According to the presented results, the following can be concluded. When the SF value is high, the time necessary for data transmission increases. This means that the sensor node consumes more power to transmit data. The reason for setting a high SF value is to maximize the transmission range as one of the most critical factors in field deployment, as also proved in [15]. Furthermore, when the coding rate increases, the data transmission time and the consumed energy decrease. Therefore, when a long range needs to be ensured, energy consumption can be regulated by the CR factor. By increasing the CR value from 4/8 to 4/5, the energy consumption can be reduced while maintaining the maximal range enabled by the high SF parameter value [69]. However, this depends on the radio conditions because it could imply more retransmissions which would cause more energy consumption.