*3.1. Experimental Scenario*

To validate the tests done by the simulator, we intended to recreate a scenario with real sensors on the university campus of the Universidad Panamericana in Guadalajara, Mexico. We considered an area of 300 × 300 m<sup>2</sup> surrounded by a two-story building, a green area, living rooms, and free area with a terrace, as shown in Figure 14.

Figure 15 shows the top view of the engineering building at the university campus and the location of the sensors in this building. This plan helps to better visualize the walls and the specifications of the construction to give a better idea of the traffic routes of people, location of computer equipment, lights, etc.

There is a Gateway with LoRa technology and WiFi, which is the general hub of all the nodes. This Gateway receives data from all devices and sends the information to a platform called the things network. The devices that are held as nodes are divided into three technologies: Bluetooth, LoRa, and Zigbee.

Zigbee nodes are a set of high-level wireless communication protocols, based on the IEEE 802.15.4 standard, i.e., communication using the 2.4 GHz frequency. The CC2530 device is configured as the coordinator; its main function is to create the network in mesh topology. The other four devices can be connected to the network and have communication between them, allowing the possibility to have devices withdrawn from the coordinator because the information packet passes through the other devices to the coordinator. Each of the devices contains a temperature sensor, allowing measuring the ambient temperature in different locations of the university campus. The coordinator sends a signal to know which devices are connected to the network and in turn, these send their temperatures every 5 min. After obtaining all data, the coordinator sends the information through another protocol called LoRa to the Gateway.

**Figure 14.** The test area at Universidad Panamericana (Mexico).

**Figure 15.** Top view of the test area (engineering building at Universidad Panamericana, Mexico).

For LoRa nodes, LPWAN is a specification for low power and wide area networks designed specifically for low power consumption devices operating in local, regional, national, or global networks. In Mexico, LoRa uses the 915 MHz frequency. The topology of LoRa is point-to-point; there is a gateway or hub and one or more nodes. The Gateway is in charge of reading all the packets that are on that frequency. The nodes are devices that transmit small information frames to avoid high-energy consumption.

The created network consists of five different devices: garbage sensor, light sensor, accelerometer sensor, gyroscope sensor, and environmental sensor. The Gateway is the device that acts as connection interface between devices and allows resource sharing between two or more computers. The Gateway used contains the LoRa and WiFi protocols. It obtains all the transmitted data through the LoRa protocol; data are then transmitted via WiFi allowing them to be found on the ThethingsNetwork platform. In this platform, it is possible to display the data separately from each node, knowing when the last transmission was made, the frequency of transmission of each device, and its measurements. This device obtains all the data transmitted by the Zigbee coordinator, all the data transmitted by the LoRa nodes, and also the data transmitted by the Bluetooth concentrator.

For Bluetooth nodes, Wireless Personal Area Networks (WPAN) is an industrial specification operating on the frequency of 2.4 GHz as well as Zigbee. There are Bluetooth nodes that work as beacons (low power consumption devices that emit a broadcast signal). In this case, each node has a light sensor and they are constantly sending light values. In addition, there is a fifth device, which works as beacon scanner. The function of this device is to receive all the data coming from the other nodes, decode them, and send them through LoRa using another module that contains that protocol.

Figure 16 describes the devices used for the real scenario according to the wireless technologies mentioned above. A communications sniffer was also used in addition to the application interface www.thethingsnetwork.org. In the middle of the figure, two devices act as coordinating nodes. The distribution of the nodes in real space is shown in Figure 17 where we have an area of approximately 300 m × 300 m that is displayed in Figure 14. We show an approximate radius of coverage of the sensors of 40 m. However, it can vary according to the antenna. Empirically it can be smaller by the amount of collisions according to wireless technology.

**Figure 16.** Devices used for the experimental validation [40].

**Figure 17.** Distribution of nodes in the test space.

Figure 18 shows an example of the plot of the packets with some wireless technology, in this case, LoRa. The package and console display interface is www.thethingsnetwork.org, which allows us to observe the quality parameters of links, frequencies, lost packets, etc. Thanks to this analysis and the energy model, we can sharpen the precision of the model and further refine the types of energy to detect possible inefficient expenses of actions in the network nodes.

**Figure 18.** Example of frame for performance metrics.

Table 6 shows three useful performance metrics for analyzing the behavior of a network. The results for three different types of protocol are described: reagent (AODV), hybrid (MPH), and proactive (ZTR). The overall performance is better in the MPH protocol because it has route redundancy yet, it does not have so many routes to generate too much overhead and network collisions. We also

note that the simulator has the ability to accurately reproduce (approximately 2% difference) the real scenario under the specific conditions on each node according to the wireless technology used. In this way, different routing protocol rules suitable for coexisting networks in a wireless medium can be tested and energy optimization models can be generated according to the technology used and the target application. This makes the simulator an effective tool in predicting packet routing and power consumption models.


**Table 6.** Performance metrics for the real scenario and the simulation.

Using this simple energy model, we can implement energy saving techniques in some of the activities carried out by the nodes and we are capable of quantifying their impact on the total expenditure. For Figure 19, we implemented the MPH protocol in order to contrast the energy expenditure of each type of energy in the model under both stable and adverse conditions. For the four different wireless technologies, the rules of the MPH hybrid protocol were used. We observed that when there were adverse conditions such as shutting down, 15% of the nodes were turned off for 10 min every two hours, implying that the energies that have the greatest consumption impact are: CSMA energy, transmission energy, and receiving energy, increasing their value approximately by 40%. In these kind of situations, the model allows the use of routing protocols suitable for the operation of the network.

**Figure 19.** Energy under stable and adverse conditions for 22 nodes for each type of the energy model.
