## 3 Proposed Smart Route: IoV-Based Congestion Detection and Avoidance (CDA) Using Rerouting
### IoV-Based Congestion Avoidance (IoV-Based CA)  
In this section, we present the real-time congestion avoidance at the earliest stage protocol. First, an RSU detects congestion as shown in Algorithm 1, i.e., occupancy rate and occupation time on any road segment. Rerouting is an effective method of mitigating traffic congestion by redirecting vehicles' flows to sufficiently bandwidth paths. To balance the uneven traffic distribution, this paper uses EG-Dijkstra [35; 36], to reroute the traffic evenly. In the rerouting, the occupancy level of the alternate routes is taken into account to avoid the possibility of transferring congestion from one place to another place. In the proposed IoV-based Collision Avoidance, if the transfer of \(n\) vehicles to a particular route exceeds the threshold of occupancy rate or occupancy time of that route, then the full transfer (i.e., \(n\) vehicles) is converted to a partial transfer. The complete procedure of IoV-based CA is given in Algorithm 2. ```
1:for\(s\in S\)do
2:if\(O_{rate}(s)>\delta\) OR \(O_{t}(s)>\tau\)then
3:\(S(s)\longleftarrow\) Block
4:else
5:\(Available\_space\longleftarrow C(S)-Count(V,s)\)
6:endif
7:endfor
8:\(n\longleftarrow\) Arriving vehicles at RSU
9:if\(RSU.next!=Block\)then
10:if\(Available\_space<n\)then
11:\(Sort(RoutRequest)\)
12:\(Send(s.next(Available\_space))\)
13:\(EG\_[PERSON](G,s(n-Available\_space),de)\)
14:else
15:\(Send(s.next(Available\_space))\)
16:endif
17:else
18:\(EG\_[PERSON](G,s,next.hop(de))\)
19:endif
20:On next hop to the destination, Go back to step 13 The proposed algorithm calculates the capacity and the occupancy rate of each road's segment, as well as the occupancy time of each vehicle, which is also measured for further evaluation. Secondly, each segment is assessed; if the limit exceeds the given threshold (see line 3), then the segment is marked as a block. In Algorithm 2, the available capacity of each segment is also calculated (see line 5(a)) to support the optimum route planning. If \(n\) vehicles request the RSU for a particular road segment, the RSU first checks the available capacity of the requested segment. If the capacity is enough for \(n\) vehicles, then the route is planned over that segment (see line 9 to 13). In the opposite case, the vehicles are divided into groups, where part of the vehicles is planned to the requested road segment, while the route of other vehicles is set by the EG-Dijkstra algorithm [35; 36]. ## 4 Experimental Results and Discussions

This section assesses the proposed IoV-based congestion detection and avoidance scheme under various traffic densities (low, medium, high, and massive (very high) congested scenarios) and AOI's (Alwaha, Riyadh intersection point) segment lengths. The performance of the proposed scheme is compared with the existing IoV-based congestion detection scheme, i.e., MCDP [20]. This section is further divided into three sub-sections: (a) Simulation environment; (b) Impact of AOI's size on IoV-based CDA scheme performance; (c) Impact of congestion levels on IoV-based CDA scheme performance. ### Simulation Environment

The primary goal of the proposed scheme is to monitor and control a given area of interest in an urban city road. For this purpose, we used a well-known traffic simulator SUMO (Simulator for Urban Mobility) [43], version 0.24.0, to assess the performance of IoV-based CDA. SUMO is an open-source traffic simulator developed under the collaboration of the ZAIK and ITS departments. The realistic street map of Alwaha, Riyadh intersection point was taken from the OpenStreetMap [44], and later various traffic conditions were generated through SUMO. Our experiments in this paper are closely related to the real road traffic. We extracted the real road intersection point (see Figure 2) from OpenStreetMap and deployed random traffic using SUMO. The literature has enormous examples of SUMO-based traffic simulations [35]. Next, the generated traffic traces were imported to MATLAB (R2015b) for different performance metrics measurements.