# Road-Side Unit Anomaly Detection
## 4 Alarm Message  
In this section, we detail the structure of our proposed message, which makes it possible to raise an alarm about RSU failures. This message is composed of the timestamp \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**RSU** & **Context** & **Max Range** & **In- Distance** & **Out- Distance** & **Pearson’s Coef** & **Coef Condition** & **ID > OD** & **Range > 50 Cond** \\ \hline  
ncorrect & correct & incorrect \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Recorded communications with the RSUs. Figure 9: Clustering of Behavior of RSUs. and the location when the RSU is met the first time and the timestamp and the location when it is met the last time. The vehicle records the timestamp and location of received messages from the RSU and filters the last one and the first one. As an option, we add the signal strength RSSI. This message has to be sent to the road operator using ITS-G5 or C-V2X channels. Unlike the typical C-ITS messages, this message will target the RSU which has been analyzed. It will be sent through an uni-cast protocol. If ITS-G5 is used, that means the message will be forwarded by vehicles driving in the opposite roads. The structure of the packet is shown in Figure 10.  
A vehicle builds this message each time it meets an RSU. At that moment, it collects beacons and CAMs sent by the RSU and keeps the first message and the latest message. When a new message is received, the former one is dropped. When no message is received from the RSU after a time delay, the previous one is considered as the last one. If an RSU overlaps another RSU, the vehicle filters CAMS and beacons sent from both RSUs in order to be able to alert each RSU accordingly. The algorithm in Algorithm 1 gives the instructions that a vehicle should follow to report an RSU's status. ```
Input:\(RSU_{\text{s}}[RSU\_ID\_in\_location,out\_location,in\_RSSI,out\_RSSI,RSU\_Time]\)  list of all RSUs with their attributes, \(time\_Threshold\) timestamp, \(current\_Time\) timestamp, \(m\) last received C-ITS message if\(m.origin==RSU\)then if\(m.RSU\_ID\) NOT IN \(RSU_{\text{s}}[RSU\_ID]\)then /* First message from this RSU */ \(RSU\gets createRSU()\) \(RSU.in\_location\gets getVehicleLocation()\); \(RSU.in\_RSSI\gets m.RSSI\) \(RSU.RSU.ID\gets m.RSU\_ID\) \(RSUls.add(RSU)\) else /* Second message from this RSU */ \(RSU\gets RSUs.get(RSU\_ID==m.RSU\_ID)\) \(RSU.out\_location\gets getVehicleLocation()\); \(RSU.out\_RSSI\gets m.RSSI\); \(RSU.RSU\_Time\gets m.time\) endif forRSU in RSUsdo if\(RSU.RSU\_Time\) IS NOT NULL then \(T=currentTime-RSU.RSU\_Time\) if\(T\geq time\_Threshold\)then \(sendAarmMessage(RSU)\); \(RSUs.remove(RSU\_ID==m.RSU\_ID)\) endif endif endif
```  
**Algorithm 1**Create Alarm message  
The road operator has the list of all RSUs in any area, including their geographical context, which could be interurban or urban. Each RSU is associated with a score determining its status. If the score for an RSU is high, this means that the RSU is properly functioning,  
Figure 10: The structure of the alarm packet. otherwise, this means that the RSU is experiencing failure. If the score is around zero, the RSU is either urban or there were not enough alarm messages reported by end users. The algorithm in Algorithm 2 gives the instructions that the road operator should follow in order to treat the upcoming alarm messages. Upon the reception of an alarm message, the geographical context of the concerned RSU is verified; if it is interurban, then the ID and OD are compared, and when the ID is significantly smaller than the OD, then we are in the case of an RSU failure such as in Figure 8 and the score of the concerned RSU is decremented by one; otherwise, it is incremented by one. Lastly, whether the RSU is interurban or urban, its overall range is verified. If it does not exceed a minimal threshold, then the score is also decremented. Once an RSU's score reaches the minimal threshold, then the road operator considers that enough vehicles reported that the RSU is in failure and reports it.