# Feasibility Analysis of a LoRa-Based WSN Using Public Transport
## 4 Network Architecture  
The network to be realized should cover a metropolitan city. The sensor nodes (also referred as end-nodes) will have to be installed on public transport vehicles. They will acquire information about environmental parameters through the installed sensors and will send data to the gateways. Gateways receive this information and relay it to the supergateway. The supergateway receives all the information and keeps track of the correct operation of end-nodes and gateways in the network, reporting any possible malfunction. The supergateway is connected to a computer equipped with an ad-hoc processing software and both a database server and a web server for storing and displaying the data measured by each node. Since the network will be realized with LoRa technology without using the LoRaWAN protocol, a proper algorithm for both addressing and routing has been implemented. In general, addressing and routing can be implemented in either a static or a dynamic manner. Given the intrinsically static configuration of our scenario, this is reflected in the defined setup of the network. The best solution in terms of minimum exchanged traffic, throughput, and fault-tolerance turned out to be a multi-layer topology (which translates either into a star-of-stars or tree topology, depending on the position of the supergateway in the network). In this multilayer topology, gateways are organized in layers depending on their distance from the central hub. Considering the city of Turin, for instance, a possible configuration of the network is represented in Figure 2. The distance between the central node and the gateways satisfies the propagation considerations and measurement results reported in the following sections. Figure 2: The Turin city map and a possible arrangement of the supergateway (red indicator) and first-level gateways (green indicators). As shown in Figure 3, packets always travel from higher layers to lower layers reaching the supergateway, which is ideally at the zero level. The packets are transmitted in two different ways depending on whether the communication is from an end-node to a gateway or from a gateway to another gateway. It is important to highlight that the transmission of a single packet, according to the chosen SF of LoRa modulation, may be as long as some seconds. It means that the communication between the end-node and a specific gateway receiving the packet must be ensured for the entire transmission of the packet. However, this is not a problem, since the distances of the gateways from the end-nodes (that are in movement) are properly designed to avoid the needs for roaming operations. _First mode_: the end-node sends a broadcast message looking for a gateway nearby; gateways receiving this request inform the end-node about their availability to handle the packet. The end-node will forward it to the first gateway answering its initial query. In the unfortunate event that there are no gateways nearby, the end-nodes keeps trying and looking for another available gateway. _Second mode_: a gateway, which receives a packet, does not behave as an end-node (looking for gateways nearby and sending the packet to one of them); it instead realizes a multicast communication directed to all gateways of the lower layer, thus allowing the packet to reach the supergateway. It is straightforward that such an implementation results in some redundancy in the network, but this phenomenon can be limited by properly arranging gateways in space. This apparent disadvantage can be also exploited to keep track of working nodes in the network and detect possible faults (Figure 4). This operation is carried out by the supergateway. Before discarding duplicated packets, it checks the path they followed and infers, based on the knowledge of the entire topology of the network, which gateways may not be working correctly. Since end-nodes are expected to collect data from sensors and transmit them at regular time intervals, the supergateway is able to identify malfunctioning end-nodes as well.