## 4 System Model  
### LoRa System Model  
In order to carry out the link-level study of LoRa and Sigfox, it is necessary to understand the configurable communication parameters open to optimization, such as spreading factor (SF), transmission power (TP), bandwidth (BW), coding rate (CR), and payload (PL). LoRa uses CSS [38] for modulation, where an up-chirp ranges between \((f_{o},f_{1})\) and a down-chirp between \((f_{1},f_{o})\), thus the BW can be calculated as \(BW=f_{1}-f_{o}\), and \(n\) the LoRa symbol is expressed in Equations (6) and (7). \[f(t)=\{f_{1}+k(t-n.T_{chip})for\{0\leq t\leq n.T_{chip}\} \tag{6}\]  
\[f(t)=\{f_{0}+k(t-n.T_{chip})for\{n.T_{chip}\leq t\leq T\} \tag{7}\]  
where slope is described as \(k=(f_{1}-f_{0})/T\) and total number of symbols are dependent upon SF, given as \(2^{SF}\). Symbol transmission time is \(T_{sym}=2^{SF}/BW\), length of one symbol is given as \(t_{s}=SF/B\), and bit rate is calculated as \(R_{b}(SF)=log_{2}(SF)/t_{s}\). LoRa packet format contains preamble, physical header, PL, and cyclic redundancy check (CRC). Once a frame is transmitted, LoRa opens a reception window to receive acknowledgement. The time for the first window of reception is the same as the transmit time, and the time for the second window is the same for all LoRa devices. The total time taken by a frame to pass is the sum of PL and preamble time and can be represented as \(T_{PKT}=T_{PRE}+T_{PAY}\) where \(T_{PKT}\) is the total time for packet to get transmitted and \(T_{PRE}\) and \(T_{PAY}\)[39] are the time taken by preamble and payload, respectively. Time to transmit preamble is given as \(T_{PRE}=(N_{PRE}+4.25)T_{SM}\), which can be further described as \(T_{PRE}=(N_{PRE}+4.25)\frac{2^{SF}}{BW}\), while payload is given as \(T_{PAY}=(N_{PL}*T_{SM})\). As described in [40], preamble can be programmed as per use case, thus a temporary variable \(TEMP\) is used to define the packet composition and its time on air (ToA) for onward simulations. Variable \(TEMP\) is defined as following. \[TEMP=\frac{28+8 PL+16 CRC-4 SF-20H}{4(SF-2 DE)} \tag{8}\]  
Now, payload can be given as  
\[N_{PL}=8+\max(ceil[TEMP])(CR+4)),0 \tag{9}\]  
Transmission time of payload \(T_{PAY}\) can be obtained as  
\[N_{PL}=8+\max(ceil[\frac{8 PL-4 SF+28-20H}{4(SF-2 DE)})(CR+4)) \tag{10}\]  
\[N_{PL}=8+\max(ceil[TEMP])(CR+4))\frac{2^{SF}}{BW} \tag{11}\]  
Finally, the total packet transmission time \(T_{PKT}\) is given as  
\[T_{PKT}=(N_{PRE}+4.25+(8+max[ceil[TEMP](CR+4),0])\frac{2^{SF}}{BW} \tag{12}\]  
\[T_{PKT}=(N_{PRE}+4.25+(8+max[ceil[TEMP](CR+4),0])\frac{2^{SF}}{BW} \tag{13}\]  
where \(PL\) is in bytes, \(SF\) is from 7 to 12, cyclic redundancy check \(CRC\) has options of '1' and '0', \(H\) is the header mode with values of '0' or '1', and data rate optimization for long payloads \(DE\) represents data optimization if used. LoRa provides three different bandwidth options of 125 KHz, 250 KHz, and 500 KHz within the allotted spectrum, and the chip rate is decided by bandwidth. A larger bandwidth enables a better quality signal, as it is more resilient to multipath fading. LoRaWAN abstracts over the SF and bandwidth to provide a parameter called dataratem; the airtime of LoRa depends on SF, BW, CR, and PL and can have a significant effect on collisions. SF can change the ToA of 20 byte LoRa packet from 9 ms to 1.3 s. Possible data rates as available through different SF and SNR values for LoRa are shown in Table 2. The capacity of LoRa (\(C_{lora}\)) can be calculated using Table 2 as following. \[C_{lora}=1*(SF(7-12))=1*(293,537,976,1757,3125,5468)\text{ bytes}/\text{s}=12.156 \text{ kb}/\text{s}\]  
LoRa makes use of simple linear block code such as hamming code for forward error correction (FEC), which is easy to implement and offers coding blocks with minimum hamming distance of 1, 2, 3, and 4 for code rates 4/5, 4/6, 4/7, and 4/8, respectively. A CR can increase the ToA as more number of bits are utilized while giving error detection and correction capabilities.