# Optimization of Cellular Automata Model for Moving Bottlenecks in Urban Roads
## 2 A Cellular Automaton Model for Urban Roads Considering Vehicle Heterogeneity
### Vehicle Update Rules for Road Segments
#### 2.2.1 Safe Distance Model
The safety distance model primarily focuses on vehicle-following and braking processes, and there are three types of driving safety distances: safety distance for accelerating vehicles \(L_{sa}\), safety distance for maintaining speed vehicles \(L_{sk}\), and safety distance for decelerating vehicles \(L_{sd}\). Below, we will analyze the safety distance for accelerating vehicles \(L_{sa}\) as an example:  
1. Assuming at time \(t\), the distance between the leading vehicle and the following vehicle is \(L_{n}(t)\), the following vehicle updates its position with a speed of \((v_{n}(t)+a_{n})\). At the same moment, due to a sudden situation, the leading vehicle initiates emergency braking with a deceleration of \(E_{n-1}\) and updates its position based on its speed \((v_{n-1}(t)-E_{n-1})\) until it comes to a complete stop. To avoid a rear-end collision, the following vehicle also initiates emergency braking and decelerates until it comes to a complete stop. Assuming that the leading vehicle comes to a stop at time \(t+\Delta t_{n-1}\), the following vehicle comes to a stop at time \(t+\Delta t_{n}\) (generally \(\Delta t_{n-1}\
eq\Delta t_{n}\)), and during the process of emergency braking until both vehicles come to a complete stop, they just barely avoid a collision. Based on the above analysis, the distance \(L_{n}(t)\) between the two vehicles at time \(t\) represents the critical safety distance \(L_{sa}\) for the following vehicle to decelerate safely. This critical safety distance \(L_{sa}\) can be calculated. Assuming that both the vehicle in front and the vehicle behind have ceased moving at time \(t+\Delta t\), then  
\[\Delta t=max(\Delta t_{n-1},\Delta t_{n}) \tag{5}\]  
Between the time \(t\) and the time \(t+\Delta t\), the cumulative driving distances of the leading vehicle and the trailing vehicle within each time step \(t+j\) are summed up, and the calculation expression is as follows:  
\[L_{l}(j)=\sum_{i=0}^{j}[max(0,v_{n-1}(t)-E_{n-1}-iE_{n-1})] \tag{6}\]  
\[L_{f}(j)=L_{r}+L_{b}+L_{u}+\sum_{i=0}^{j}[max(0,v_{n}(t)+a_{n}-iE_{n})] \tag{7}\]  
among them, \(j=0,1,2\), \(\Delta t\). According to the definition, the maximum difference between the cumulative driving distances of the following vehicle and the preceding vehicle is the critical safe distance, and its expression is as follows:  
\[L_{sa}(t)=max\Big{(}L_{f}(j)-L_{l}(j)\Big{)} \tag{8}\]  
From the above formula, we can obtain that  
\[L_{sa}(t)=max\left\{ \begin{array}{l}L_{r}+L_{b}+L_{u}+\sum\limits_{i=0}^{j}[ max(0,v_{n}(t)+a_{n}-iE_{n})]-\\ \sum\limits_{i=0}^{j}[max(0,v_{n-1}(t)-E_{n-1}-iE_{n-1})]\end{array} \right\} \tag{9}\]  
For the convenience of subsequent descriptions in this paper, we define the expression for \(L_{sa}(t)\) as follows:  
\[L_{sa}(t)=f(L_{r},L_{b},L_{u};v_{n}(t)+a_{n},E_{n};v_{n-1}(t)-E_{n-1},E_{n-1}) \tag{10}\]  
Therefore, when the distance between the following vehicle and the leading vehicle satisfies the condition \(L_{n}(t)\geq L_{sa}(t)\), the following vehicle can accelerate; when \(L_{n}(t)<L_{sa}(t)\), to prevent a collision, the following vehicle should not accelerate. 2. The calculation process for the safe distance \(L_{sk}\) when a car maintains its speed is similar to that for the safe distance \(L_{sa}\) when a car accelerates. The difference lies in that, at time \(t\), the position of the car behind is updated based on its current speed \(v_{n}(t)\). By analogy to the calculation process of \(L_{sd}(t)\), we can derive the expression for \(L_{sk}(t)\) as follows:  
\[L_{sk}(t)=f(L_{r},L_{b},L_{u};v_{n}(t),E_{n};v_{n-1}(t)-E_{n-1},E_{n-1}) \tag{11}\]  
Therefore, when the distance between the following vehicle and the leading vehicle satisfies the condition \(L_{sk}(t)\leq L_{n}(t)<L_{sa}(t)\), the following vehicle can maintain its current speed; when \(L_{n}(t)<L_{sk}(t)\), in order to avoid a collision, the following vehicle needs to decelerate. 3.