Managing Wireless Communications for Emergency Situations in Urban Environments through Cyber-Physical Systems and 5G Technologies

: Currently, urban environments are the basic human habitat. infrastructures coordinate urban life and make it possible in high-density scenarios. In this context, one basic infrastructure to be considered is communication networks. Nowadays, even emergency response teams (ERT) are dependent on those deployments. However, emergencies may cause important damage in those communication infrastructures and, then, a critical discoordination among ERT might appear, greatly a ﬀ ecting the ERT e ﬃ ciency and response capacity. Di ﬀ erent architectures to address this situation have been recently proposed, but none of them are able to dynamically adapt to highly variable situations such as emergency crisis. Therefore, in this paper, a new approach is proposed for ad hoc emergency wireless communications in urban environments based on 5G technologies and Cyber-Physical Systems (CPS). The proposed architecture consists of three layers, where di ﬀ erent feedback control loops are deﬁned and linked following the CPS paradigm. At physical level, the spectrum usage is monitored through CPS control loops, analyzing if power signals present a good quality. At network level, 5G virtualization technologies are employed to manage in a dynamic way the network conﬁguration and user management. Finally, at service level, the global situation is analyzed to decide about what services from a catalogue, and according to their priority, can be deployed, including the amount of assigned resources. To evaluate the performance of the proposed solution, an experimental validation based on simulation techniques is also described.


Introduction
Urban environments and large cities are the most common living scenario for humans since the first industrial revolution [1]. Now, with Industry 4.0 revolution [2], this tendency has got even stronger, and mega-cities where millions of people live in super-populated spaces are born each year [3]. To make human life possible in those spaces, high-efficiency infrastructures coordinating individual behaviors and needs have been designed and developed, from transport infrastructures [4], to water management solutions [5] and urbanism [6]. In this context, communication networks are one of the most basic infrastructures to enable human life in urban environments [7]. Networks connecting thousands of people are essential for economy, social life, public administrations, etc. Even Emergency Response Teams (ERT) are totally dependent on those networks.
In the last years, a very interesting popular topic to be analyzed are rapidly deployable hardware networks based on drones. Although problems in those solutions are common to other rapidly deployable hardware networks, in this context, many different trajectory calculation mechanisms [36] and efficient service provision schemes [37] have been described. In fact, mobile nodes [38] are a key element to be considered in any future solution.
Finally, some sparse works are analyzing how to apply modern technological paradigms to emergency communications. Solutions based on Cyber-Physical Systems (where control loops are employed to manipulate mobile node trajectory) [39], and ad hoc wireless networks [40] have been reported. The main handicap of these innovative proposals is their limited analysis: it is not clear how end-to-end communications can be provided or how the network architecture and structure is deducted considering the characteristics of every emergency. In general, these paradigms are very useful, but a complete communication solution is required to guarantee the needs and requirements of ERT are met.

Wireless Communications in Emergency Situations
In this Section, the main technological proposal is described. The proposed solution includes a three-level architecture, where different mechanisms to manage the wireless network at physical, network and service level are deployed. Section 3.1 describes a global overview of the proposed solution. Section 3.2 describes the proposed control solution to ensure the maximum signal quality of all users given a service and a geographical area. In Section 3.3, we analyze the entire network resources and how they are distributed and managed for a given communication service. Finally, in Section 3.4, the entire catalogue of services in the network is managed at the highest level in the architecture. Figure 1 shows the proposed architecture. As can be seen, three different levels are considered: radio (or physical) level, network level and service level. In general, the proposed architecture follows the mobile network design principles, and presents a distributed structure.

Global Overview
The radio access network is distributed into two different layers: the access points at radio level and the mobile base stations at network level. The scheme follows the C-RAN (Cloud Radio Access Networks) architectures proposed for 5G technologies. In access networks (collection of access points), Network Virtual Functions (VNF) supporting different services are deployed, together with all physical capabilities required at radio level. These access points are deployed around the entire geographical area to be covered. They employ wireless communications and batteries to be totally independent. On the other hand, typically, in emergency situations, ad hoc base stations are deployed through medium-size mobile infrastructures, such as emergency cars, where a generic computing platform is included. These base stations are connected to the access point using any of the existing wireless technologies (we are not addressing this point in this article). In these base stations, the resource management of VNF and services is performed. Besides, all base stations are connected to a main coordination center, where global service management is located and acting as gateway to the global communication networks. This coordination center is, as well, deployed in large mobile infrastructures provided with general computation devices, however, in this case, tends to be placed in a fixed position, especially if satellite communications are employed.
At radio or physical level, we are using a Cyber-Physical System approach to define a feedback control loop integrating the physical and the computational processes affecting the communication services at the ratio links. To define these loops (one for each service and access point), we are considering three basic indicators: the Bit Error Rate (BER), the Signal over Interference and Noise Radio (SINR) and the available resources and congestion level at each moment. Using these state variables, we are controlling the power and bandwidth of signals at real time. As output, the access points generate a report about radio congestion which is processed by base stations (network level).  Figure 1 shows the proposed architecture. As can be seen, three different levels are considered: radio (or physical) level, network level and service level. In general, the proposed architecture follows the mobile network design principles, and presents a distributed structure.  At network level, an optimization problem is posed. The objective is to distribute among VNF composing a service (and deployed in the different access points), the assigned resources to that service by the main coordination center. This problem considers the number of users and the provided Quality-of-Service (QoS), as well as the mobility of base stations moving at speed v m/s. As communication services in our proposal are supported by virtualization technologies and 5G network slicing techniques, resources can be assigned to different VNF in a dynamic and variable way. As output, this optimization problem generates a report about the quality of the final resource distribution, so the main coordination center may learn about the global network situation.

Global Overview
Finally, at service level in the coordination center, all reports from the different services are collected. Then, using a priority algorithm, the coordination center decides if a new service may be deployed, some of them have to be cancelled or modified, etc., according to services described in a catalogue including their minimum requirements and priority. The objective of this algorithm is to guarantee the QoS of services with higher priority before deploying any service with a lower priority, and adapting the global situation to the current emergency evolution.

Physical Level: Power Signal Control
In the proposed architecture, radio and link levels are following the design principles for future 5G networks [41]. In particular, the frequency spectrum is organized using OFDMA (Orthogonal Frequency Multiple Access) and TDMA (Time Division Multiple Access) techniques. Then, each VNF (service instance) at each access point is provided with a set of time slots t i over a set of orthogonal frequencies f i . Radio resources are then represented by a set R (1) of ordered pairs t i , f j , where t i is the numerical order of the time slot, f j is the assigned orthogonal frequency, M T is the number of available time slots per orthogonal frequency, and M F the number of frequency channels. Different modulations could be employed, although in this paper we are considering the family 2 P -QAM (Quadrature Amplitude Modulation), P being a natural number, usually between four and seven.
On the other hand, each frame at link level is protected through a Convolutional Error Correction Code (CECC). Frames have a length of B bits, including a header of H bits, enabling receptors to detect up to d bits and correct up to c bits. Using this code, the Bit Error Rate (BER) of the connection between the access point and the user device (at this point we are focusing on a given service, no difference among emergency or supplementary services is done at physical layer) may be calculated after collecting W different frames. Then, in this context, BER turns into a discrete measurement with an associated (power) quantification noise N quant (2) and a maximum value depending on the employed CECC (3).
Although BER shows univocally the QoS at physical level, this parameter is very complicated to manipulate in a direct manner, and physical parameters affecting that indicator are preferable improved. In particular, BER in OFDMA solutions depends on the Signal over Interference and Noise Ratio (SINR). This ratio (4) depends on the information signal power S, the interference power I and the noise power N. In MIMO (Multiple Input Multiple Output) solutions, this ratio is improved by considering a set of radio antennas. Although in standard 5G systems MIMO technologies are employed by default, they are very difficult to find and implement in ad hoc deployment for emergency situations. As in a realistic scenario we are not finding this technique, we are not considering it.
The information signal power S may be aeasily increased or reduced if required. However, power associated to interferences, I, and noise, N, is more complicated to manage. In general, as these phenomena are environmental and uncontrollable effects (for example, in urban environments, caused by the high density of buildings and pollution), but frequency dependent, any change in the frequency channel employed to communicate causes a change in those powers. Thus, if the SINR is not adequate, a new radio resource t i , f j may be assigned to the user device to improve the situation.
The relation between BER and SINR depends on the selected modulation and spectrum structure. Specifically, in OFDMA solutions, this relation is not analytical and a numerical analysis involving the Discrete Fourier Transform must be developed. Figure 2 shows that relation for different p values.
BER and SINR characterizes the provided QoS, however, a second interesting analysis to consider is how users experience the service. This parameter is known as "Grade of Service" (GoS). As the number of available radio resources at each service and access point is limited (5), eventually, some users may be rejected as they cannot be served. The ratio between served U s and unserved U ns (rejected) users is called GoS (6). However, GoS cannot be calculated in a deterministic manner (like BER), as the number of accepted/rejected users does not follow a specific function, but a probabilistic distribution. Moreover, GoS evolves slowly, and a great amount of damage may be caused before a reduction in that value is detected. Then, Electronics 2020, 9, 1524 7 of 24 situation. The relation between BER and SINR depends on the selected modulation and spectrum structure. Specifically, in OFDMA solutions, this relation is not analytical and a numerical analysis involving the Discrete Fourier Transform must be developed. Figure 2 shows that relation for different p values.  To determine the probability of a user to get rejected by the service, we are using the teletraffic theory. The community of U users associated to the analyzed service and access point, in general, will be much greater than the available radio resources (5). Then, hereinafter, we are considering the number of users U as infinity. Besides, no waiting queue is included. In emergency situations, no delays are admissible, and users must either communicate immediately or be rejected at the moment, so they can look for a different communication option. Then, if all radio resources are assigned to current users, any additional and new user is automatically rejected (see Figure 3).
Two additional physical parameters are, besides, considered: the medium service time (usually expressed in hours) t s and the demand rate λ (typically in user per hour). Then, at any moment, the medium number of new users trying to get service will be λ and the number of users finishing their communications and liberating radio resources is 1/t s . Besides, we are calling P r to the probability of being assigned r radio resources. Then, using simple equilibrium equations and a recursive process, we can calculate that probability (7).
Electronics 2020, 9, x FOR PEER REVIEW 7 of 24 BER and SINR characterizes the provided QoS, however, a second interesting analysis to consider is how users experience the service. This parameter is known as "Grade of Service" (GoS). As the number of available radio resources at each service and access point is limited (5), eventually, some users may be rejected as they cannot be served. The ratio between served and unserved (rejected) users is called GoS (6). However, GoS cannot be calculated in a deterministic manner (like BER), as the number of accepted/rejected users does not follow a specific function, but a probabilistic distribution. Moreover, GoS evolves slowly, and a great amount of damage may be caused before a reduction in that value is detected. Then, To determine the probability of a user to get rejected by the service, we are using the teletraffic theory. The community of users associated to the analyzed service and access point, in general, will be much greater than the available radio resources (5). Then, hereinafter, we are considering the number of users as infinity. Besides, no waiting queue is included. In emergency situations, no delays are admissible, and users must either communicate immediately or be rejected at the moment, so they can look for a different communication option. Then, if all radio resources are assigned to current users, any additional and new user is automatically rejected (see Figure 3).
Two additional physical parameters are, besides, considered: the medium service time (usually expressed in hours) and the demand rate (typically in user per hour). Then, at any moment, the medium number of new users trying to get service will be and the number of users finishing their communications and liberating radio resources is 1/ . Besides, we are calling to the probability of being assigned radio resources. Then, using simple equilibrium equations and a recursive process, we can calculate that probability (7). This expression perfectly matches the Erlang-B distribution . Now, the probability of a user to get accepted is the probability of all radio resources not being assigned (8). Hereinafter, we are using to name the "congestion ratio" (9). This value must be below the unit (typically round 0.7 as maximum) to guarantee the service is not congested and near a relevant degradation of GoS parameter. This expression perfectly matches the Erlang-B distribution EB. Now, the probability of a user to get accepted p accept is the probability of all radio resources not being assigned (8). Hereinafter, we are Electronics 2020, 9, 1524 8 of 24 using ρ to name the "congestion ratio" (9). This value must be below the unit (typically round 0.7 as maximum) to guarantee the service is not congested and near a relevant degradation of GoS parameter.
Using these expressions, we can obtain the probability distribution for GoS (11). It is enough to consider all service requests as independent events and the Poisson distribution with mean value λ (10) as the probability of receiving K service requests in a time period (typically expressed in hours) T-usually one hour.
Now, with all this previous information, it is possible to describe a Cyber-Physical System (CPS) based on a complex control feedback loop, in order to guarantee the service instance (VNF) in the access point under study reaches the expect and target values for QoS (BER and SINR) and GoS. The control loop will manage the radio resources in such a way the service presents the maximum quality, if possible. If, because of environmental conditions, the control loop cannot ensure a good enough quality according to the proposed targets, a congestion report will be sent to the network level. This report may be also sent periodically, to enable the algorithms at network and service level to operate. Figure 4 shows the proposed CPS using a block diagram. Using these expressions, we can obtain the probability distribution for GoS (11). It is enough to consider all service requests as independent events and the Poisson distribution with mean value (10) as the probability of receiving service requests in a time period (typically expressed in hours) -usually one hour.
Now, with all this previous information, it is possible to describe a Cyber-Physical System (CPS) based on a complex control feedback loop, in order to guarantee the service instance (VNF) in the access point under study reaches the expect and target values for QoS (BER and SINR) and GoS. The control loop will manage the radio resources in such a way the service presents the maximum quality, if possible. If, because of environmental conditions, the control loop cannot ensure a good enough quality according to the proposed targets, a congestion report will be sent to the network level. This report may be also sent periodically, to enable the algorithms at network and service level to operate. Figure 4 shows the proposed CPS using a block diagram.
This CPS is implemented in the wireless access points, where radio signals are generated. A similar solution could be deployed in user devices, but this approach would enforce ERT to employ a specific communication equipment. As said before, different ERT (even international teams) using different user and communication devices, could be integrated to address a particular emergency situation, and all of them should be easily connected through the proposed communication system. Thus, in our proposal, user devices may be standard mobile devices as no interaction of special information is required from them. Proposed CPS is implanted in access network (access points) estimating the user perception using different indicators and measures.  This CPS is implemented in the wireless access points, where radio signals are generated. A similar solution could be deployed in user devices, but this approach would enforce ERT to employ a specific communication equipment. As said before, different ERT (even international teams) using different user and communication devices, could be integrated to address a particular emergency situation, and all of them should be easily connected through the proposed communication system. Thus, in our proposal, user devices may be standard mobile devices as no interaction of special information is required from them. Proposed CPS is implanted in access network (access points) estimating the user perception using different indicators and measures.
The interface module extract and monitors from the physical world four different state variables: SINR, BER, the service time t s and the demand rate λ. Different techniques may be employed to estimate these physical variables, from analog circuits to digital signal processing. All of them are adequate to be integrated into the proposed CPS. These variables connect the physical and the computational processes, and (as response) the algorithm may change the physical signal configuration (power and frequency). Those signals are generated using the signal generation module. It is important to note that, formally, the obtained variables are referred to the uplink, while we are acting over the downlink. However, in common scenarios, quality parameters present worse values for the uplink (as user devices have more limited capabilities), so, any case, we are considering a worse case than we are supposed to. The obtained results, then, are equally valid.
As BER cannot be manipulated directly, as previously said and using numerical functions in Figure 2, it is obtained a second SINR estimation SINR B . The new value, and the physical value are merged using a standard average (12).
This value SINR m is compared to the target SINR (so the QoS reaches the expected value) (13). The residue D SINR is aggregated into two historical records controlled by two Exponential Moving Average (EMA) (14), where n is the temporal index. The first one is a short-period average (α ≈ 1), designed to remove fast variations and temporary effects, ensuring the stability of the proposed CPS. Its output EMA SHORT is introduced into a bank of two comparators with thresholds THRESHOLD 1 SHORT and THRESHOLD 2 SHORT (15). Both thresholds must fulfill a strict order condition, so the control loop can work properly (16). The first comparator is active at a low level. For values of EMA SHORT between both thresholds, no action is taken. The difference between both thresholds is the tolerance margin the control loop accept as "standard situation". Typically, it is around 10% of the higher value (THRESHOLD 2 SHORT ), although higher or lower tolerances could be considered depending on the application scenario. For values above THRESHOLD 2 SHORT (they would be above THRESHOLD 1 SHORT as well because of the order condition), the power signal control module is activated. For values below THRESHOLD 1 SHORT (they would be below THRESHOLD 2 SHORT as well because of the order condition), the second exponential average is employed. Basically, if SINR m is near the target SINR no action is taken, if SINR m is much higher than the target SINR a reduction in the information signal power may be done (so energy resources are saved), and if SINR m is much lower than the target SINR, a large processing is required.
To select the specific value of both thresholds, the Shannon-Hartley theorem is considered (17), being W the bandwidth of the radio channel and B the channel capacity. The minimum bitrate to be provided at radio level may be employed to, though this law, obtain the lower threshold THRESHOLD 1 SHORT . Later, and according to the selected tolerance level for the application scenario, THRESHOLD 2 SHORT can be easily calculated.
The second EMA is a long-term average employed to determine if a certain situation has turned structural (α 1). Its output is named EMA LONG . Both EMA SHORT and EMA LONG are subtracted (18) and the difference D EMA is introduced into a new bank of two comparators with thresholds THRESHOLD 1 LONG and THRESHOLD 2 LONG (19). The first comparator is active at a low level. For values D EMA between both thresholds, changes in the frequency spectrum are required and the second branch of the proposed control loop is activated (the low value for SINR m is structural). For any other value, the information signal power must be increased to improve the real SINR. This indicates either the SINR is upgrading from a low value or the SINR is suffering a decrease that is not structural, but it is not a temporary and transitory phenomenon.
On the other hand, the physical variables λ and t s are also injected into two EMA modules (20), but analyzing changes at medium period (0.2 < α < 0.7), so the real-time values for both parameters are obtained. The obtained results are injected into the congestion analysis module. The output of this module (9) is introduced into a comparator and, if the value is above the proposed threshold, an alarm is triggered to the network layer.
Moreover, if a change in the frequency spectrum is required the congestion parameter is introduced into the GoS analysis module. A new radio resource is, then, assigned to the user controlled by the corresponding CPS using the power signal control module. This new assignment, actually, is understood as a reduction in the total number of radio resources M R , as we are consuming this new resource, but no new users are served. Then, the GoS distribution must be calculated (11) for the new value of M R . If the probability for a given and limit value of GoS goes above a certain maximum admissible value (we are using a comparator to perform this check), then, an alarm is triggered to the network layer.
The signal power control module, basically, considers the interference and noise powers are constant in time, so it is easy to calculate the new information signal power to improve the SINR (4), just using the expression for electromagnetic losses in the vacuum (21), being ξ the power of an electromagnetic wave, ξ o the transmitted power and h the transmission distance.
As a result, the proposed loop and CPS will improve the physical configuration of the service in order to reach the target quality, until it is not possible to reach that objective (because of resource limitations); then, an alarm is triggered.
It is important to note that the proposed CPS is limited by the numerical noise of the BER and SINR estimations, but (in general) we can control this effect and guarantee the stability of the control loop by considering a large value for N.

Network Level: Optimal Resource Distribution
At a network level, we are focusing on only one service, but in all the access points and mobile base stations that may be supporting that service. In future 5G systems, virtualization technologies will be employed. For example, as seen in the previous section, VNF will be employed to create service instances in access points. To coordinate all these service instances (run the instance, control its lifecycle, etc.) commercial solutions may be used. For example, Kubernetes and Docker [13]. However, these virtualization and management technologies do not control where the different service instances are run or where and how the base stations are deployed and move. These basic variables are addressed in the proposed solution, through an optimization problem whose solution is here calculated.
Given a service S, the main coordination center allows this service to run simultaneously a maximum of S max service instances (VNF) at A max different access points, being A max ≤ S max . These two parameters, {S max , A max }, represent the resources assigned to the service by the coordination center. Then, we are considering an ordered list U service describing the number of connected or served users through each one of the A[n] available access point at n-th time instant (22). We are representing as U total the total number of service users across the entire network.
The first objective of the optimization algorithm at network level is, then, to maximize the number of served users U total , while the number of service instances and employed access points is minimum. This problem, more precisely a bidimensional equalization problem, is solved to determine the geographical distribution of service instances before any further processing.
We are assuming each access point is provided with a hardware device, so it can inform the base station about its geographical position (typically using global coordinates), Q i (23). Besides, each access point a i is characterized by the number of service instances i it is running (24). Then, the base station managing the service can create a discrete vector function M (bidimensional). The input vector represents the geographic position Q i of an access point, and output values G i represent a measure about the number of served users (Grade of Service) and the provided service quality (network congestion). The proposed function (25) is linear with respect to the GoS and logarithm regarding the network congestion. Both measures are combined in a natural product as any increasing or decreasing in any of the partial measures causes a global increasing or decreasing in the user perception. Any other function or mathematical definition could be freely selected for other application scenarios, but proposed function is selected to match the subjective perception of service quality by users [42] (which is linear for GoS and logarithmic for network congestion). If one access point is not executing an instance of the service, the corresponding geographical point is not considered.
For this function, M, we are representing the area where services are deployed as a squared reticulum (see Figure 5a), so the resulting function is a three-dimensional discrete surface, where peaks represent access point with a good performance (lots of server users and non-congested services), and low values represent congestion situations to be addressed. With the unique purpose of showing the formal shape of this function, Figure 5b represents a possible result for function M (this example does not represent any real situation, so particular values are meaningless and must not be taken into account).
For this function, ℳ, we are representing the area where services are deployed as a squared reticulum ℜ (see Figure 5a), so the resulting function is a three-dimensional discrete surface, where peaks represent access point with a good performance (lots of server users and non-congested services), and low values represent congestion situations to be addressed. With the unique purpose of showing the formal shape of this function, Figure 5b represents a possible result for function ℳ (this example does not represent any real situation, so particular values are meaningless and must not be taken into account). For every service and function, M, a minimum value is defined, m th , that must be reached at every point. Then, the problem we must solve is to determine the set A (26) of access points with the lower cardinality and the lower global number of service instances S total , so function M is maximum for every input point and all of them get, at least, the value m th (27).
A such that card{A} = A[n] is minimum ∧ To solve this problem, we are assuming it is created a solution reticulum de f ault including all activated access points and the service instances each one of them is executing. Using this default configuration, and at any other moment, the following algorithm is run (see Algorithm 1).
The entire reticulum with all values G i is analyzed. If all values meet the optimization condition, no additional action is taken. However, if any point where G i < m th is detected, then the area Γ Q i around the point Q i is analyzed. If the studied area Γ Q i only that point Q i is executing a service instance, then any other point in the area Γ Q i is a candidate to get activated. In that way, the coverage area is enlarged, and more users could be served, reducing the congestion in the original access point.
On the other hand, if in the area Γ Q i , more than one access point is executing the service and the spatial average value in the area Γ Q i according to function M is above m th , the point Q i is a candidate to execute an additional service instance. In the last case, if the average value in the area Γ Q i according to function M is below m th , the point in the area Γ Q i with a lower value is the candidate to execute a new service instance.

Algorithm 1. Service Instances Allocation
Input: Default reticulum de f ault and coverage distance for access points d cover Output: New service instance distribution and reticulum new Create list add of candidates to execute a new service instance Create list rem of candidates to remove a service instance for each Equally, the reticulum is analyzed in subareas Γ i . Areas Γ i where the medium value is much above m th are detected (typically more than five time the value m th ). In these areas, a candidate to remove a service instance can be located. The candidate is the access point with a higher value according function M.
After this analysis process, if candidates to execute a new service instance are equal in number to candidates to remove service instances, the network is updated. If the number of candidates to remove service instances is higher, only 50% of these candidates are requested to remove a service instance. In that way, we guarantee an uncontrollable decreasing in the service quality is not produced. If the number of candidates to execute a new service instance is higher, new instances are executed if possible (if there are available resources). If that is not possible, an alarm is sent to the service layer.
Once service instances are geographically distributed, the distribution and movement of base stations must be analyzed. The position of the base station Y (28) may vary at speed v m/s. To select the most appropriate position for this base station, we are considering a new optimization function. In this case, the base station must be placed or moved in such a way that all access points can communicate with the base station with the best possible quality. The distance h i between any access point and the base station (29) can be easily calculated using the Euclidean distance. On the other hand, an according to electromagnetic propagation laws, the power ξ of an electromagnetic wave decreases inversely proportional to the square distance (21), being ξ o the transmitted power. Finally, the second Shannon's law (or Shannon-Hartley theorem) describes the capacity B of a wireless radio channel (17), with bandwidth W hertz. Now all this information may be put together and simplified to relate the distance between access point and base stations to the bitrate between both elements (30). Two constant parameters b 1 and b 2 are considered, whose value may be obtained from the physical scenario under study. It is important to note that we are considering the channel bandwidth and noise (an interferences) as time constant variables.
Now, we can formally define an aggregated function along the entire mobile base station trajectory, so we can optimize the resulting expression (31). Basically, we must find the sequence of values φ = Y[n] , so the function B agg takes the maximum possible value. If the optimal trajectory is composed of only on point, the base station will be fixed. On the contrary, it will be mobile.
All access points must be served, so all of them must reach, at any moment, a minimum bitrate B min . Besides, the base station trajectory may be open, i.e., the base station is not forced to return to the same point it starts moving. To solve this problem, we are using a Dynamic Time Warping (DTW) algorithm [43,44]. Other mechanisms for optimum path calculation have been reported, but DTW is a very computationally low-cost solution, which perfectly meets the real-time requirements of control loops and CPS. In this technology, it is calculated the optimal path between two points, so a global cost function is minimum (or maximum, in our case). Basically, the idea is, at each point, to select the position which adds the higher cost the aggregate function as the next step. Besides, next step must be next to the current position (mobile base stations are moving in a continuous trajectory). The cost of each point may be easily calculated using previous expressions (30). The resulting path is open, no return is obtained. However, it could be calculated using the same procedure in reverse. Algorithm 2 describes the proposed solution.

Algorithm 2. Mobile Base Station Path Calculation Using DTW Technologies
Input: Reticula describing the coverage area and geographical distribution of access points {Q i } Output: Optimal base station trajectory φ opt Create analysis reticula an for each point Q j ∈ do for each Q i do Calculate B Q j − Q i and add value to an (i, j) end for end for for each possible value of i do for each possible value of j do Obtain the maximum value in an for the set of points (i + 1, j), (i, j + 1), (i + 1, j + 1) Add the point with maximum value to φ opt end for end for

Service Level: Service Catalogue Management
Finally, at service layer, in the main coordination center, all services are considered together. This center takes profit from 5G solutions based on virtualization technologies to dimension services, so the largest possible catalogue is deployed, but only essential services are totally guaranteed. Besides, the service configuration can be dynamically modified, according to the environmental situation.
We are assuming our system is able to provide a catalogue of services C (32), so each individual service i is characterized by four parameters (33): the code of the VNF to be executed vn f i , the minimum number of access point where the service must be deployed A i min , the minimum number of service instances S i min and the service priority σ i .
Service priority is an integer number, so as higher the number, the priority goes down. Besides, service priority may be labeled as e, indicating that is an essential service for ERT (34). The function we would like to maximize is the number of deployed services M S . The main constrain to be considered is the available resources Ω in the network (35); being A net the number of access points in the networks and S net the number of service instances these points can support.
Then, to select what services are finally deployed and the amount of assigned resources, three main design principles are followed: • Essential services are guaranteed, and their resources are exclusively assigned, i.e., each essential service makes a network slice.

•
Services with any other priority are packet and may share resources, according to a reutilization parameter β i , which is related to the service priority: as priority is higher, the reutilization parameter is lower.

•
A strategic reservation of resources is done to address unexpected situations. This reservation includes a percentage γ of total available resources.
Then, the initial service deployment is made following these principles, and always deploying first services with a higher priority (see Algorithm 3).

Algorithm 3. Initial Service Deployment
Input: Service catalogue C and network resources Ω Output: Initial service deployment Available access points A av are defined and equal to A net Available service instances S av are defined and equal to S net Update A av = A av ·(1 − γ) After the initial service deployment proposal, the main coordination center monitors the service performance. If from network level no alarm is received in network reports, it is assumed services are running adequately, and no action is taken. However, if alarms η are received, a resource redistribution is required. In particular, congested services need more resources. If services with lower priority are deployed, they are cancelled or reduced, so their resources are assigned to the congested service. If no service with lower priority is deployed, the congested service is cancelled. Only essential services can obtain resources from the strategic reservation if they are congested. This assignment is, any case, temporary. Besides, periodically, services with assigned resources above the minimum are modified to reduce their resources, so new services can be deployed. Essential services do not participate from this periodical revision process. Algorithm 4 shows this reconfiguration process.

Experimental Validation and Results
To evaluate the performance of the proposed solution, an experimental validation was designed and carried out. The proposed experimental validation was focused on two different objectives. On the one hand, evaluating the usability and good behavior of the proposed solution for emergency communications. On the other hand, analyzing the technical performance of the proposed mechanism, for example, in terms of temporal scalability.
To carry out this experimental validation a simulation scenario was built using the MATLAB 2018b software. The scenario represented a high-density urban scenario, where one coordination center, 15 base stations and a variable number of access points was deployed. The number of services considered in the service catalogue was also variable. The frequency spectrum was supposed to be very noise, because of users trying to communicate. A noise level of 30 dB in the standard frequency channel was configured. Among all proposals for radio channel for 5G technologies, we are considering our system is working in the E-band (60 GHz), where most innovative services are planned to be deployed. Base stations are considered mobile agents, moving at 10 km/h around the coverage area. The total geographical area covered by the proposed solution was supposed to be 20 km 2 , a reasonable surface for a large damage or natural disaster in an urban environment. Considered ERT included up to one hundred user devices to be served by the proposed architecture.
Wireless communications between base stations, access point and the coordination center were simulated as microwaves radio links (in the band of 54 GHz).
The simulation scenario represented an operation time of 24 h in all simulations. All simulations were performed using a Linux architecture (Ubuntu 18.04 LTS) with the following hardware characteristics: Dell R540 Rack 2U, 96 GB RAM, two processors Intel Xeon Silver 4114 2.2G, HD 2TB SATA 7.2k rpm.
Using this technological platform, four different experiments were designed and performed. The first experiment was focused on analyzing how efficient is the proposed solution, compared to traditional approaches. To do that, the congestion level, the Grade of Service and the number of services deployed are analyzed. The simulation scenario was configured to deploy between one and one hundred different services, considering a fixed number of sixty access points. Two different simulations were performed. In the first one, the proposed architecture was implemented; in the second one, a traditional approach based on a fix service deployment is implemented. In this traditional approach, as many services as possible from the catalogue are deployed, and every service has assigned a fixed amount of resources that cannot be dynamically modified. Different works where this approach is described with details may be found [45,46]. Results from both simulations are compared. To reduce statistical noise, each simulation was repeated 12 times, and presented results are obtained as the average of all these simulations.
The second experiment analyzed the temporal order of the proposed solution. Different number of services, between one and one hundred, were considered. And different amount of access points between 30 and 150 were also considered. The reaction time required by the proposed solution to update the system configuration, so a new and more efficient situation is reached, is measured, and analyzed. To reduce statistical noise, each simulation was repeated 12 times, and the presented results are obtained as the average of all these simulations.
The third experiment was focused on analyzing if essential services are always guaranteed, so the basic requirement for communication solutions for emergency situations is met. To do that, from a standard situation identical to the described scenario for the second experiment, the ratio of requests peer time unit is increased. The congestion level for essential services is then monitored, to study if they may get offline at any time. As in all previous experiments, to reduce the statistical noise, each simulation was repeated 12 times, and presented results are obtained as the average of all these simulations.
Finally, the fourth experiment tried to analyze if paths described by base stations are optimal. In this experiment, access points are geographically distributed so the calculation of the optimum path can be calculated from a theorical point of view using the graph theory [47]. Twelve different distributions are considered, and each simulation is repeated 12 times to reduce statistical noise (and presented results are obtained as the average of all these simulations). The distance (according to the common Euclidean definition) between the theoretical and the calculated path is obtained. The experiment is repeated for different number of access points. Figure 6 show the number of deployed services in emergency systems, considering our solution and traditional approaches. As can be seen, for both approaches the system evolution follows, approximately, a logarithm function. For small amount of services, all of them may be deployed in both technologies, but for catalogues with more than ten services there is a relevant difference. The proposed solution allows a higher number of services thanks to the proposed optimization algorithms at service level, so around 35% of planned services can be deployed, contrary to traditional approaches where resources are assigned in a fixed manner, so only 17% of services are finally executed. Thus, proposed mechanism improves up to 100% the traditional approach's performance. approaches where resources are assigned in a fixed manner, so only 17% of services are finally executed. Thus, proposed mechanism improves up to 100% the traditional approach's performance.  Figure 7 shows the reached Grade of Service for both approaches in the same scenario. As can be seen, in this case, the GoS is almost constant, as it is independent from the number of deployed services. As can be seen, the proposed solution is more efficient and reaches a GoS near 90 units, while traditional approaches reach the value of 70 units quite difficulty. This represents an improvement of around 30%.  Figure 7 shows the reached Grade of Service for both approaches in the same scenario. As can be seen, in this case, the GoS is almost constant, as it is independent from the number of deployed services. As can be seen, the proposed solution is more efficient and reaches a GoS near 90 units, while traditional approaches reach the value of 70 units quite difficulty. This represents an improvement of around 30%. Figure 7 shows the reached Grade of Service for both approaches in the same scenario. As can be seen, in this case, the GoS is almost constant, as it is independent from the number of deployed services. As can be seen, the proposed solution is more efficient and reaches a GoS near 90 units, while traditional approaches reach the value of 70 units quite difficulty. This represents an improvement of around 30%. Finally, the first experiment also analyzes the network congestion. Figure 8 represents this variable. As previously mentioned, the network congestion is independent from services consumed by users (they are consuming network resources in the same way, independently from the service), so evolution is almost constant. However, in this case, proposed solution presents worse behavior, increasing around 30% the congestion level associated to traditional mechanisms. These values, however, are affordable as (any case) are always below 0.35. The increasing in the network congestion Finally, the first experiment also analyzes the network congestion. Figure 8 represents this variable. As previously mentioned, the network congestion is independent from services consumed by users (they are consuming network resources in the same way, independently from the service), so evolution is almost constant. However, in this case, proposed solution presents worse behavior, increasing around 30% the congestion level associated to traditional mechanisms. These values, however, are affordable as (any case) are always below 0.35. The increasing in the network congestion is widely exploited, as it allows a great improvement in the GoS ratio (30%) and the deployed number of services (100%).
Electronics 2020, 9, x FOR PEER REVIEW 19 of 24 is widely exploited, as it allows a great improvement in the GoS ratio (30%) and the deployed number of services (100%). Now, we are analyzing results from the second experiment. Figure 9 shows the obtained results for this scalability study. As can be seen, as the number of services in the catalogue goes up, the processing delay also increases. Approximately, the temporal order of the proposed algorithm is in respect to the number of services in the catalogue. This evolution is caused by the optimization algorithm at service level. However, most important effect is due to algorithms at network level, where the number of access points greatly affects the calculation delay. In this case, temporal order follows, approximately, • ( ). Any case, even scenarios with a large number of access points and services in the catalogue, the processing delay is below one second. Thus, the performance of the proposed solution perfectly meets the requirements of emergency scenarios. Now, we are analyzing results from the second experiment. Figure 9 shows the obtained results for this scalability study. As can be seen, as the number of services in the catalogue goes up, the processing delay also increases. Approximately, the temporal order of the proposed algorithm is n in respect to the number of services in the catalogue. This evolution is caused by the optimization algorithm at service level. However, most important effect is due to algorithms at network level, where the number of access points greatly affects the calculation delay. In this case, temporal order follows, approximately, n·log(n). Any case, even scenarios with a large number of access points and services in the catalogue, the processing delay is below one second. Thus, the performance of the proposed solution perfectly meets the requirements of emergency scenarios. Now, we are analyzing results from the second experiment. Figure 9 shows the obtained results for this scalability study. As can be seen, as the number of services in the catalogue goes up, the processing delay also increases. Approximately, the temporal order of the proposed algorithm is in respect to the number of services in the catalogue. This evolution is caused by the optimization algorithm at service level. However, most important effect is due to algorithms at network level, where the number of access points greatly affects the calculation delay. In this case, temporal order follows, approximately, • ( ). Any case, even scenarios with a large number of access points and services in the catalogue, the processing delay is below one second. Thus, the performance of the proposed solution perfectly meets the requirements of emergency scenarios. Figure 9. Second experiment: scalability analysis. Figure 9. Second experiment: scalability analysis. Figure 10 shows the results from the third experiment. As can be seen, as the ratio of request per time unit increases, the congestion level goes up exponentially. Observed values are coherent with previous results and scenarios from previous experiments. However, right after the congestion level reaches the alert threshold, the control loops and dynamic resource management algorithms redistributes the network resources and the congestion level reduces to the base value (around 0.2). The cycle is repeated each time the requests per time unit ratio increases in three thousand units. Any case, this figure shows how the congestion level for essential services is always below critical values (i.e., values up to 0.8), so their provision is guaranteed, as required in emergency situations.
Electronics 2020, 9, x FOR PEER REVIEW 20 of 24 Figure 10 shows the results from the third experiment. As can be seen, as the ratio of request per time unit increases, the congestion level goes up exponentially. Observed values are coherent with previous results and scenarios from previous experiments. However, right after the congestion level reaches the alert threshold, the control loops and dynamic resource management algorithms redistributes the network resources and the congestion level reduces to the base value (around 0.2). The cycle is repeated each time the requests per time unit ratio increases in three thousand units. Any case, this figure shows how the congestion level for essential services is always below critical values (i.e., values up to 0.8), so their provision is guaranteed, as required in emergency situations. Finally, Figure 11 shows the results from the fourth experiment, analyzing the behavior of the optimum path calculation algorithm. As can be seen, the evolution in the calculation error of the optimal path follows a sigmoid function. For small numbers of access points, the error can be considered negligible (it is around 2%). However, for more complex problems involving more than 50 access points, a higher error in induced by DTW algorithm. This error, nevertheless, reaches a maximum (around 16%) when the problem includes more than 150 access points. Thus, the calculation error is bounded to an acceptable value (below 20%), and we can conclude the proposed optimal path calculation algorithm works as expected. Finally, Figure 11 shows the results from the fourth experiment, analyzing the behavior of the optimum path calculation algorithm. As can be seen, the evolution in the calculation error of the optimal path follows a sigmoid function. For small numbers of access points, the error can be considered negligible (it is around 2%). However, for more complex problems involving more than 50 access points, a higher error in induced by DTW algorithm. This error, nevertheless, reaches a maximum (around 16%) when the problem includes more than 150 access points. Thus, the calculation error is bounded to an acceptable value (below 20%), and we can conclude the proposed optimal path calculation algorithm works as expected. Finally, Figure 11 shows the results from the fourth experiment, analyzing the behavior of the optimum path calculation algorithm. As can be seen, the evolution in the calculation error of the optimal path follows a sigmoid function. For small numbers of access points, the error can be considered negligible (it is around 2%). However, for more complex problems involving more than 50 access points, a higher error in induced by DTW algorithm. This error, nevertheless, reaches a maximum (around 16%) when the problem includes more than 150 access points. Thus, the calculation error is bounded to an acceptable value (below 20%), and we can conclude the proposed optimal path calculation algorithm works as expected. Figure 11. Fourth experiment: optimal path evaluation. Figure 11. Fourth experiment: optimal path evaluation.

Conclusions and Future Works
In this paper it is proposed a new approach for ad hoc emergency wireless communications in urban environments based on 5G technologies and Cyber-Physical Systems (CPS). The proposed architecture consists of three layers, where different feedback control loops are defined and linked following the CPS paradigm. At physical level, the spectrum usage is monitored through CPS control loops, analyzing if power signals present a good quality. At network level, 5G virtualization technologies are employed to manage in a dynamic way the network configuration and user management. Finally, at service level, the global situation is analyzed to decide about what services from a catalogue, and according to their priority, can be deployed, including the amount of assigned resources.
The experimental validation shows the proposed solution improves up to 100% the number of services that can be deployed in a given network, as well as up to 30% the Grade of Service ratio. On the other hand, the proposed solution presents a linear scalability in respect to the number of services, and logarithmic in respect to the number of access points. As a global conclusion, the performance of the proposed solution perfectly meets the requirements of emergency scenarios.
In future works, we are evaluating the performance of the proposed solution in realistic scenarios, where the effect of exogenous variables (such as, for example, the climate or malfunctions in hardware devices) could be analyzed and their impact on the performance of the proposed solution evaluated. Besides, experiments for different emergency situations will be carried out, so the behavior of the proposed mechanism for different communication and application services is studied.
On the other hand, studies about the minimum required infrastructure (base stations, access points, etc.) to execute without congestion a given service catalogue will be performed. This is a complementary approach to the one presented in this paper, that may be useful in certain scenarios (for example, in large scale emergency situations when resources tend to be limited and insufficient).