# An Application of a LPWAN for Upgrading Proximal Soil Sensing Systems
## 5 System Test and Analysis
### Channel Characteristics and Gateway Capacity Analysis
The number of preamble symbols is generally set to \(M_{\text{\emph{preamble}}}=4.25+\text{N}_{\text{\text{prog}}}\), where \(\text{N}_{\text{\text{prog}}}\) is the programmed preamble length. The total number of bytes of the physical layer data frame is calculated using Equation (2) [37]. \[\text{M}=\Big{[}M_{\text{\emph{preamble}}}+8+M_{\text{\emph{SF}}}*(CR+4)\Big{]} \tag{2}\]  
\[M_{\text{\emph{SF}}}=max\bigg{(}\bigg{[}\frac{8 PL-4 SF+28+16 CRC-20 IH}{4(SF-3 DE)} \bigg{]},0\bigg{)} \tag{3}\]  
Equation (3) gives \(M_{\text{\emph{SF}}}\), which mainly gives the number of payload symbols, where \(CR\in\{1,2,3,4\}\) represents the coding rate of \(4/(CR+4)\); PL is the MAC layer, including MAC header and application data payload (in bytes); \(SF\) is the spread spectrum factor. If the optional function \(CRC\) is enabled, \(CRC=1\); \(IH=1\) indicates that the implicit header function is enabled (i.e., the physical layer header is not transmitted); and \(DE=1\) indicates that the data optimization function is activated. For a given combination of spreading factor (\(SF\)), coding rate (\(CR\)), and signal bandwidth (\(BW\)) the total on-the-air (\(ToA\)) transmission time of a LoRa packet can be calculated using Equation (4), where \(T\)s is the transmission time of one symbol, which is calculated using Equation (5). \[ToA=Ts*M \tag{4}\]  
\[T_{\text{\emph{S}}}=2^{SF}/BW \tag{5}\]  
For a LoRa gateway with eight channels, Equation (6) calculates the channel capacity (i.e., number of nodes) without LBT (listen before talk) [38]. \[\text{S}=8\text{T}/(2\text{e}*ToA) \tag{6}\]  
where 8 represents eight channels, T represents the transmission interval, which is related to the packet length and rate. While, \(1/2\text{e}\) is the maximum throughput of the basic Aloha algorithm and e is a constant, equal to 2.718. Under the premise of 10-byte preload, the \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**TFEQ** & **RFREQ** & **POW** & **BW** & **TSF** & **RSF** & **CR** \\ \hline
475.5 MHz & 506.5 MHz & 20 dBm & 125 kHz & 12 & 12 & 4/5 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Range of spreading factors. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Spreading Factor** & **7** & **8** & **9** & **10** & **11** & **12** \\ \hline
**Demodulator SNR** & \(-7.5\) dB & \(-10\) dB & \(-12.5\) dB & \(-15\) dB & \(-17.5\) dB & \(-20\) dB \\ \hline \hline \end{tabular} Note that the spreading factor must be known in advance on both transmit and receive sides of the link, as different spreading factors are orthogonal to each other.  
\end{table} 
Table 3: The key parameter settings of the node. Figure 9: LoRa packet structure. relationship between different \(SF\) and \(BW\) and their theoretical gateway capacity are shown in Figures 10 and 11. If different algorithms are adopted, this will also lead to a change of maximum throughput, resulting in a change of theoretical capacity. For example, if the precondition is modified so that each node has a LBT function and the slot Aloha algorithm is used instead of the previous basic Aloha algorithm, the maximum throughput is different, due to different algorithms. At this time, the maximum throughput is 1/e, so the theoretical capacity of the channel will be doubled. It can be seen that under the condition of setting parameters as shown in Table 3, a single LoRa gateway can theoretically connect 5345 nodes. In practical applications, the gateway can receive SF7-SF12 signal data at the same time. Figure 11: When \(SF=12\), T = 3600 s, the gateway capacity at different bandwidths. Figure 10: When BW = 125 kHz, T = 3600 s, the gateway capacity at different \(SF\). Due to the limited demodulation and coverage capacity of a single gateway, in reality, it is actually difficult to meet the requirements of the theoretical capacity, but it can be deployed with multiple gateways to maximize the network capacity.