# Fog-Based Two-Phase Event Monitoring and Data Gathering in Vehicular Sensor Networks
## Preliminaries
### Event and Weight of Data  
The event of interest under monitoring is denoted as \(e\), and the vehicular nodes near the event would sense the event and generate some data. There is a mapping of correlation between a data reading \(d\) and event \(e\). The correlation is indicated by function \(\hbar(d,e)\):  
\[\hbar(d,e)=\{p(e),\alpha\},\quad p(e)\in\{1,-1\},\alpha\in[0,1] \tag{1}\]  
\(p(e)\) is the prediction of the event, where one denotes the event occurs and \(-1\) denotes otherwise; \(\alpha\in[0,1]\) is the confidence of the prediction. In this research, we aim to provide a general-purposed event-monitoring and data-gathering scheme that is to decrease the cost while at the same time achieving an acceptable detection rate. While there are different types of events, e.g., polluted air, broken road, and traffic accident, which could be detected through various vehicle-equipped sensing devices such as camera, oxygen sensor, variable reluctance sensor, etc., here, we assume machine learning algorithms are run at the vehicular and fog nodes to predict the occurrence of those events through local data. An example about the event of pavement surface deformation is given as follows:  
**Example 1**.: _Suppose the event \(e\) is a pavement surface deformation at location \(L\). When Vehicle \(A\) travels though \(L\), it senses a data reading \(d_{1}\) and makes a prediction based on that reading: \(e\) happens, and the confidence is 0.5. The event systems would need more predictions like \(A\) to confirm whether \(e\) happens. Therefore, if other vehicles such as \(B\), \(C\), \(D\), \(E\) also predict that \(e\) happens with large confidence, i.e., pavement surface deforms at location \(L\) with a confidence larger than 0.4, then the event detection system at fog nodes would predicate the event to be true._  
Usually, the algorithms, e.g., the logistic regression [34], would indicate the event to be true or false by giving a confidence. Additionally, the weight of \(d\) on event \(e\) could be further defined as:  
\[w(d,e)=p(e)\times\alpha \tag{2}\]  
The weight is highly related to the sensing operator and the monitoring applications. If the weight of data, e.g., \(w(d,e)\) is close to one, \(e\) is likely to occur; if it is close to \(-1\), \(e\) is unlikely to occur; if it is close to zero, the occurrence of the event is unclear due to a lack of confidence. Given the type of sensing operator and data, the weight of data is used as the main input for the event-monitoring and  
Figure 1: Illustration of a vehicular sensing system. Nodes generate pieces of data and send them to fog nodes (RSUs). RSUs provide computation, storage and networking services between the vehicular nodes and ITS cloud.  
detection. Furthermore, we assume the data gathered in HCS mode have a much larger weight than that in LCS mode:  
\[w(d_{1},e)<<w(d_{2},e),\ \ \ d_{1}.mode=LCS,d_{2}.mode=HCS \tag{3}\]  
In other words, data generated through HCS mode contribute more to the ITS system to determine whether an event occurs, yet the data generated in HCS mode have also == larger sizes and incur larger sensing and gathering cost. The proposed TPEG scheme is to continuously monitor and detect events in VANETs, while at the same time reducing unnecessary high cost sensing activities, e.g., working in HCS mode, and message transmissions as much as possible.