# Evaluating LoRaWAN Connectivity in a Marine Scenario
## 2 Material and Methods
### LoRa and LoRaWAN
The physical layer of a LoRa transmission is based on the Chirp Spread Spectrum (CSS) modulation, which is also used for radar applications, and it is characterized by a signal that varies its frequency by increasing (up-chirp) or decreasing (down-chirp) in the time taking the whole band to transmit the signal. The parameters that characterize CSS modulation are the band used (\(BW\), kHz), the Spreading Factor (\(SF\), variable from 6 to 12) that is the number of bits encoded per chirp, and the encoding network (\(CR\), variable from 1 to 4 depending on the code rate chosen among 4/5, 4/6, 4/7 and 4/8) that indicates the redundancy applied to the data. These factors affect the bit rate (\(BR\)) of the LoRa transmission through the following equation:  
\[P_{rx}=Tx_{power}-Path_{loss}+G_{Tx}+G_{Rx} \tag{2}\]2  
Depending on the specific application, it is necessary to choose the best combination of the various parameters considering that an increase in the data rate corresponds to a reduction in \(SF\) and that an increase in reliability leads to an increase in \(SF\) and a consequent higher \(SNR\). The format of a LoRa transmission is encoded in the following parts: (1) preamble, consisting of 8 up-chirps covering the entire band, the last two of which represent the synchronization word (sync word) necessary to distinguish the different network nodes using the channel as a shared resource; (2) synchronization symbols, including two down-chirps and a quarter of down-chirps for a duration of about 2.25 symbols that allow time synchronization; (3) header (\(H\)), that is an optional field and it is transmitted with a code rate of 4/8 and comprises the size of the payload, the code rate used and if the 16-bitCyclic Redundancy Check (\(CRC\)) control code is enabled; (4) payload (\(PL\)), consisting of a maximum of 255 bytes. The number of symbols (\(Rn_{s}\)) that make up the payload can be quantified through the following equation:  
\[P_{rx}=Tx_{power}-Path_{loss}+G_{Tx}+G_{Rx} \tag{2}\]3  
where \(H\) is equal to 20 if present or 0 otherwise, \(DE\) is equal to 2 if the data rate optimization algorithm is enabled with \(SF\) greater than 11 or 0 otherwise. The media access control (MAC) layer communication protocol, defined as LoRaWAN (LoRa Wide Area Network), introduces in the LoRa technology an upper-level layer necessary for the application of geolocation based on the power of the same signal received (\(RSSI\)) from multiple gateways or on the measurement of the time difference arrival of the same signal to multiple gateways (TDOA). Specifically, LoRaWAN is an open standard that defines the communication protocol for the LPWA network based on a LoRa chip, that rules the MAC in the link layer based on a pure ALOHA type algorithm. The use of the LoRaWAN protocol implies that there is no return channel, the access time to the channel is divided into intervals, the first packet at the head of the queue is the one transmitted, and in case of need for a confirmation message (ACK) the end-node can retransmit the data after a random time interval. The most used topology for LoRaWAN is the star or the star-of-star in which the messages from a single end-node are routed to a central server via a gateway, without multiple hops. Point-to-point communication between the end-node and the gateway is not allowed since the end-nodes transmit regardless of the number of gateways that may receive the packet. Each gateway that detects a LoRaWAN message forwards the data to the network server associated with it. The management of redundancy detection, security checks, and message scheduling are tasks left to the server. The nodes of the network can communicate simultaneously on the channel as long as they use different frequencies or \(SFs\). This topology makes it possible to facilitate the tracking of resources since the end-node sends data directly to multiple gateways.