# On the Local and String Stability Analysis of Traffic Collision Risk
## 5 Simulation Verification
### Consistency Results  
The simulation verification procedure is presented in Algorithm 1. The inputs of the process include the equilibrium velocity \(\overline{v^{eq}}\), the standstill space \(s_{0}\), the number of vehicles involved \(N\), the disturbance amplitude \(A\), and the disturbance duration time \(t_{0}\). Further, \(\delta t\) is the time slot to update the vehicles' states, and \(i\) and \(j\) are the countable numbers to calculate the consistency of theoretical derivation and simulation results. For each time step for each vehicle, \(r_{n}(t)\) is calculated from the simulation and then compared with the theoretical value to check whether the theoretical result is consistent with the simulation result regarding stability. Finally, the consistency is calculated. As shown in Algorithm 1, the specific range selected for \(\alpha\), \(\beta\), and (T) is ([0.1, 5] (m/s\({}^{2}\))), ([0.1, 5] (m/s\({}^{2}\))) and ([0.1, 5] (s)). Besides IDM, two kinds of widely used car-following models, optimal velocity model (OVM) [40] and ACC control model [43], are applied to simulate the movements of vehicles. The consistency results are presented in Table 1. We see that high consistency is obtained between theoretical values and simulation results for both traffic and risk stability analysis. Figure 7: Speed and collision risk profile in different scenarios. ```
input :\(\varphi^{rq}\), \(s_{0}\), \(A\), \(N\), \(l_{0}\), \(\omega\), \(\Delta t\), \(i=j=0\) output :Consistency
1 for\(n\gets 1\)to\(N\)do// Initialization
2\(p_{n}(t_{0})\), \(v_{n}(t_{0})\) in equilibrium ;
3 for\(\alpha\gets 0.1\)to\(5\)do
4 for\(\beta\gets 0.1\)to\(5\)do
5 for\(T\gets 0.1\)to\(5\)do
6 for\(t\gets t_{0}\)to\(eoughtime\)do
7\(v_{1}(t)=v^{rq}+Asin(\omega\Delta t)\);
8\(p_{1}(t)=p_{1}(t-\Delta t)+v_{1}(t)\Delta t+0.5 Asin(\omega\Delta t)(\Delta t )^{2}\);
9 for\(n\gets 2\)to\(N\)do
10\(a_{n}(t)=f_{1 DM}(\alpha,\beta,T,p_{n}(t-\Delta t),p_{n-1}(t-\Delta t),v_{n}(t- \Delta),v_{n-1}(t-\Delta))\);
11\(v_{n}(t)=v_{n}(t-\Delta t)+a_{n}(t)\Delta t\);
12\(p_{n}(t)=p_{n}(t-\Delta t)+v_{n}(t)\Delta t+0.5a_{n}(t)(\Delta t)^{2}\);
13
14 Calculate \(r_{n}(t)\) based on Equation (14); // Simulation
15
16 if\(Integral[(r_{n-1}(t)-r_{n-1}^{eq})^{2}]>Integral[(r_{n}(t)-r_{n}^{eq})^{2}]\)then
17 Calculate \(f_{\Delta x}\), \(f_{\Delta x}\) and \(f_{\dot{x}}\);
18 ifEquations (34)-(38) holdthen\(j=j+1\);
19
20\(i=i+1\)// Verification
21
22 Consistency=\(j/i\);
```  
**Algorithm 1**Simulation verification  
In addition, when the disturbance magnitude is large, the consistency between the theoretical value and simulation results decreases. This could be due to the linearization nature of applying the transfer function approach in the theoretical stability analysis, whereby the car-following model linearization is conditioned on the disturbance magnitude being small. If the disturbance is large, to a certain extent, the error between the linearized model and the original model may grow and lead to inconsistent results. Further, as can be seen from Table 1, the ACC model exhibits the highest consistency owing to the fact that the adopted ACC model is linear. In addition, note that even with a linear car-following model, it is difficult to achieve 100% consistency for either traffic or risk stability since the continuous-time CF model is discretized in the simulation.