## 5 Proposed Method
### Routing Algorithm at Intersection Level
Otherwise, _Vehicle\({}_{5}\)_ searches in its neighbor table to select the neighboring vehicle closest to _P\({}_{Target}\)_ and sends data packets to this vehicle. If _Vehicle\({}_{5}\)_ fails to find a vehicle closer to _P\({}_{Target}\)_ than itself, meaning that it deals with a local minimum issue. In this case, _Vehicles\({}_{5}\)_ goes to the route recovery phase described in Section 5.3.2 to select the next-hop node. #### 5.3.2 Route Recovery Algorithm

In this phase, a fuzzy logic-based route recovery algorithm is implemented to evaluate the chances of neighboring vehicles as the next hop node. The fuzzy logic-based route recovery process involves the following parts:

Fuzzy Inputs The fuzzy model includes three inputs:

* **Distance to P\({}_{\textbf{Target}}\) (d\({}_{\textbf{i},\textbf{target}}\)):**_Vehicle\({}_{5}\)_ obtains the distance from a neighboring vehicle (such as _Vehicle\({}_{i}\)_) to _P\({}_{Target}\)_ with regard to the information stored in the neighbor table based on Equation (17). In this process, the vehicle that is closest to the destination compared to other neighbors gains more chance to be selected as the relay vehicle. \[d_{i,target}=\frac{\sqrt{\left(x_{i}-x_{target}\right)^{2}+\left(y_{i}-y_{ target}\right)^{2}}}{L_{R}}\] (17) where \((x_{i},y_{i})\) and \(\left(x_{target},y_{target}\right)\) display the spatial coordinates of _Vehicle\({}_{i}\)_ and _P\({}_{Target}\)_, respectively. Moreover, \(L_{R}\) indicates the length of the road related to _Vehicle\({}_{5}\)_. It is calculated using Equation (11). The membership function chart of \(d_{i,target}\) is presented in Figure 7(a). It involves three states: low, medium, and high. * **Queue status (Q\({}_{\textbf{i}}\)):**_Vehicle\({}_{5}\)_ extracts \(Q_{i}\) for each neighboring vehicle (such as _Vehicle\({}_{i}\)_) from the neighbor table. The purpose of this parameter is to lower the chance of vehicles with high traffic being selected as the relay vehicle. See the membership function chart of \(Q_{i}\) in Figure 7(b). This input considers three states: low, medium, and high. * **Connection Quality (CQ\({}_{\textbf{i},\textbf{prev-hop}}\)):**_Vehicle\({}_{5}\)_ calculates _CQ\({}_{i,prev-hop}\)_ for each neighboring node (such as _Vehicle\({}_{i}\)_) using Equation (4) to be selected vehicle with the highest connection quality as the relay vehicle. The membership function chart of _CQ\({}_{i,prev-hop}\)_ is represented in Figure 7(c). This input involves three states: low, medium, and high. In the fuzzy route recovery process, the fuzzy output (i.e., \(S_{i}\)) determines the chances of neighboring vehicles being selected as the relay vehicle. In the proposed fuzzy system, a vehicle that has a short distance to \(P_{Target}\) and includes low traffic, and a high connection quality compared to other neighboring vehicles, obtains a high chance to be selected as the relay vehicle. See the diagram of the fuzzy membership function related to \(S_{i}\) in Figure 9. This fuzzy output consists of seven states: extremely low, very low, low, medium, high, very high, and extremely high. Rule Base

Table 4 expresses the fuzzy rules introduced in the fuzzy route recovery algorithm. For example, _\"Rule 1\"_ is defined below:

**Rule 1:**\(d_{i,target}\) is _low_ **AND**\(Q_{i}\) is _low_ **AND**\(CQ_{i,prev-hop}\) is _Low_ **THEN**\(S_{i}\) is _High_. Figure 8: Fuzzy inputs. Figure 9: Fuzzy output.