ProSe Direct Discovery: Experimental Characterization and Context-Aware Heuristic Approach to Extend Public Safety Networks Lifetime

Device-to-device communication, as provided by the third generation partnership project standardization, can play a vital role in designing a reliable pervasive public safety network, which allows the user equipment (UEs) to communicate directly with each other in emergency situations. In this paper, we analyze the performance of direct discovery, one of the features introduced by proximity services. This is examined in heterogeneous environments using the OpenAirInterface open-source software and USRP hardware platform. The experimental results highlight the suitable values for different gains and frequencies of the UEs for performing reliable baseline direct discovery in out-of-coverage scenarios. We evaluate the performance of direct discovery in terms of reliability and maximum range in outdoor and indoor scenarios. Furthermore, we propose a context-aware energy-efficient heuristic algorithm for direct discovery with the aim of extending the network lifetime in emergency scenarios. This heuristic yields significant improvements in UE lifetime (20-52%) and reduces redundant transmissions of discovery messages compared to the baseline approach.


I. INTRODUCTION
Predictable emergency scenarios (e.g. floods, hurricanes) are typically less challenging than unpredictable emergency scenarios (e.g. earthquakes, terrorist attacks). In the former, the first responders can foresee and get enough time to prepare for estimated incidents and take proper actions to provide quick relief. In contrast, unpredictable emergency scenarios are unexpected incidents, and therefore, the first responders do not have enough time for disaster prevention. In such a situation the main goal is to provide rescue services as rapidly The associate editor coordinating the review of this manuscript and approving it for publication was Jinming Wen. as possible and reduce the response time. A major challenge is that response time cannot be improved without having basic information about the affected area [1].
In unpredictable emergency scenarios, the availability of the cellular base stations (BS) cannot be guaranteed and is often unavailable due to disasters; thus, people are not able to communicate with the outside of the disaster zone. Consequently, the first responders remain unable to take immediate actions to provide relief, even after many hours, due to unclear information such as the number of affected people, their locations and identity, etc. Consequently, the response time may become very long [2], [3]. The main challenges in such emergency scenarios are (i) to establish connectivity in the VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ absence of a BS and (ii) share important information with the first responders [1], and second to maintain the network connectivity alive for several hours. Device-to-device (D2D) communication supports both commercial and public safety (PS) scenarios. The application of public safety is considered one of the most essential applications of D2D communication. In emergency scenarios, D2D can provide connectivity between remote user equipments (UEs) to allow their direct communication when the BSs are destroyed, non-functional, or unavailable due to disasters. The third generation partnership project (3GPP) proposed proximity services (ProSe), initially in Releases 12 and 13, to enable D2D communication (including public safety scenarios). A new interface, known as sidelink PC5, was introduced [4]. Later in Releases 14 and 15 additional enhancements were proposed, primarily for vehicle-to-everything (V2X) communication [5], while Release 16 proposed new radio sidelink enhancements such as increased physical resources, feedback channel, etc. A more detailed description of the evolution of D2D communication is provided in Section II.
For D2D communication using sidelink PC5 interface, mainly there are three steps, i.e., synchronization, direct discovery, and direct communication. In unpredictable emergency scenarios, the most critical information is about the number of users (e.g., trapped persons), their IDs, and locations. To conserve the energy of the devices and consequently to prolong the network connectivity, we propose to confine the three steps to only synchronization and discovery by accommodating the light-weighted application payload in the discovery message.
Aiming at such an optimization, in this paper we focus on ProSe-based direct discovery. In particular: i) we carry out an empirical measurement campaign to characterize ProSe direct discovery in different out-of-coverage scenarios, and ii) we propose a context-aware novel heuristic algorithm to improve the lifetime of UEs in the network to share critical information with the first responders in emergency scenarios to speed up the rescue process.

A. RELATED WORK
Existing studies mainly focus on D2D sidelink communication in in-coverage scenarios to reduce the network burden, improve the spectrum efficiency, and energy efficiency [6]- [10], as well as improve cellular coverage through multihop D2D communication [11], [12]. These studies propose different schemes for joint scheduling and resource allocation [6]- [8], interference-aware resource allocation [9], and distributed power control [10] for D2D sidelink communication.
However, there is only a relatively low number of studies on D2D sidelink discovery in the literature. Existing studies propose different schemes for D2D discovery, like locationbased D2D discovery with the help of BS [13], [14], coordinated relay discovery approach [15], neighbor discovery scheme through demodulation reference signals (DMRS) based on a power normalized correlation process [16], [17], discovery retransmission scheme with different discovery periods to discover more devices in proximity, improve discovery accuracy and energy efficiency [18]. In [19], the authors present the evaluation of network-assisted D2D discovery, in terms of number of discovered devices, through a mathematical analysis using stochastic geometry model in indoor and outdoor environments. It is concluded that the discovery performance can be improved by reducing the inband emission.
However, the above-mentioned schemes are not suitable for unpredictable emergency scenarios because the solutions proposed in [13]- [15] are only network-assisted. In contrast to the discovery protocol proposed by 3GPP, it is not followed by these schemes [16], [17], and the method suggested in [18] is not an energy-saving solution, contrary to what is desired in PS out-of-coverage scenarios.
In addition to the above research efforts, developments related to long-term evolution (LTE) sidelink for PS communications around the world include e.g. Device-to-Device System for Public Safety (DDPS) in the United States [20], Project 1B (Basic UE functionality) in France [21], Experimenting with Flexible D2D communications over LTE (FLEX-D) in Greece [22], and COmmUNication in conTExt Related to Terror Attacks (COUNTER-TERROR) in Estonia [23], [24]. More details and many other completed or ongoing projects related to PS communication can be found in [1]. However, most of the available information is about their use-cases and does not give full descriptions of their implementations. Furthermore, the performance evaluation of the direct discovery in heterogeneous out-of-coverage scenarios is still missing in the literature.
The operation of PS communication is typically in the sub-1 GHz band [25] and existing studies lack in understanding the D2D communication at such frequencies e.g., realistic communication ranges under various conditions, packet losses, and baseline network lifetime. This work addresses these gaps by analyzing experimentally the connectivity behavior and then proposing a new energy conservation strategy for UEs to enhance their lifetime and prolong network connectivity.

B. CONTRIBUTION
The main contributions presented in this paper are: • Experimental measurements carried out to characterize the ProSe direct discovery using the open-source software OpenAirInterface (OAI) and software-defined radio-based hardware platforms (USRPs). New experimental results are obtained in order to evaluate the baseline performance in terms of various operating frequencies (between 697 and 897 MHz), reliability of successful discovery message reception, and maximum discovery range in three different scenarios: i) indoor line-of-sight (LoS), ii) indoor non line-of-sight (NLoS), and iii) outdoor (LoS). • In emergency scenarios, we suggest to include the coordinates of a UE in the discovery message, but periodic discovery messages, carrying redundant information (e.g., same location, ID, etc.), will lead to energy wastage. In order to improve the baseline lifetime and maintain reliable up-to-date information transfer via direct discovery, a new heuristic algorithm is proposed to avoid redundant transmissions of discovery messages by keeping track of the change of actual information (e.g. location) and context awareness. This algorithm significantly enhances (20-52%) the UEs' lifetime compared to the baseline direct discovery approach without compromising the transmission of critical information. To the best of our knowledge, this is the first empirical study that presents experimental results concerning the performance of ProSe direct discovery as a function of the operating frequency, transmitter (Tx) and receiver (Rx) gains, the distance between transmitter and receiver in different outof-coverage scenarios. In addition, our proposed heuristic approach improves the network lifetime and provides more up-to-date information in a heterogeneous emergency environment.

C. ORGANIZATION OF THE PAPER
The remainder of this paper is organized as follows. A detailed evolution of D2D communication is provided in Sect. II. In Sect. III, we discuss the methodology to characterize ProSe direct discovery: in Sect. III-A, we discuss our experimental setup to perform empirical measurements. Different indoor and outdoor scenarios are discussed in Sect. III-B to carry out the measurement campaign. The empirical measurement results are presented in Sect. III-C to analyze the performance of ProSe direct discovery in different scenarios. Next, in Sect. IV, we propose a contextaware energy-efficient approach for sidelink direct discovery in emergency scenarios. The description of the proposed approach is given in Sect. IV-A, and its performance evaluation is presented in Sect. IV-B. Concluding remarks are given in Sect. V.

II. PROXIMITY SERVICES AND EVOLUTION OF 3GPP RELEASES SUPPORTING D2D COMMUNICATION
In some contexts, pervasive public safety networks (PSN) can play a significant role to save lives and infrastructure. However, from the information and communication technology point of view, classical PSNs are not designed to deal effectively with first responders during emergency scenarios when BSs may not be available. Indeed, current communication systems like land mobile radio systems (LMRS) [26], M-Urgency, SafeCity [27], [28], and social media websites like Twitter and Facebook are facilitating [29] affected people to share information and live video streaming during disaster situations. However, a proper network infrastructure is required for them to operate.
In order to standardize PSN on cellular networks, the 3GPP standardization provides D2D communication that can be a key enable feature to design reliable PSNs. D2D communication allows UEs to communicate directly with each other using a new transmission link known as sidelink PC5 interface [4]. D2D communication can operate in three different scenarios: in-coverage, partial coverage, and out-of-coverage. In the in-coverage scenarios, UEs are inside the radio coverage of a BS and they are assisted by that BS to perform D2D communication. The BS assigns the resources and shares the synchronization signals with the UEs. Network-assisted D2D communication decreases the interference and improves the quality of service (QoS), but increases the burden on the BS. In a partial coverage scenario, an out-of-coverage or remote UE is assisted by another UE within the radio coverage of a BS to perform D2D communication. Finally, in an out-ofcoverage scenario, UEs are outside the radio coverage of a VOLUME 9, 2021  BS. Remote UEs use pre-configured parameters to perform D2D communication [30].
The evolution of D2D communication in 3GPP is shown in Fig. 1. In cellular networks, the concept of D2D communication was initially introduced in Release-12 of the 3GPP LTE standardization, referred to as ProSe [4]. Only ProSe-enabled UEs can support the ProSe functionalities. ProSe provides two main functions using the sidelink interface: ProSe discovery and direct communication. ProSe discovery is a process that identifies services and detects other UEs in their proximity. Direct communication allows a UE to transmit data to another UE located in proximity. Although Release 12 enabled out-of-coverage UEs to directly communicate with each other, it is required to access the BS if it is available. Release 13 enhanced ProSe services and introduced UE-to-network reply in the ProSe. This allows out-ofcoverage UEs to access the BS using the sidelink interface with another in-coverage UE located in its proximity [31].
Starting from Release 14, the 3GPP platform further evolved for the automotive industry to support the basic road safety services, and such type of D2D communication is referred to as LTE-based V2X services. Vehicles based UEs share cooperative awareness messages (CAM) and decentralized environmental notification messages (DENM) to exchange their information (such as speed, position, and heading) with other neighboring vehicles, pedestrians, and roadside units (RSUs) using the downlink, uplink, and sidelink interfaces [32]. Release 15 further expanded the LTE V2X services and enhanced sidelink communication by including new features such as sidelink carrier aggregation (CA), transmission diversity, and 64 quadrature amplitude modulation (QAM) to improve throughput and latency [33], [34].  In Releases 12-15, the D2D communications are based on the LTE network. Then Release 16 introduced the new radio (NR) sidelink to fulfill the requirements of the fifthgeneration (5G) mobile network. Release 16 has defined the NR sidelink transmission and added new use cases for NR V2X services. The use cases are advanced driving, vehicle platooning, exchange of extended sensor information, and remote driving [35]- [37].
Release 17 is expected to provide several key features in V2X communication, e.g. coverage enhancements, powersaving and reliability improvements, and a new use case for ProSe services, i.e. UE-to-UE relay [38].

III. EXPERIMENTAL CHARACTERIZATION OF ProSe DIRECT DISCOVERY
ProSe supports two types of discovery mechanisms for public safety use: partially network-assisted discovery and direct discovery. We consider the decentralized case when the BS is not available and we focus on direct discovery. Direct discovery can identify and detect the other ProSe-enabled public safety UEs located in proximity. Two models are introduced for public safety direct discovery [31]: Model A (''I am here'') and Model B (''Who is there?''). Model A uses only a single protocol message for discovery, i.e. a ProSeenabled public safety UE periodically transmits the discovery messages and the second ProSe-enabled public safety UE monitors the discovery messages, as shown in Fig. 2. On the other hand, Model B uses two protocol messages, i.e. A ProSe-enabled discoverer UE periodically transmits the solicitation messages and a discoveree UE sends back a response message to discoverer UE, as shown in Fig. 3. The discovery and response messages contain information such as message type, discovery group ID, announcer info, monitoring UE info, ProSe UE ID, etc., as shown in Fig. 4. More details about discovery and response messages can be found in [39]. In this study, we consider direct discovery with model A for the measurements in order to evaluate the performance of direct discovery in heterogeneous environments. Further, we examine both Model A and Model B when adding the coordinates of a UE in the discovery message as part of our suggested approach for improving the network lifetime of a UE, which will help first responders to locate and trace the affected UE in emergency scenarios.

A. EXPERIMENTAL SETUP
The OAI open-source software and USRP hardware platform are used to perform the experiments and collect empirical data. In brief, the OAI Software Alliance (OSA) is a non-profit association that encourages the research and industrial contributors for open source software and hardware development for the core network (EPC), access network, and UEs of 3GPP cellular networks. The OSA is an initial work of Eurecom that creates OAI towards the development of 5G cellular stack on commercial-off-the-shelf (COTS) hardware.
Our OAI/USRP based testbed consists of the following equipment.
Each UE is composed of: • USRP B210 board used as the radio front-end hardware part of a UE. The main components of the USRP B210 are a Xilinx Spartan 6 XC6SLX150 FPGA, Analog Devices AD9361 RFIC direct-conversion transceiver, Cypress Semiconductor CYUSB3014 USB 3.0 interface, four connectors for the antennas (Rx and Tx, two channels each). The radio frequency (RF) part is based on the AD9361 chip, whose maximum output power is 8 dBm. After the AD9361, there is a PGA-102+ output amplifier (15.9 dB gain at 800 MHz), which makes that the maximum Tx power of the USRP B210 board can be up to 24 dBm. The available Tx gain and Rx gain are 89.8 dB and 76 dB, respectively and the maximum noise figure of the receiver is 8 dB max [40].
• Board Mounted GPSDO (TCXO) module that provides a high-accuracy 10 MHz reference. All UEs in the network use the same reference clock for synchronization.
• Two telescopic antennas to transmit and receive the signals (one-channel configuration on RF A).
• Mini PC used to run the software part of OAI. It runs the Linux Ubuntu operating system and the OAI protocol stack of 3GPP standard (Starting at LTE (Rel 8), including features from LTE-Advanced (Rel 10/11/12), LTE-Advanced-Pro (Rel 13/14), going on to 5G Rel (15/16)). Each mini PC is linked with one USRP to configure it as one OAI-based UE. The implemented D2D application for the direct discovery, based on sidelink protocol, runs on top of the 3GPP protocol stack.
For convenience, each UE (composed of the above elements) can be powered by a Sandberg 420-23 20000 mAh/74Wh power bank. A diagram of the architecture and components (except power bank) of the OAI-based UE are shown in Fig. 6; corresponding hardware photos are shown in Fig. 7.
The main steps for the D2D discovery are summarized in what follows. Before announcing the discovery message, the first step is to synchronize the UEs in order to acquire the necessary timing and frequency information for performing the successive steps, including message transmis- sion or reception. A synchronization reference (SyncRef) UE transmits the sidelink synchronization signals (SLSS) periodically each 40 ms. This synchronization process is performed by using the SLSS signals: the primary sidelink synchronization signal (PSSS), the secondary sidelink synchronization signal (SSSS), the DMRS signals, and the physical sidelink broadcast channel (PSBCH).
After synchronization, the UE starts to announce the discovery message periodically and the other UE(s) will monitor the discovery message to discover the announcing UE on the physical sidelink discovery channel (PSDCH) [39], as depicted in Fig. 5.
On the software side, an initial OAI prototype for LTE Sidelink publicly available from Eurecom 1 has been used 1 https://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/LTE-sidelink/  as a starting point. The initial setup was limited to two UEs in the network, transmitting one random discovery message. The UEs were connected with one OctoClock (CDA-2990) through SMA cables for synchronization. In our work, we expanded the setup to up to eight UEs in the network and installed a GPSDO (TCXO) module for synchronization on each UE in order to remove the OctoClock and be able to move the UEs easily. Other details about the initial setup are discussed in Section IV.

B. MEASUREMENT CAMPAIGN
In this work, all the experiments were performed at Tallinn University of Technology after obtaining the required permission (RF test license) for the measurement campaign. Up to eight OAI-based UEs are used in this measurement campaign.

C. EMPIRICAL MEASUREMENT RESULTS
This section presents the empirical measurement results to examine the direct discovery in the three different scenarios.
The main goal of this analysis is to provide recommended values for sidelink direct discovery in critical scenarios when the BS becomes non-functional. First, the impact of the carrier frequency and of the Tx and Rx gains on direct discovery have been investigated in the indoor NLoS scenario. After observing the performance of ProSe direct discovery in terms of discovery reliability, the maximum discovery range is examined in the three described scenarios.
For the empirical results, the 700 MHz and 800 MHz bands have been examined as the spectrum within the 694-894 MHz allocated for PS communication in Europe, North America, and in many other countries [25]. A total number of 600 discovery messages are transmitted by two UEs to evaluate the performance of direct discovery as a reference. The first UE periodically transmits a discovery message each 500 ms and the second UE monitors it. After transmitting eight messages in one cycle, the second UE starts transmitting, and then the first UE monitors the discovery messages. Again after transmitting eight messages in the next cycle, the first UE starts transmitting without changing any parameter, and so on. Overall, 300 discovery messages are transmitted by each UE and eight discovery messages are transmitted in each cycle as a reference. To evaluate the performance of direct discovery in terms of reliability, we calculated the following three key performance indicators (KPIs): average discovery ratio, maximum discovery ratio, and minimum discovery ratio.
The average discovery ratio, DR −mean , is defined as the total number of successful discovery messages received, N −received , by the monitoring UE over the total number of transmissions N −transmitted . (600 discovery messages are transmitted in total.) It is expressed as: The maximum discovery ratio, DR −max , shows the maximum of the total number of successful discovery messages received by the monitoring UE in any cycle, N −received per cycle . The total number of transmitted discovery messages in a cycle, N −transmitted per cycle , is set to eight discovery messages per cycle. It is expressed as: The minimum discovery ratio, DR −min , shows the minimum number of successful discovery messages received by the monitoring UE in any cycle. It is expressed as: The average discovery ratio is directly proportional to the reliability of the direct discovery. A 100% discovery ratio signifies the best transmission conditions for direct discovery; the reliability of direct discovery decreases with a decreasing average discovery ratio. On the other hand, the minimum and maximum discovery ratios are indicated by the vertical short lines in the figures, which show the minimum and maximum value at each point. The higher difference between the minimum and maximum values mean denser multi-path and consequently less reliable connection. In the next subsections, we discuss the impact of frequency, amplification, distance, and number of UEs on the discovery ratio.  Figure 11 shows the impact of the carrier frequency on direct discovery in an indoor NLoS scenario. It can be noticed that as the carrier frequency increases, the discovery ratio improves as well (see, for example, the curve associated with D = 8 m, Rx gain = 45 dB and Tx gain = 50 dB, shown as a magenta dotted line with '*' marker, in Fig. 11.

1) IMPACT ON THE DIRECT DISCOVERY DUE TO THE CARRIER FREQUENCY
For the carrier frequency of 697 MHz, the average discovery ratio is 46%, and the maximum and minimum discovery ratios are 100% and 0%, respectively. The 46% average discovery ratio value indicates that 46 discovery messages are received by the monitoring UE out of 100 transmitted messages. The 100% maximum and 0% minimum discovery ratios indicate that a monitoring UE could receive all the transmissions or it could also miss all the transmissions from the announcing UE. This shows very poor settings for the direct discovery.
Next, the average discovery ratio increases by increasing the carrier frequency and it reaches 100%. The carrier frequency of 897 MHz yields a 100% average discovery ratio and provides a very reliable and stable connection for direct discovery. It is also observed that carrier frequencies set in the spectrum from 857 to 897 MHz provide reliable connectivity for direct discovery in all the considered cases, even with low Rx and Tx gains.
These results can be explained looking at the specific characteristics of the selected NLoS propagation environment; nevertheless, the most interesting aspect revealed by the experimentation is that carrier frequency can have a remarkable impact on discovery performance even in the most favorable range of frequency carriers for mobile systems, i.e. below 1 GHz.
Note that the selected frequencies were not being used for the other purposes as also checked by a portable FSH4 spectrum analyzer. Furthermore, the spectrum from 790 to 820 MHz has not been evaluated because it is occupied by mobile operators in Tallinn, Estonia.

2) IMPACT ON THE DIRECT DISCOVERY DUE TO THE TX AND RX AMPLIFIER GAINS
As can be observed from Fig. 11, the Tx and Rx amplifier gains have an impact on the performance of direct discovery. In order to have a better understanding of this impact, Fig. 12 represents the effect of the Tx and Rx gains on the performance of direct discovery in the indoor scenario: here UEs are placed 6 m apart to announce discovery messages at 857 MHz. In fact, as can be seen in Fig. 11, carrier frequency from 857 MHz provides reliable connectivity for all the considered cases.
It can be observed that by increasing the Tx gain, the reliability of the direct discovery improves. When the Rx gain is set to 60 dB, shown as a black solid line with a square marker in Fig. 12, the average discovery ratio remains zero for Tx gains ranging from 0 to 40 dB. This shows that no discovery message is received by the monitoring UE. The average discovery ratio increases from 0 to 65% for Tx gains ranging from 40 to 55 dB. However, there is a large difference between the maximum and minimum discovery ratios that indicate poor connectivity. After that, the average discovery ratio increases very gradually from 93 to 100% for Tx gains ranging from 60 to 80 dB, and connectivity becomes stable and reliable for direct discovery. If instead of 60 dB, we set the Rx gain to 30 dB, even higher Tx gains do not provide a reliable discovery, as shown with a blue dotted line.
The effects of Tx Gains on ProSe discovery can be better understood from Table 1 (measured by means of a portable FSH4 spectrum analyzer, see Appendix and Fig. 27). As it is explained in Sect. III, the UEs have to synchronize using SLSS signals before transmitting the discovery messages. Otherwise, UEs will not able to discover each other. Therefore, output transmitted power and signal-to-noise ratio (SNR) values of both SLSS signals and PSDCH channel against Tx gains are presented in the table. An FSH4 spectrum analyzer is used to measure the output power and SNR values. It can be seen from the table that the output power of both SLSS and PSDCH remains approximately −92 dBm for Tx gains ranging from 0 to 34.75 dB. After that, the output power increases gradually from −89,8 to −42 dBm for Tx gains ranging from 39.75 to 89.75 dB.
On the other side, the SNR value remains less than 10 dB for the TX gains of less than 50 dB for both SLSS and PSDCH. Such low SNR values give very poor discovery ratios, as shown in Fig. 12, 46% average discovery ratio with 60 dB Rx gain and 0% with 30 dB Rx gain. The SNR improves significantly around 10 dB to 20 dB for Tx gains ranging from 49.75 to 59.75 dB. The discovery ratio also improves to 93% with 20 dB SNR. Then SNR improves gradually up to 23 with maximum Tx gain and the direct discovery becomes very reliable with a 100% discovery ratio. A similar behavior is observed when Tx has a fixed value. By increasing the Rx gain, the performance of direct discovery improves. For example, when the Tx gain is set to 60 dB, shown as a magenta dotted line with '*' marker in Fig. 12, the average discovery ratio is 93% when Rx gain is set to 55 dB. For Rx gain equal to or larger than 70 dB, the discovery ratio reaches 100% and provides a very stable and reliable direct discovery. Whereas, when the Tx gain is set to 30 dB, the discovery ratio remains 0% regardless of the Rx gain, shown as green dashed line.
It can be seen from Fig. 11 and Fig. 12 that the reliable connectivity for direct discovery also depends on the distance between announcing and monitoring UEs along with carrier frequency, and Tx and Rx gains. It can be also observed that the average discovery ratio is more than 90% when f = 857 MHz, Rx gain = 60 dB, Tx gain = 60 dB, and the average discovery ratio is around 50% when f = 707 MHz, Rx gain = 45 dB, Tx gain = 50 dB in most of the considered cases. Therefore, we used these moderate gains and carrier frequencies and we considered the following four cases to analyze maximum discovery range for direct discovery in three different scenarios: case 1 (f = 707 MHz, Rx gain = 60 dB, Tx gain = 60 dB), case 2 (f = 707 MHz, Rx gain = 45 dB, Tx gain = 50 dB), case 3 (f = 857 MHz, Rx gain = 60 dB, Tx gain = 60 dB), case 4 (f = 857 MHz, Rx gain = 45 dB, Tx gain = 50 dB). Figure 13 shows the impact of the distance between announcing and monitoring UEs on the direct discovery in the indoor NLoS scenario. The case, referred to as case 3, that provides the best connectivity and maximum distance for the direct discovery as compared to the other three cases is with both Rx and Tx gains set to 60 dB and the carrier frequency set to 857 MHz (f = 857 MHz, Rx gain = 60 dB, Tx gain = 60 dB), shown as a magenta dotted line with '*' marker in Fig 13. It can be seen that the average discovery ratio remains 100% when the distance is up to 4 m between two UEs. The discovery ratio decreases gradually to 84% with increasing distance up to 7 m regardless of the first concrete wall at 6 m (Fig 8).

3) DISCOVERY RATIO AS A FUNCTION OF A DISTANCE BETWEEN TWO UEs IN THE INDOOR-NLoS
It is also interesting to observe the behavior with the case 1 (f = 707 MHz, Rx gain = Tx gain = 60 dB) and case 4 (f = 857 MHz, Rx gain = 45 dB, Tx gain = 50 dB) after the first concrete wall (i.e. after 6 m). The average discovery ratio decreases swiftly, and reaches 0% after the radio signal meets an obstacle (a heavy machine) at 10 meters. Whereas the average discovery ratio decreases gradually regardless of the obstacles until 10 meters in case 3, but it decreases swiftly after the second concrete wall and becomes zero at 11 meters.
Finally, for case 2 with low gains and carrier frequency (f = 707 MHz, Rx gain = 45 dB, Tx gain = 50 dB), the average discovery ratio reaches 0% at 6 meters, as shown with the blue dashed line in the Fig. 13. Figure 14 shows the impact of the distance between two UEs on the direct discovery in the indoor LoS scenario. Case 3 (f = 857 MHz, Rx gain = 60 dB, Rx gain = 60 dB) shown as a magenta dashed line in Fig. 14 provides the best connectivity and maximum range for direct discovery with the highest discovery ratio. It can be observed that the average discovery ratio remains 100% when the distance is up to 9 meters between two UEs. The discovery ratio decreases gradually and reaches 0% at 36 meters. A similar trend can be seen in case 4 (f = 857 MHz, Rx gain = 45 dB, Tx gain = 50 dB) and case 1 (f = 707 MHz, Rx gain = 60 dB, Tx gain = 60 dB), where the average discovery ratio remains 100% until 6 meters in both cases, and the maximum discovery range is 24 and 27 meters respectively. On the other hand, in Case 2, the UEs could not discover each other after only 9 m with low gains and carrier frequency (f = 707 MHz, Rx gain = 45 dB,   Figure 15 shows the measurements for the outdoor scenario. A similar behavior can be observed in Fig. 15 as compared to the indoor LoS (Fig. 14). Once again, Case 3 (f = 857 MHz, Rx gain = 60 dB, Rx gain = 60 dB) provides the highest discovery ratio, reliable connectivity, and maximum distance for direct discovery as compared to the other three cases. It can be observed that the average discovery ratio remains 100% when the distance is up to 20 meters between two UEs, and it decreases gradually and reaches 0% when the distance is 70 meters. However, the maximum discovery ranges are 35 and 45 meters in case 4 (f = 857 MHz, Rx gain = 45 dB, Tx gain = 50 dB) and case 1 (f = 707 MHz, Rx gain = 60 dB, Tx gain = 60 dB) respectively. On the other hand, in Case 2 (f = 707 MHz, Rx gain = 45 dB, Rx gain = 50 dB), the UEs configured with low gains and frequency could not discover each other after 15 meters.

6) THE IMPACT ON THE DIRECT DISCOVERY IN ALL THREE SCENARIOS
It can be confirmed that case 3 with maximum amplification and frequency (f = 857 MHz, Rx gain = 60 dB, Rx gain = 60 dB) provides the best connectivity and maximum range for a reliable direct discovery as compared to the other three cases. The impact on the direct discovery due to the distance between two UEs in all three scenarios is shown in Fig. 16.
It is important to appreciate the performance gap between the three significant propagation scenarios, which can be measured numerically by the different slopes of the curves as a function of the distance.

7) DISCOVERY RATIO AS A FUNCTION OF THE NUMBER OF UEs
Finally, Fig. 17 shows the impact on the number of UEs in a group on the performance of direct discovery in the indoor-NLoS scenario, where D = 5 m, f = 857 MHz, Rx gain = 60 dB, Rx gain = 60 dB. It can be seen that the discovery ratio decreases gradually when increasing the number of UEs in the network. Our OAI-based direct discovery can support up to 5 UEs in a group with up to 90% discovery ratio. After adding the sixth UE in the group, the average discovery ratio decreases swiftly (down to 60%). It can be seen that a maximum of 7 UEs can be discovered in one group but with a low average discovery ratio of only 20%. According to the 3GPP system, sidelink communication shall be able to support up to 5 UEs in a group, and NR sidelink communication shall be able to support up to 19 UEs in a group [41].
In this section, the performance of direct discovery has been evaluated in terms of discovery reliability and maximum range of discovery in three different environments. In the next section, we propose an algorithm for direct discovery to improve the lifetime of UEs and of the network in critical situations.

IV. CONTEXT-AWARE ENERGY-EFFICIENT PROPOSED HEURISTIC APPROACH FOR SIDELINK DIRECT DISCOVERY IN EMERGENCY SCENARIOS
In a decentralized case when the BS is not available, a ProSe-enabled UE transmits the discovery messages with a fixed period. Periodicity could be up to 10 seconds [42]. A UE keeps transmitting discovery messages although it has already been discovered by the neighboring UEs, first responder, or UE does not have new information to transmit. For instance, when a discovery message has been received by the first responder and the UE is not changing its position then there is no need to re-transmit the discovery message. However, if a UE transmits redundantly it will consume more energy, and eventually, it will die out swiftly in the network. As a dead node, a UE could increase the delay to obtain the rescue services. In a critical situation, it is very important to stop redundant transmissions of discovery messages in order to keep the UE alive in the network for a longer time and increase the probability to get relief from the first responders.

A. DESCRIPTION OF THE PROPOSED APPROACH
In this paper, we propose a self-aware D2D discovery approach based on the current position and battery level of a UE in emergency scenarios (Algorithm 1). The suggested approach aims to improve significantly the lifetime of UEs by decreasing their number of redundant discovery messages transmissions. Our proposed approach has two main phases. The first phase defines the periodicity for discovery transmissions; there are two stages in each periodicity: transmission stage and idle stage. In the transmission stage, a UE can transmit N (up to eight) discovery messages in a time t TX , and in the idle stage, a UE remains idle for a time t IDL . The second phase determines either to transmit the optimal number of discovery messages in the transmission stage, or to remain idle for time t TX . The steps involved in the proposed approach are shown in Fig. 18.

1) FIRST PHASE OF THE PROPOSED APPROACH
The first phase defines the periodicity for discovery transmissions according to the current battery level of a UE. Therefore, we consider battery capacity of a UE in our application for simulation purposes. Modern smartphones have 15.04 Wh battery capacity (i.e. 3957.9 mAh at 3.8 V) on average [43]. As a reference, we consider one half of this capacity, i.e. 7.52 Wh or 27072 Ws, as the total battery capacity of a single UE in our application. Further, we divide the battery capacity into seven levels, denoted from one to seven, to indicate the status of the battery. The one to seven battery levels indicate VOLUME 9, 2021  when the remaining battery is between 100-97%, 96-88%, 87-75%, 74-50%, 49-25 24-10%, and 9-0%, respectively. Each battery level has a different but fixed periodicity to transmit the discovery messages. In this work, time t TX for the transmission stage remains fixed for all battery levels (1 s). Time t IDL for the idle stage increases with decreasing battery values over time, as shown in Fig. 18. We assign different periods for the idle stage i.e. t IDL = 2 s, 3 s, 9 s, 29 s, 59 s, and 299 s for battery levels one to six, respectively. In the last battery level (less than 10%), a UE will remain idle and can transmit up to eight messages before dying.
This heuristic approach saves a substantial amount of energy consumption by reducing the redundant transmissions of discovery messages. A UE in a decentralized case consumes energy in both idle and transmission stages. In this work, we also provide energy consumption values of a UE in both stages using the keysight N6705C power analyzer. Our main objective was to measure the energy consumption by a  UE in the transmission and idle stages. Therefore, the power consumed by the USRP board and Mini PCs is considered as the baseline power (2.86 W), as shown in Fig. 19. A UE consumes 0.7 W (3.56−2.86) for one second in the idle stage as shown in Fig. 20. A discovery transmission consumes an additional 0.1 W (3.66 -3.56), as shown in Fig. 21. A UE consumes 0.8 W if it transmits a single discovery message in one second. The energy comparison is shown in Fig. 22 when a UE transmits up to eight discovery messages or remains idle for one second.

2) SECOND PHASE OF THE PROPOSED APPROACH
The second phase has two further steps to determine the optimal number of discovery messages for the transmission stage. In the first step, a UE will take a decision based on its mobility, i.e. either it will transmit for time t TX or remain idle. Once an announcing or affected UE in emergency situations is already discovered by the first responders and this UE does not change its position, there is no need to keep transmitting the discovery messages because the first responder already Transmit a discovery message in time t TX TX_counter + = 1 end else UE Transmits N no. of discovery messages for time t TX TX_counter + = N end else UE will remain idle for time t TX ; end UE remains idle for t IDL ← t IDL = {t IDL 1, t IDL 2, . . . , t IDL Z} & (t IDL 1 < t IDL 2, .., < t IDL Z ) } NW_lifetime + = t TX + t IDL end end received the updated information. However, whenever a UE changes its position it is important to transmit the discovery messages. This will benefit the first responder to keep track of the updated information and to keep tracking the affected UE. Given that a UE can move continuously, we set a threshold on the position change equal to 5 m based on our application requirements. Thus, a UE can only transmit the discovery messages in the transmission stage when a change in the position of a UE is more than 5 m. A GPSDO module is used to get the coordinates of a UE in real-time. A distance covered by a UE is calculated from the haversine formula using the current coordinates (point A) and the coordinates of a UE at the previous transmission (point B), as explained in the proposed algorithm (Algorithm 1), where φ 1 , φ 2 are the latitude of point A and latitude of point B, respectively and λ 1 , λ 2 are the longitude of point A and longitude of point B, respectively. All the angles are in radians and R is the radius of earth in meters. If an affected UE initiates the discovery transmission, for the first time, it will not follow this step and directly goes to the second step of the second phase.
The second and last step of the second phase is to determine the optimal number of re-transmission of discovery messages in the transmission stage. A UE can re-transmit up to eight discovery messages per second in the transmission stage. It was observed after the measurement campaign in different scenarios that the reliability of network connectivity depends on the channel conditions and distance between two UEs. It is further shown in Sect. IV-B that when the channel condition is good, a monitoring UE or the first responder can discover the announcing or affected UE with a single transmission. On the other hand, in poor channel conditions, an affected UE has to re-transmit multiple discovery messages to be discovered. Therefore, we add a response message in our proposed approach (see Sect. III), so that an affected UE will keep re-transmitting the discovery messages until it receives a response message from the first responder. Our proposed heuristic approach provides a reliable D2D discovery and significantly improves the UE lifetime in a critical scenario.

B. PERFORMANCE EVALUATION OF THE PROPOSED APPROACH
After evaluating the performance of direct discovery in terms of reliability and maximum range of direct discovery in heterogeneous environments (see Section III-A), we proposed the above-described heuristic approach to improve the UE lifetime in a network by stopping the redundant discovery transmissions and to provide a reliable direct discovery in critical situations. When a BS is unavailable, a UE will redundantly transmit discovery messages with a fixed period even although it is discovered by the rescue services and not changing its position. Normally, the periodicity could be up to 10 seconds [42]. As a baseline, we consider different periodicity periods (P) for discovery transmission, i.e. P = 125 ms, 160 ms, 250 ms, 500 ms, in other words, a UE transmits 8, 6, 4, 2 messages-per-second (MPS), respectively. With the proposed approach, a UE considers two factors before performing discovery transmission: the current battery level of a UE and the distance covered by a UE. The current battery level of a UE defines the periodicity period for discovery transmission, whereas the distance covered by a UE determines to either transmit the optimal number of discovery messages in the transmission stage or remain idle, as fully explained in Section IV-A.
It can be seen from Fig. 23 that the proposed approach significantly improves the UE lifetime in the network compared to baseline discovery transmissions. A UE lifetime has been prolonged by 128, 219, and 329 minutes when compared to fixed periodicity periods for discovery transmission where P = 2, 4, and 8 MPS, respectively. The proposed approach also stops the redundant transmissions and only transmits 1.72%, 1.05%, and 0.72% of discovery messages compared to fixed periodicity periods where P = 2, 4, and 8 MPS, respectively. A 100% fully charged battery is considered for this result. However, on-scene available devices have different charging levels in real-life scenarios. Therefore, in what follows, we consider 30 UEs with different charging  levels to analyze the average network lifetime, as shown in Fig. 24. A similar behavior is observed in network lifetime and number of transmissions of discovery messages. Our proposed approach outperforms baseline transmission for direct discovery thanks to the self-awareness strategy of a UE, based on its current battery level indication and context-awareness, before transmitting the discovery message. For the results shown in Figs. 23 and 24, we consider a very good channel condition with a 100% reliable connection; therefore, a UE transmits a single discovery message in the transmission stage to be discovered.
However, it is not feasible to always have a 100% reliable connection in critical situations. This depends on the channel conditions between the announcer and the monitoring devices. As it has been observed from the experimental results, a reliable direct discovery depends on the operating frequency, RX and TX gains, distance between transmitter and receiver, and different environments. Fig. 25 shows a very revealing result where we use the number of messages transmitted in Fig. 23 and average discovery ratio in the indoor-NLoS scenario to show the comparison between transmitted versus received number of discovery messages. It can  be seen that all the transmitted messages are received when the distance is up to 4 m between two devices and a 100% reliable direct discovery is achieved. The number of received messages or discovery ratio decreases with increasing the distance. It is important to note that when the discovery ratio is low, there is a higher probability that a monitoring device can receive a discovery message with more re-transmissions. However, the challenge is ''what could be an optimal number for re-transmitting the discovery messages in the transmission stage?''. Thus, our proposed approach suggests that an announcing device should keep transmitting the discovery messages until a response message is not received from the monitoring device. This approach provides a highly reliable direct discovery and improves the UE lifetime in heterogeneous environments, as shown in Fig. 26. A UE lifetime is just 4 minutes shorter as compared to a fixed single transmission in the transmission stage. Our proposed approach outperforms all fixed numbers of discovery re-transmissions in the transmission stage except a single transmission. However, a fixed number of discovery re-transmission is not a reliable solution in critical and heterogeneous environments, as discussed before.

V. CONCLUSION AND FUTURE WORK
To our best knowledge, we have presented the first experimental study in the open literature with results characterizing ProSe public safety direct discovery in heterogeneous environments. The OAI open-source software and USRP hardware platform are used to perform the experimental activity to evaluate the performance of ProSe public safety direct discovery in terms of discovery ratio, reliability, and maximum range of direct discovery in three different scenarios. The experimental results give suggestions on suitable gains and frequencies that are required for a reliable direct discovery. Furthermore, the coverage analysis can help the first responders to deploy the unmanned aerial vehicles and/or command center to cover the affected area for reliable communication and reveal the importance of these factors even at frequencies below 1 GHz. Furthermore, our context-aware energy-efficient heuristic approach could improve the UE lifetime and provide more reliable up-to-date information to first responders to reduce the time response in emergency scenarios. In future, we aim to investigate other parameters such as mobility, air-to-ground and air-to-air channels, interference, and discovery time to fully characterize the ProSe direct discovery in emergency scenarios. Researcher and then on a professorship of cognitive electronics. He has supervised ten Ph.D. theses and more than 50 M.Sc. theses. He was a Co-PI for the H2020 COEL ERA-Chair Project. His research interests include HW/SW co-design, embedded systems, reconfigurable systems, and the IoT.
LUCA REGGIANI received the Ph.D. degree in electronics and communications engineering from the Politecnico di Milano, Italy, in 2001. He has collaborated with several industries and universities in the field of wireless communications and magnetic recording, as a Consultant or within Italian and European research programs. He is the author of more than 80 papers in international conferences, journals, and patents. His research interests include cellular systems, wireless sensor networks, high-capacity point-to-point links, and information theory.
DAVIDE SCAZZOLI was born in Italy, in 1989. He received the M.Sc. degree in telecommunications engineering from the Politecnico di Milano, in 2016, defending a thesis on the implementation of wireless sensor networks for avionic applications, where he is currently pursuing the Ph.D. degree in telecommunications engineering. His research interests include wireless sensor networks, redundancy management, and localization. August 2008 to January 2009, he spent a sabbatical leave at Bell Labs, Alcatel-Lucent, Holmdel, NJ, USA. His research interests include the broad area of communication and information theory. His research topics include synchronization, channel estimation, equalization, and coding applied to wireless and optical communication systems. His most recent research activities have focused on molecular communications, massive MIMO, study of waveforms for 5G cellular systems, wireless sensor networks for mission critical applications, and wireless networks using unmanned aerial vehicles and high-altitude platforms. He has authored and coauthored more than 100 journals and conference papers. In 1994, he was granted the TELECOM Italia Scholarship Award for his M.Sc. Thesis. He was a co-recipient of two best-paper awards. Since 2017, he has been an Associate Editor of IEEE ACCESS and Nano Communication Networks (Elsevier). In 2017, he also served as a Guest Editor for IEEE ACCESS Special Section on Networks of Unmanned Aerial Vehicles: Wireless Communications, Applications, Control and Modelling. He has been involved in several European and national research projects. University on a QNRF Grant. He is currently working as an Assistant Professor with the School of Electrical Engineering and Computer Science, National University of Sciences and Technology, Pakistan. His research interests include medium access control protocols, spectrum and energy efficiency, energy harvesting, and performance analysis for wireless communication and networks. He has published and served as a reviewer for IEEE journals and conferences. He also serves on the TPC of leading conferences in the communication and networking field, including IEEE VTC, IEEE ICC, and IEEE GLOBECOM. He was a recipient of the prestigious International Postgraduate Research Scholarship from Australian Government. VOLUME 9, 2021