## 5 Proposed Method
### Identifying Traffic Conditions
#### 5.1.2 Forming a Traffic Table  
To know the network status, each RSU holds two tables in its memory. In the following, each table is demonstrated exactly. * **Neighbor table (Table\({}_{\textbf{neighbor}}\)):** It contains information about neighboring vehicles. The format of this table is presented in Section 5.1. After receiving new hello messages from vehicles in different road sections, RSU searches their IDs in its neighbor table. If these IDs are in the table, RSU updates the recorded information about these vehicles in its neighbor table. Otherwise, RSU adds new entries to this table to record the information about new vehicles. * **Traffic table (Table\({}_{\textbf{traffic}}\)):*
* It indicates traffic conditions on the roads connected to the intersection related to RSU. The format of \(Table_{traffic}\) is presented in Table 3. \(Table_{traffic}\) is periodically refreshed every five seconds (\(T_{TR}=5\,s\)) because traffic status information at the road level does not change before this time period. \(Table_{traffic}\) includes various fields explained as follows. * **Road ID:*
* Each intersection is connected to the four road sections: the northern road, the southern road, the eastern road, and the western road. The road ID is obtained from the neighbor table. * **Road length:*
* Each RSU (such as \(RSU_{m}\)) is aware of its location and the position of its neighboring RSUs (such as \(RSU_{n}\)) at adjacent intersections. Therefore, it can calculate the road length using Equation (11): \[L_{R}=\sqrt{\left(x_{n}-x_{m}\right)^{2}+\left(y_{n}-y_{m}\right)^{2}}\] (11) where \((x_{m},y_{m})\) and \((x_{n},y_{n})\) are spatial coordinates of \(RSU_{m}\) and \(RSU_{n}\), respectively. * **Average road time (T\({}_{\textbf{R}}\)):*
* This field represents the average time required to travel the road section. RSU estimates \(T_{R}\) using Equation (12), which considers two
scales, the road length (\(L_{R}\)) and the average speed of neighbors in this road section: \[T_{R}=\frac{L_{R}}{\left(\frac{\frac{n_{R}}{2}V_{i}}{n_{R}}\right)}\] (12) where \(V_{i}\) is the speed of the neighbors obtained from the neighbor table and \(n_{R}\) is all number of vehicles on the road section. RSU uses the WMEWMA scheme to update \(T_{R}\) using Equation (9) in each road section. * **Vehicle density (\(\mathbf{D_{R}}\)):** This field represents the number of available vehicles in a road section (i.e., northern, southern, eastern, or western road sections). It is obtained from the neighbor table. To update \(D_{R}\), RSU uses the WMEWMA method in Equation (9). * **Congestion status (\(\mathbf{\overline{Q}_{R}}\)):** The value of this field corresponds to the average queue status of vehicles in the road section. It is achieved from the neighbor table: \[\overline{Q}_{R}=\frac{\sum\limits_{i=1}^{n_{R}}Q_{i}}{n_{R}}\] (13) Note that RSU refreshes this parameter in the traffic table using the WMEWMA scheme in Equation (9). * **Average connection quality (\(\mathbf{C_{R}}\)):** This field represents the average connection quality of vehicles (i.e., \(CQ_{i,j}\)) in each road section. It can be calculated based on Equation (14) and recorded in the traffic table. \[CQ_{R}=\frac{2}{n_{R}(n_{R}+1)}\sum\limits_{i=1}^{n_{R}-1}\sum\limits_{j=i+1}^ {n_{R}}CQ_{i,j}\] (14) where \(n_{R}\) is all number of vehicles in the road section \(R\). RSU uses the WMEWMA to update \(CQ_{R}\) in the traffic table using Equation (9). * **Validity time (\(\mathbf{VT_{R}}\)):** This field represents the time interval that this entry is valid in the traffic table.