## 5 The Proposed Linear Multi-Hop Analytical Model  
This section introduces the mathematical models that were developed for estimating capacity, energy consumption, and throughput for single-hop and multi-hop LoRaWAN networks in pipeline monitoring scenarios. The network capacity is determined by the number of sensors distributed along the pipeline and the amount of data transmitted through the network. Subsequently, data traffic can be assessed by calculating the packets generated by the sensors. The inner distance between sensors is set to 200 m.  
To assess the network capacity, the number of sensors in the coverage area as well as the achieved throughput were calculated. For the number of sensors, the following equation was used:  
\[Number\ of\ devices=\left(\frac{pipeline\ length}{inner\ distance}\right) \tag{1}\]  
In a single-hop topology, the resulting number will be divided by 2e (considering Aloha access-scheme collisions). Equation (2) describes the throughput per sensor [41; 46]. We applied the equations to fit pipeline scenarios for both single-hop and multi-hop topologies. The sensors were set up in various zones based on their distance from the GW (4 km, 6 km, 8 km, and 10 km). First, the throughput per sensor was calculated, and then the aggregation of the sensor's throughput (TH) at each distance from the GW was calculated. Equation (3) was used for single-hop topologies, and Equation (4) was used for multi-hop cases:  
\[TH=\ sample\ rate\times payload \tag{2}\]  
\[TH=\sum_{i=0}^{n}(\mathit{samplerate}\ \times\ payload) \tag{3}\]  
\[TH=\sum_{i=0}^{n}(\mathit{No.\ hop\times\mathit{samplerate}\times\ payload}), \tag{4}\]  
where n is the total number of sensors at each distance from the GW, and the sample rate corresponds to the frequency of measurements (temperature and pressure sensors). To estimate the energy consumption, it is essential to calculate the ToA [11; 41], because the time required to transmit data packets affects energy consumption. To model the ToA, we used a set of equations that were applied in [10; 39; 41; 46]. There are several alternative equations for calculating the ToA; however, we ought to select the most accurate one that produces exact results, such as the online LoRaWAN calculator. Equation (5) was used to identify the payload duration, and the preamble payload was given by Equation (6):  
\[N_{SYMBOLS}=8+max\bigg{[}ceil\bigg{[}\bigg{(}\frac{8 PL+24-4 SF+20 EH}{4(SF-2 DE)} \bigg{)}(CR+4),0\bigg{]}\bigg{]}, \tag{5}\]  
where PL is the payload,  
DE is the low data optimization, DE = 0 if SF \(<\) 11, which means disabled, EH shows if the header is explicit, EH = 1 when it is not, and CR is the coding rate that has a value of 1-4, here CR = 1. \[N_{PREAMBLE}=8+4.25 \tag{6}\]  
After that, we calculate the symbol rate (Rs) using Equation (7):  
\[R_{s}=\frac{BW}{2^{SF}}, \tag{7}\]  
where the BW = 125 MHz, and SF = 7 for multi-hop scenarios. In the end, the ToA can be calculated using the following equation:  
\[ToA=\frac{[N_{PREAMBLE}+N_{SYMBOLS}]}{R_{s}} \tag{8}\]  
For multi-hop topologies, the equation included all concurrent packet transmissions to fit the topology:  
\[ToA=\sum_{n}ToA \tag{9}\]  
The energy consumption per sensor can be calculated using only the sending and receiving energy, as described in [11; 40; 47]. Since the LoRaWAN configurations SF, BW, and TP affect the sensor energy, the equations were customized to include that. Thus, we incorporated the ToA into the equations. Equation (10) describes the energy consumption per sensor in a single-hop scenario, while Equation (11) describes the energy consumption in multi-hop scenarios:  
\[E=ToA(E_{Rm}+E_{Sm}) \tag{10}\]  
\[TH=\ sample\ rate\times payload \tag{2}\]0  
where E\({}_{\text{Rm}}\) is the energy cost of receiving, E\({}_{\text{Sm}}\) is the energy cost of transmission, and N is the number of hops in communication. LoRaWAN has different transmission power (TP) values, ranging from 2 dBm to 20 dBm, and we calculated the energy cost for each of them.