*2.2. Estimation Approaches*

As mentioned earlier, the KF and the AKF are considered linear estimators that can efficiently handle linear state-space systems. However, in the proposed state-space equations, we suspect some nonlinearity coming from the *ρ* variable, which raises the question, would a nonlinear filter improve the estimation performance? For this purpose, this study develops a nonlinear PF approach to estimate the vehicle counts along the signalized link. This section presents the formulation of the three approaches used to estimate the vehicle counts using only CV data along signalized approaches. The three techniques are the proposed PF, the KF [7], and the AKF [10].

#### 2.2.1. The PF Approach

The PF approach is used to solve nonlinear state-space systems with no form restrictions on the initial state and noise distributions. For instance, the PF can deal with any arbitrary PDF distribution [21]. The PF approach is used to estimate the posterior PDF of the state vehicle count variable ( *N*) given some measurements of CV travel times (*TT*) by assigning *k* number of particles (samples). Each particle has a certain relative weight ( *w*). When a new measurement is received, the particles' locations and weights are updated. It should be noted that the particles with low relative weight values are replaced with new particles (resampling) so that the system keeps only the important particles. The estimates are then calculated using the average value of the remaining particles. The following steps are used to implement the proposed PF approach:

	- (a) *N*ˆ +(0), *R*, *V*, and *k*,

where *N*ˆ +(0) is the initial vehicle count estimate; *R* is the measurement's covariance error; and *V* is the variance of the initial vehicle count estimate, which is used to randomly generate the initial particles' locations around *N*ˆ +(0).

(b) Generate *k* particles' locations randomly, from 1 to *K*, from the initial prior Gaussian distribution *<sup>P</sup>*(*<sup>N</sup>*0).

$$N^k(0) \sim P(N\_0) \tag{5}$$

	- (a) Update the locations ( *N<sup>k</sup>*(*t*)), measurements (*TT<sup>k</sup>*(*t*)), and weights ( *w<sup>k</sup>*(*t*)) of the particles.

$$N^k(t) = N^k(t - \Delta t) + \mu(t) \tag{6}$$

$$TT^k(t) = H(t) \times N^k(t)\tag{7}$$

$$w^k(t) = \frac{1}{\sqrt{2\pi R}} e^{-\left(TT - TT^k(t)\right)^2 / 2R} \tag{8}$$

where *TT* is the observed measurement from the CVs. The weights are then normalized using the following equation, *w*ˆ *<sup>k</sup>*(*t*) = *w<sup>k</sup>*(*t*)/ *K* ∑ *k*=1 *<sup>w</sup><sup>k</sup>*(*t*).


$$
\hat{\mathcal{N}}^{+}\left(t\right) = \frac{1}{K} \sum\_{k=1}^{K} \mathcal{N}^{k}(t) \tag{9}
$$

(d) Next time step (*t* + Δ*t*): When 5 new CVs traverse the link, return to step 2a.

#### 2.2.2. The KF Approach

The KF approach is a linear quadratic estimator. It has been proven to be the best for estimating linear systems with Gaussian noise [42]. The KF estimation approach can be solved using the following steps:

	- (a) *N* ˆ +(0), *R*, and *<sup>P</sup>*<sup>ˆ</sup>+(0), where *P* <sup>ˆ</sup>+(0) is the initial posterior error covariance estimate for the state system.
	- (a) Prior estimates:

$$
\hat{N}^{-}(t) = \hat{N}^{+}(t - \Delta t) + u(t) \tag{10}
$$

$$
\hat{T}\hat{T}(t) = \hat{H}\left(t\right) \times \hat{N}^-\left(t\right) \tag{11}
$$

$$\mathcal{P}^-\left(t\right) = \mathcal{P}^+\left(t - \Delta t\right) \tag{12}$$

where *N* ˆ − is an estimate of a priori vehicle count, *TT* ˆ is the estimated average travel time, and *P* ˆ − is the a priori covariance estimate for the state system.

(b) Correction: The correction uses the prior estimate and the new measurement (i.e., the CV average travel time) to compute the Kalman gain (*G*).

$$G(t) = \left[\mathcal{P}^-(t)H(t)\right]^T \left[H(t)\mathcal{P}^-(t)\right] H(t)^T + R\right]^{-1} \tag{13}$$

(c) Posterior state estimates:

$$
\hat{N}^+\left(t\right) = \hat{N}^-\left(t\right) + G\left(t\right)\left[TT\left(t\right) - T\hat{T}\left(t\right)\right] \tag{14}
$$

$$\mathcal{P}^+\left(t\right) = \mathcal{P}^-\left(t\right) \times \left[1 - H\left(t\right)\right]G\left(t\right)\right] \tag{15}$$

where *N* ˆ + is the posterior vehicle count estimate, and *P*<sup>ˆ</sup><sup>+</sup> is the posterior error covariance estimate.

(d) Next time step (*t* + Δ*t*): When 5 new CVs traverse the link, return to step 2a.

#### 2.2.3. The AKF Approach

The AKF approach is presented to estimate the total number of vehicles, using real-time noise error estimates in the state and measurement systems (i.e., mean and variance values). It should be noted that the KF and the AKF approaches use the same equations, but the AKF approach dynamically estimates the noise statistical parameters every estimation step. The vehicle count estimates can be obtained using the following steps:

	- (a) *N* ˆ +(0), *<sup>m</sup>*(0), and *<sup>P</sup>*<sup>ˆ</sup>+(0), where *m*(0) is the mean of the noise for the state system.

#### 2. For *t* =1: *T*

(a) Prior estimates:

$$
\hat{N}^-\left(t\right) = \hat{N}^+\left(t - \Delta t\right) + u(t) + m(t - \Delta t) \tag{16}
$$

$$P^{-}\left(t\right) = P^{+}\left(t - \Delta t\right) + M(t - \Delta t) \tag{17}$$

(b) Estimation of noise statistics for the measurement system:

$$
\hat{T}\hat{T}(t) = H\left(t\right) \times \hat{N}^-\left(t\right) \tag{18}
$$

$$r = \frac{1}{n} \sum\_{t=1}^{n} \left[ TT(t) - T^{\natural}T(t) \right] \tag{19}$$

$$R = \frac{1}{n-1} \sum\_{t=1}^{n} \left[ (r(t) - r). (r(t) - r)^T - (\frac{n-1}{n}) H(t) \mathbb{P}^-(t) H^T(t) \right] \tag{20}$$

where *r* and *R* are the mean and covariance of the measurement noise, respectively, and *n* is the number of state noise samples.

(c) Correction:

$$G(t) = \left[\mathcal{P}^-(t)H(t)\right]^T \left[H(t)\mathcal{P}^-(t)\right] H(t)^T + R(t)^{-1} \tag{21}$$

(d) Posterior state estimates:

$$
\hat{N}^+\left(t\right) = \hat{N}^-\left(t\right) + G\left(t\right) \left[TT(t) - T^\uparrow(t) - r(t)\right] \tag{22}
$$

$$
\hat{P}^{+}\left(t\right) = \hat{P}^{-}\left(t\right) \times \left[1 - H\left(t\right)\right]G\left(t\right)\right] \tag{23}
$$

(e) Estimation of noise statistics for the state system:

$$m = \frac{1}{n} \sum\_{t=1}^{n} \left[ \hat{N}^+(t) - \hat{N}^+(t - \Delta t) - \mu(t) + m(t - \Delta t) \right] \tag{24}$$

$$M = \frac{1}{n-1} \sum\_{t=1}^{n} \left[ (m(t) - m). (m(t) - m)^T - (\frac{n-1}{n}) \dot{\mathbb{P}}^+ (t - \Delta t) - \dot{\mathbb{P}}^+ (t) \right] \tag{25}$$

where *m* and *M* are the mean and covariance of the state noise, respectively.

(f) Next time step (*t* + Δ*t*): When 5 new CVs traverse the link, return to step 2a.

#### **3. Results and Discussion**

This section evaluates and compares the three estimation approaches. The simulated data were generated for a signalized link under an oversaturation condition in which the traffic demand exceeds the link capacity. The free-flow speed is 40 km/h; the saturation flow rate is 1800 veh/h/lane, resulting in a traffic capacity of 855 veh/h given the cycle length and traffic signal's green times; the speed-at-capacity is 32 km/h; and the jam density is 160 veh/km/lane. The traffic signal is operated at a cycle length of 120 s and a phase split of 50:50. The amber and all-red intervals are 3 s. To test the accuracy of the estimation approaches, the INTEGRATION microscopic traffic assignment and simulation software was used [43,44]. The relative root mean square error (RRMSE), presented in Equation (26), was used to evaluate the proposed estimation approaches.

$$\text{RRMSE}(\%) = 100 \frac{\sqrt{\text{S} \sum\_{s=1}^{\text{S}} \left[ \text{\text{\textdegree N}}^{+}(\text{s}) - \text{N}(\text{s}) \right]^{2}}}{\sum\_{s=1}^{\text{S}} \text{N}(\text{S})} \tag{26}$$

where *N* ˆ +(*s*) represents the estimated count of vehicles, *<sup>N</sup>*(*s*) represents the actual count of vehicles, and *S* is the overall number of estimations.

#### *3.1. Performance of Estimation Approaches*

The simulations were conducted with the same predefined initial conditions to obtain a fair comparison. The initial conditions are described in Table 1. It should be noted that each estimator requires specific initial variables. For instance, *N* ˆ +(0), *R*, and *P*<sup>ˆ</sup>+(0) are required for the KF approach. For all estimation approaches, the first estimate begins with an erroneous initial estimate of vehicle count (*N* ˆ +(0) = 5 veh), whereas the actual vehicle count is zero [4,7].

**Table 1.** Initial conditions for the Kalman filter (KF), adaptive KF (AKF), and particle filter (PF) approaches.


The three estimation approaches were evaluated using different CV LMPs, including 1%, 3%, 5%, 8%, 10%, 15%, 20%, 30%, 40%, 50%, 60%, 70%, 80% and 90%. For each LMP scenario, 100 random samples from the full data set were created using a Monte Carlo simulation. Table 2 presents the RRMSE values of the KF, AKF, and the PF approaches. The table indicates that estimation errors decrease with increasing LMP for all estimation approaches. The table also demonstrates that the KF outperforms the AKF and the PF approaches. For instance, for the scenario of 1% LMP, the vehicle count estimates were off by 30%, 48% and 64% using KF, AKF and PF, respectively.


**Table 2.** Relative root mean square error (RRMSE) of KF, AKF, and PF approaches for different levels of market penetration rate (LMPs).

The PF approach produces high RRMSE values at low LMPs (LMP < 40%), while for the high-LMP scenarios, the PF produces RRMSE values close to the values obtained from the KF. Moreover, the AKF approach produces high errors, especially at very low LMPs (LMP< 10%) and high LMPs (LMP >= 70%). This demonstrates that the real-time estimates of the statistical noise values obtained from the AKF are not needed for the high-LMP scenarios, and the user may proceed with predefined statistical values due to low errors in the vehicle count estimates (low error in the *ρ* value). It was found that the high RRMSE error values produced from the AKF and PF approaches are mainly caused from assigning an inappropriate initial vehicle count estimate, as discussed in the next section.

Figure 2 presents the KF, AKF, and PF estimation outcomes with regard to the actual values at different LMPs (i.e., 10% to 90% with an increase of 10%). In each subfigure, three plots are generated to display the estimation approaches' outcomes with regard to the actual values; the top one displays the PF outcomes, the middle one presents the KF outcomes, and the bottom one displays the AKF outcomes. The actual curve is represented by the dotted curve. In conclusion, the KF approach is recommended, as it produces the most accurate estimates in addition to its simplicity and applicability in the field. The next section will discuss the impact of the initial conditions on the performance of the various estimation approaches.

**Figure 2.** Actual and estimated vehicle counts at different LMP scenarios: (**a**) 10%, (**b**) 20%, (**c**) 30%, (**d**) 40%, (**e**) 50%, (**f**) 60%, (**g**) 70%, (**h**) 80% and (**i**) 90%.

#### *3.2. Impact of Initial Conditions*

This section examines the effect of the choice of the initial conditions on the performance of the estimators, such as the initial vehicle count estimate *N* ˆ +(0) and the *k* number of particles in the PF approach. First, different *N* ˆ +(0) values were tested, from 0 to 25 at increments of 5, at different LMP scenarios, as presented in Tables 3 and 4. Table 3 presents the RRMSE values when the *N* ˆ +(0) is set to equal 0, 5, and 10 vehicles. Table 4 displays the RRMSE for the *N* ˆ +(0) values of 15, 20, and 25 vehicles. The tables demonstrate that the RRMSE values are sensitive to the changes of the *N* ˆ +(0) values. The tables also show that the PF is the most sensitive estimator to *N* ˆ +(0) for all LMP scenarios. For instance, for the scenario of 1% LMP, the RRMSE is 81% when the simulation starts with 0 veh, while the RRMSE is 17% when *N* ˆ +(0) is equal to 25. Therefore, starting the simulations with an appropriate initial estimate close to the truth value significantly improves the estimation accuracy since this helps the PF to quickly converge. In addition, the AKF seems to be sensitive to the *N* ˆ +(0)

with low LMP scenarios (LMP < = 10%), while the choice of *N*ˆ +(0) has a slight effect on the estimation accuracy for the scenarios with medium and high LMPs. For instance, for the scenario of 1% LMP, the RRMSE is 71% when the simulation starts with 0 veh, while the RRMSE is 21% when *N*ˆ +(0) is equal to 25. Lastly, the tables show that the KF is the least-sensitive estimator to the *N*ˆ +(0) value. Figure 3 summarizes the RRMSE values for nine LMP scenarios presented in Tables 3 and 4.


**Table 3.** RRMSE values for the KF, AKF, and PF approaches using different initial vehicle count estimates (i.e., 0, 5 and 10) for different LMPs.

**Table 4.** RRMSE values for the KF, AKF, and PF approaches using different initial vehicle count estimates (i.e., 15, 20 and 25) for different LMPs.


**Figure 3.** RRMSE values using various initial vehicle count estimates at different LMP scenarios: (**a**) 10%, (**b**) 20%, (**c**) 30%, (**d**) 40%, (**e**) 50%, (**f**) 60%, (**g**) 70%, (**h**) 80% and (**i**) 90%.

This study also examined the choice of the number of particles, *k*, on the PF performance (i.e., *k* = 10, 100, 200, 1000, and 2000), as presented in Table 5. The findings show that the estimation accuracy increases as the number of particles increases, especially at low LMPs. However, increasing the number of particles is associated with additional computational time. The PF is implemented in MATLAB R2019a on a Dell PC with 8.0 GB RAM. The computation time ranges between 0.2 and 1.6 s, with 10 particles for various LMPs; 1.1 and 3.0 s with 100 particles; 1.3 and 6.8 sec with 200 particles; 1.3 and 73 s with 1000 particles; 4 and 256 s with 2000 particles. The results in Table 5 show that the use of 1000 and 2000 particles slightly reduces the RRMSE values compared to the use of 200 particles; however, this comes at a very high computational cost. Therefore, the use of 200 particles is recommended in the PF approach.


**Table 5.** RRMSE values using different number of particles in the PF for different LMPs.

#### **4. Summary and Conclusions**

The paper developed a nonlinear PF estimation approach to estimate the number of vehicles approaching a traffic signal based solely on CV data, with the aim of improving the estimation accuracy of linear state-of-the-art estimation approaches. This study introduced two linear approaches, KF and AKF, as benchmarks, to be compared with the proposed nonlinear PF approach. The results show that the KF produces the least error and accurately estimates the vehicle counts compared with the AKF and PF approaches. Consequently, to address the research problem appropriately, it is recommended to deploy the linear KF approach rather than the more complex AKF and PF approaches because of its simplicity and high-performance accuracy. In addition, the study investigated the sensitivity of the developed approaches to different factors, including the LMP of CVs, the initial vehicle count estimates, and the number of particles used in the PF approach. The results indicate that the estimation errors decrease as the LMP increases. Furthermore, the paper investigated the effect of the choice of the number of particles on the performance of the PF and showed that the PF estimation accuracy increases as the number of particles increases. However, this comes at the expense of significantly longer computational times. This can significantly impact the performance of the PF, requiring longer time to converge. The results demonstrate that the KF approach is the least sensitive to the initial vehicle count estimate, while the PF approach is the most sensitive to the initial vehicle count estimate and thus is the most suitable for the proposed application. Proposed future work entails integrating the KF approach with an adaptive traffic signal controller to quantify the impact of inaccuracies of the traffic stream density on the traffic signal controller performance.

**Author Contributions:** The work described in this article is the collaborative development of all authors. Conceptualization, M.A.A., H.M.A. and H.A.R.; methodology, M.A.A., H.M.A. and H.A.R.; software, M.A.A., H.M.A. and H.A.R.; validation, M.A.A., H.M.A. and H.A.R.; formal analysis, M.A.A., H.M.A. and H.A.R.; investigation, M.A.A., H.M.A. and H.A.R.; writing—review and editing, M.A.A., H.M.A. and H.A.R. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research effort was funded by the Urban Mobility and Equity Center (UMEC).

**Conflicts of Interest:** The authors declare no conflict of interest.
