1. Introduction
Currently, the main cities struggle to solve problems such as transportation, mobility, and security, among many others. In the desire to solve them with technological development, a new concept has emerged, classified as smart cities or intelligent cities. These have as the main objectives to achieve sustainability in economic, social, and environmental issues, including information and communication technologies (ICT). It is projected that by 2050, 68% of the world’s population will be concentrated in urban areas, so there is a latent trend to establish smart cities and address transport and mobility solutions. Industry 4.0 currently has solutions based on the internet of things (IoT), 5G, big data, and software. In addition, there is exponential growth in the management of smart cities [
1]. There will be billions of internet-connected devices, such as sensors, actuators, cell phones, laptops, and tablets, to be used in different areas such as mobility, transportation, smart grids, smart lighting, smart homes, and buildings. Cisco estimates that by 2020 there will be 50 billion devices, which would imply a possible saturation of bandwidth in the transport of data from the perimeter of local area networks (LANs) to data centers [
2,
3].
Data analysis on an IoT architecture is mostly done with solutions purely based on a cloud computing infrastructure. This results in high response times and ends up not being the best solution for applications that need a real time response. Due to these limitations in future implementations of the IoT, the term fog computing is emerging and is at the edge of the network, specifically between the physical devices and the backbone of data networks [
4]. This new technology will allow there to be no saturation in data transportation, improve response times, and even provide greater security since most of the information will be handled within the internal network. One of the communication protocols that are coupled to fog computing is long range (LoRa). LoRa has attracted the interest of researchers because it is an open standard and contributes to the development of sustainable smart cities as it is linked to circular economy concepts [
5]. LoRa has a high tolerance to interference which makes it an ideal protocol for industrial environments; it has a high sensitivity to receive data, low power consumption, long range from 10 km to 20 km, low data transfer, and point-to-point communication.
There are some emergency-oriented technologies, such as smart transducer integrator (STI), green wave, and closed-circuit television (CCTV). STI has become one of the most important IoT applications for the development of smart cities. For this reason, several studies have been carried out to improve vehicular traffic and optimize the time of emergency vehicles [
6]. This technology provides a basic component in STI for the implementation of smart sensor networks (SS-Nets) and IoT. The STI aims to address the current needs of SS-Nets and IoT. Innovative aspects of the STI system are the built-in standardized mechanisms to improve reliability and ubiquitous operation, considering the ability to operate even in completely sealed or inaccessible environments, such as metal enclosures.
Similarly, green wave technology would enable an emergency vehicle that allows traffic lights to turn green as you cross the intersection. This study is based on an implementation using RFID technology, in which the RSUs have readers to receive the signal from the tags installed in the vehicles [
7,
8]. The disadvantage of this system is that having a passive RFID tag unable to energize leads to possible misuse of the system because, if the vehicle is not in an emergency, the traffic lights will continue to be activated. Along the same line, CCTV systems are installed in different cities with an image processing technique. The downside of this system is that in bad weather situations, like rain or fog, there may be an inadequate or inaccurate response for emergency vehicles.
This research consists of prototyping an IoT solution through a prototype on a sensor network with components such as proximity sensors or beacons installed in emergency vehicles and intersections. Mesh sensor networks between traffic lights and walkways. Implementation of the DSA (distributed services architecture) framework in gateways, allowing them to act as fog computing devices [
9]. The sensors communicate with each other through the LoRa protocol, which is classified within the LPWAN (low power wide area network) protocols that are oriented to have a large range of coverage and low energy consumption, which allows having several distributed nodes in a wide geographical area safeguarding the power consumption of the device.
The application of IoT in fog computing for the development of an emergency response system is highly beneficial due to the technology’s ability to collect and process data in real time. By bringing processing and storage capacity closer to IoT devices, faster and more efficient responses to emergencies can be achieved. A system that uses IoT and fog computing to respond to emergencies will constantly monitor connected devices and sensors, collect data, and send it to the cloud for processing. The cloud can then make decisions in real time and send information back to the device or user for action.
3. Results
Using the simulation environment, it was remarkably possible to demonstrate that data processing as close as possible to the nodes allows a considerable reduction in response times. For the justification and verification of the results in the simulation environment, it was proposed to make a comparison of the response time between a fog computing infrastructure and cloud computing. For the comparison of the response times between these two technologies, the concept of round-trip time (RTT) is used as the main concept. RTT is defined as the time it takes for a packet to reach a destination host plus the time it takes to return to the source. In a fog computing scenario, this situation may vary slightly since the packet sent for processing does not necessarily have to return to the origin (vehicle). Instead, the node that processes the information sends the signal to the actuators to modify the traffic light at intersections. In cloud computing, the same node that sends the alert must receive instructions from the cloud computing that processes the information to know which actuators are influenced by this response.
For RTT calculation, there are four sources of packet delay, which are transmission time, propagation time, node processing time, and queue time. Transmission time is the time it takes for a packet to traverse the link, which is influenced by the capacity and maximum speed of the medium. This type of delay can vary according to the transmission medium of the access, aggregation, and core networks. The propagation time is related to the transmission medium, taking as the main factor the distance of the link and the speed of propagation of the waves that travel through the medium. Processing time is the delay it takes for a back-end application or service to process information to act. The wait time is the level of congestion that an intermediary equipment requires, such as a router.
For fog computing, the queue delay does not need to be measured or calculated because the Bluetooth and LoRa protocols are used in LPWAN, which handle the forwarding of information at the physical layer and data link layer. To calculate the fog computing transmission delay, it must be considered that there may be one or more hops for the traffic light to turn green, in addition to the fact that the links and the transmission media change since two different protocols are used at the link layer level. For the calculation of the link using the Bluetooth protocol, the packet sent from the vehicle to the RSU is a BLE advertisement packet with beacon data such as MAC address, manufacturer ID, UUID, major and minor. In
Figure 17, the values that serve as beacon identifiers, among others, are presented.
Equation (4) is used to calculate the transmission time, where Tt is the transmission time, Lp is the packet length in bits, and Ts is the transmission rate in b/s. The packet to be sent can have a maximum of 376 bits. So, to calculate the transmission delay (5), we consider this data and the maximum link speed, which is 32 Mbps in Bluetooth 4.0. The transmission time (6) between the vehicle and the RSU under ideal conditions is 1.17 × 10
−5 s.
Once the RSU receives the beacon packet, it is decompressed to check the MAC address if it corresponds to an emergency vehicle, and the RSSI is obtained. Since these two applications are on the same chassis or node, this information is sent to the Windows Forms application through the local host. The fog computing node, in this case, the Raspberry Pi B+, picks up the beacon packet via the bluepy script that scans for beacons. Thus, it needs to be sent to the Visual Studio app via sockets over the network card, which is 330 Mbps. The packet being routed to the app contains MAC, RSSI, and the message. It counts 48 bits of physical address, four bytes of RSSI, and six bytes of the message because it contains six characters, obtaining a data frame of 128 bits. Once these data are obtained, the 330 Mbps ethernet interface transmission delay is applied to send the information to Windows Forms (7), resulting in 3.9 × 10
−7 s (8). This step is not required for the Z83-F node.
The processing is then done in the app, so there is a possibility to calculate the time required for the processing in the app. In this process for Raspberry Pi 3B+, the last 10 RSSI values are obtained via averaging to get a more accurate RSSI value. This is done because, in the Python script where the RSSI has been collected, the process of obtaining these values is not exact and oscillates between −60 dB and −70 dB. The MAC address and the alert message are verified to determine the action to take. The processing time is 50 milliseconds for the Raspberry Pi 3B+ and 20 milliseconds for the Z83-F node. This calculation can be done by either of the two methods shown in
Figure 18.
Once the information is processed and the destination of the emergency vehicle is known, the last step is to send the alert via LoRa to the rest of the nodes and actuators to activate the green traffic lights. In this case, LoRa contains a data frame with a maximum length of 250 bytes and a transfer rate of up to 300 kbps (9). Applying these values in Equation (4), a transmission delay of 6.6 × 10
−3 s is obtained (10).
Table 4 indicates the transmission time of the Raspberry Pi 3B+ on the Bluetooth 4.0 beacon, internal network card, and LoRa.
To calculate the total transmission time of the Raspberry Pi 3B+, the sum of the transmission time of all the elements (11) is calculated, resulting in 6.61209 × 10
−3 s (13).
Table 5 below shows the transmission time of the Z83-F on the Bluetooth beacon and LoRa.
To calculate the total transmission time of the Z83-F, the sum of the transmission time of all the elements (14) is calculated, resulting in 6.617 × 10
−3 s (16).
Finally, it is necessary to calculate the propagation delay using Equation (17). Where Pt is the propagation time, Ld is the link distance, and Ps is the propagation speed.
Taking as refractive index the air as it is the medium in which the waves are transmitted, the propagation speed of the air is equal to 299704764 m/s. Once the propagation velocity of the waves in the medium in which they are transmitted is obtained, the propagation delay is calculated. In the first instance, where the emergency alert is picked up in the vehicle, the message can be received up to 100 m away (18). With these data, the result in the V2I link is 3.3 × 10
−7 s (19).
In LoRa, the links and distance between computing nodes in the fog will be approximately 3 km because the RSUs do not have to be so far apart for message reception. Using Equation (20) and the LoRa distance data, a propagation time of 1 × 10
−5 s is obtained (21).
Table 6 indicates the propagation time in the Bluetooth beacon and LoRa of the computing nodes in the fog.
To calculate the total propagation time with the Raspberry Pi 3B+ and the Z83-F, the propagation times of all the elements are added together (22), resulting in 6.617 × 10
−3 s (24).
Once the transmission delay, propagation delay, and processing delay of the node are obtained, the times calculated for each node are added, and the total is obtained, which results in 0.08664 s or 86.64 milliseconds; for the Z83-F minicomputer, it is 0.02662 s or 26.62 milliseconds.
Table 7 lists the total transmission time, total propagation time, and total processing time on the Raspberry Pi 3B+. According to the results obtained in terms of time between different devices, there is no significant difference because they are all fast enough for this application.
To calculate the total delay time on the Raspberry Pi 3B+, the total transmission, propagation, and processing times are added together (25), resulting in 0.0932 s (27).
Table 8 below shows the total transmission time, total propagation time, and total processing time for the Z-83F device.
To calculate the total delay time in the Z83-F device, the total transmission, propagation, and processing times are added together (28), resulting in 0.0328 s (29).
The transmission and propagation time in the V2I link with Bluetooth 4.0 technology was calculated, see
Figure 19. Additionally, the transmission and propagation time of the LoRa link and the processing time in the fog computing nodes were in two different cases if a Raspberry Pi 3B+ or a Z83-F mini-PC was used.
For the calculation of cloud computing, the procedure is more complex because it must be carried out by software that allows us to know how long it will take for the package to be returned after a delay. Since it is not possible to know with certainty what the transfer rate of the links where the data is transported will be nor the distance, and above all, by transporting this data through an aggregation and core network, it is not possible to know if they travel through a WWDM, DWDM, or SDH link, among many others that make up the core of the internet. For this cloud-computing-based IoT solution scenario, the Z83-F node will not perform any processing and will forward the information as soon as possible to the WAN. This is for the information to be processed in cloud computing. To determine the data, use the terminal on UNIX-based operating systems or CMD for Windows computers and run the tracert or traceroute command. The results of the traceroute command are that the packet needs approximately 32 hops to reach its destination.
Once the hops have been determined, the end-to-end response time can also be determined using the ping command by sending an ICMP packet to the server. The response will be received using an acknowledgment of receipt (ACK) with the RTT. The average value is 111 milliseconds; when compared to fog computing, this is remarkable and beneficial for implementing this technology in low response time IoT solutions. It is important to determine that one of the factors that increase the response time when transporting data to cloud computing is the delay in processing in the node. Although the processing delay in the node is the processing of the information, it should not be forgotten that there are also executions in the control plane and data from the routers through which the information flows. The core routers must decide and route the data in the best way so that in 32 hops plus the processing of each node is decisive to increase the response time.
4. Discussion
Fog computing is not a technology that will replace cloud computing; rather, it is an extension of cloud computing so that the two can work together and reduce response times by locally processing critical information that requires early action. Processing closer to the sensor layer in IoT has the consequence of reducing response times and, above all, not unnecessarily saturating the network link to cloud computing since only the information that needs to be analyzed more thoroughly is sent [
39,
40]. It is evident that ITS cities are making efforts to automate traffic lights at their intersections to reduce vehicular traffic in urban areas; however, there are still no concrete solutions for vehicles, such as ambulances, firefighters, and police, to reduce their response time in an emergency [
41]. In the data collection from cities with ITS, only the city of Pittsburgh performs processing locally at signalized traffic intersections; however, it only meets certain requirements to be classified as a fog computing technology. Many of the IoT applications being deployed in smart cities do not yet have the fog computing infrastructure and low power wide area networks, which are now imperative in an IoT architecture [
42].
The results obtained in the response times of fog computing and cloud computing are an approximation since it is carried out in a prototype and mainly also because the nodes only process a specific application when a fog computing node can process different IoT application requests [
43]. RSUs are very important in a vehicular IoT application to collect data from the sensors that are equipped on the vehicles to fulfill the various requirements of an IoT application. For best results, it is recommended to test in a different simulation environment where you can experiment with the vehicles and install the computer nodes in the fog at intersections, locations, and several kilometers away [
44].
For this type of IoT application in ITS, it is important to consider whether it is necessary to implement machine learning in the fog computing nodes so that they can learn the best path based on real-time static traffic data that can be collected and analyzed through big data tools [
45,
46]. It is recommended that the fog computing nodes that oversee sending the information through the network backbone to cloud computing do so through cellular telephony with the new proprietary LPWAN technologies called LTE M or NB-IoT. To send information to cloud computing, it is necessary to consider the use of IoT protocols in the application layer, such as MQTT or CoAP, to further improve response times to actuators [
47].
Time in milliseconds (msec) is a critical measurement in an IoT application in fog computing for emergency response system development. This is because, in an emergency, every second counts, and the speed of response can be the difference between life and death. In the IoT application in fog computing, IoT sensors send data to fog servers in real time. This data is quickly processed to detect an emergency and send an alert to the emergency services. Processing time is critical in this process, as the alert must be sent as soon as possible to maximize the chance of success in responding to the emergency. In addition, the data transmission time is also important in an IoT application in fog computing for the development of a system that responds to emergencies [
48,
49]. Data must be transmitted quickly and reliably from IoT sensors to fog servers to ensure a timely emergency response. Therefore, the time in milliseconds is essential to ensure a fast and effective response to emergencies in an IoT application in fog computing. Reducing data processing and transmission time can significantly improve system efficiency and increase the chance of success in emergency response. Time optimization can also help minimize downtime and ensure continuous system availability in critical situations.
5. Conclusions
Based on the results obtained from the prototype of the IoT system in fog computing as an emergency response system, it is mentioned that the use of fog computing techniques allows the processing of large amounts of data in real time, which allows a faster and more efficient response to emergencies. In addition, the use of geographically distributed fog nodes allows greater availability and redundancy of the system, which improves the response capacity in case of failure in one or more nodes. As a distributed computing model, fog computing has many advantages. By bringing data processing and storage closer to the edge of the network, fog computing reduces the latency and bandwidth required to transfer large amounts of data across the centralized network, which can significantly improve the performance, reliability, and efficiency of applications in real time. Additionally, fog computing offers greater flexibility and scalability compared to centralized cloud models. By distributing computing and storage resources over a larger network, fog computing can better accommodate the specific requirements of different applications and users and provide greater resilience and redundancy in the event of failures or outages. However, there are also challenges associated with fog computing, such as security, data management, and interoperability. By distributing computing and storage resources over a larger network, you also create a larger attack area for cyber-attacks, requiring additional security measures. Additionally, distributed data processing and management can be more complex than in a centralized model, and interoperability between different devices and platforms can be challenging.
Fog computing has several advantages that enhance the proposal, such as latency reduction. By bringing computing and storage resources closer to the edge of the network, fog computing reduces latency, improving the performance and efficiency of applications in real time. Improved bandwidth by processing and storing data at the edge of the network, fog computing reduces the need to transfer large amounts of data across the centralized network, which can improve bandwidth and reduce associated costs with network traffic. Generating greater scalability and flexibility by distributing computing and storage resources over a larger network, fog computing can better adapt to the specific requirements of different applications and users and provide greater resilience and redundancy in the event of failures or interruptions. Reduced infrastructure costs by leveraging existing resources at network edge devices, fog computing can reduce the infrastructure costs needed to support applications and services. Fog computing can significantly improve the performance and efficiency of real-time applications, reduce costs associated with network traffic, and improve the scalability and flexibility of computing and storage infrastructure.
The proposed system is a great contribution by allowing the collection and processing of data in real time, which facilitates fast and efficient decision-making. By using an IoT sensor network to monitor an emergency, the collected information can be sent to a nearby fog server for processing and analysis. This allows data to be processed and analyzed in real time, allowing for faster emergency response. In addition, future work proposes the integration of artificial intelligence and machine learning techniques in data processing that allow the system to identify patterns and anomalies in the information collected, which allows emergencies to be detected early and act the measures necessary to respond effectively.