## 5 Proposed Method
### Identifying Traffic Conditions  
For knowing traffic conditions in each road section, QFHR presents a traffic detection process in the network. Algorithm 1 offers a pseudo-code for identifying traffic conditions in QFHR. In this process, each vehicle (such as \(Vehicle_{i}\), where \(i=1,2,...,N\) and \(N\) represent the number of vehicles) disseminates a hello packet to the neighbors periodically. In QFHR, the hello broadcast time (\(\tau\)) is equal to one second. The hello message includes vehicle ID (\(ID_{i}\)), road ID (\(ID_{R}\)), queue status (\(Q_{i}\)), vehicle location \((x_{i},y_{i})\), and vehicle speed \((v_{x,i},v_{y,i})\). Note that the vehicle speed is unchanged at the timeframe \(\tau\) and is updated after receiving each hello message. \(Vehicle_{i}\) builds a neighbor table (\(Table_{neighbor}\)) to record the information about neighboring nodes. This operation is represented in Figure 4. If \(Vehicle_{i}\) receives a new hello packet, it searches the ID related to the packet in its neighbor table. If this ID is in the table, \(Vehicle_{i}\) updates the recorded information about this vehicle in its neighbor table. Otherwise, it adds a new entry to this table and records the information about the new vehicle. Table 2 shows the format of the neighbor table. In the following, various fields of the table are explained:  
* **Vehicle ID:** This field represents the identification of a neighboring vehicle in the road section. After receiving a hello packet from a neighbors, \(Vehicle_{i}\) searches its ID in its neighbor table. If this ID is not available in the table, it adds a new entry to this table and records this ID in the _\"Vehicle ID\"_ field.
* **Road ID:** This field is the identification of the road section corresponding to the neighboring vehicle. Upon receiving a new hello message, \(Vehicle_{i}\) refreshes the road ID corresponding to the vehicle recorded in its neighbor table.
* **Spatial coordinates:** It indicates the position of a neighboring vehicle in the road section and is updated after the time period \(\tau\).
* **Speed:** This field indicates the speed of the neighboring vehicle in the road section. It is fixed at the time period \(\tau\) and refreshed after receiving the new hello message.
* **Queue status:** Using this parameter, \(Vehicle_{i}\) can detect the congestion level in the neighboring vehicle. The queue status (\(Q_{j}\)) is normalized using Equation (3). \[Q_{j}=\frac{QL_{j}}{\max QL_{j}}\] (3)  
\begin{table}
\begin{tabular}{c c c c c c c} \hline
**Vehicle ID** & **Road ID** & **Spatial Coordinates** & **Speed** & **Queue Status** & **Connection Quality** & **Validity Time** \\ \hline \(ID_{i}\) & \(ID_{R}\) & \((x_{i},y_{i})\) & \((v_{x,i},v_{y,i})\) & \(Q_{i}\) & \(CQ_{i,i}\) & \(VT_{i}\) \\ \hline \end{tabular}
\end{table}
Table 2: Neighbor table format.  
Figure 4: Hello message broadcast.  
where, \(QL_{j}\) and \(\max QL_{j}\) are the number of packets in the queue and maximum queue length of \(Vehicle_{j}\), respectively.
* **Connection quality:** It represents the quality of the connection between \(Vehicle_{i}\) and \(Vehicle_{j}\). It is measured based on two parameters, namely the connection time and the hello packet reception rate. Section 5.1.1 describes how to calculate this parameter in detail.
* **Validity time:** It is a time interval when this entry is valid in the neighbor table. After receiving each new hello message from a vehicle, this time interval is refreshed. If the new hello message is not received from the vehicle, the entry related to the vehicle will be removed from the neighbor table after ending the validity time.