## 4 Model Formulation
### Middle-Layer Model
#### 4.2.1 Human-Driven Vehicle Delays  
A moving vehicle's delay time \(d_{j}^{hm}\) and a stationary vehicle's delay time \(d_{j}^{\text{hs}}\) are both included in the delay time \(d_{j}^{h}\) of HVs in barrier group \(j\):  
\[d_{j}^{h}=d_{j}^{hm}+d_{j}^{\text{hs}} \tag{5}\]  
A lane group is described in this work as one or more lanes of the same inlet lane with the same steering function. The term \(d_{j}^{hm}\) is the delay of all human-driven motion vehicles in barrier group \(j\), which is equal to the total of the delays of human-driven motion vehicles within each lane group. \[d_{j}^{hm}=\sum_{r=1}^{2}\sum_{p}^{2}d_{p,r,j}^{h}\ \ \forall p=1,2;r=1,2 \tag{6}\]  
where \(d_{p,r,j}^{h}\) denotes the delay of the barrier group \(j\) in the NEMA ring \(r\) during the \(P\) phase period. It can be reacted to by changing the queue length \(l_{p,r,j}\) of the lane group during the phase time, which can be calculated using the following equation:  
\[d_{p,r,j}^{h}=\sum_{t=t_{0}+s_{j}+u_{j}}^{t_{0}+s_{j}+u_{j}}l_{p,r,j}(t)\Delta t \tag{7}\]  
where \(t_{0}\) is the time step at the beginning of the optimization signal, \(l_{p,r,j}(t)\) is the queue length of the lane group at time \(t\) when the phase in NEMA ring \(r\) in barrier group \(j\) is \(P\), and the queue length at time \(t\) is jointly influenced by the cumulative vehicle arrival rate \(\tau_{p,r,j}(t)\) at time \(t\) and the cumulative vehicle dissipation rate \(\theta_{p,r,j}(t)\) at time \(t\). \[l_{p,r,j}(t)=l_{p,r,j}(t-1)+\tau_{p,r,j}(t)-\theta_{p,r,j}(t)\ \ \ \forall t=t_{0}+s_{j}+1,\cdots,t_{0}+s_{j}+u_{j} \tag{8}\]  
To calculate length \(l_{p,r,j}\) at any moment in the signal optimization process, it is necessary to determine length \(l_{p,r,j}\) at time \(t_{0}+s_{j}\), which is calculated using the following formula:  
\[l_{p,r,j}(t_{0}+s_{j})= \begin{cases}l_{p,r,j-1}\big{(}t_{0}+s_{j-1}+u_{j-1} \big{)},&if\ j\geq 2\\ l_{p,r,1}(t_{0})=l_{p,r,1}^{0},&if\ j=1\end{cases}  \tag{9}\]  
where \(l_{p,r,1}^{0}\) is the initial length of the queue at time \(t_{0}\). The cumulative vehicle arrival rate \(\tau_{p,r,j}(t)\) in Equation (8) is the arrival rate of HVs in barrier group \(j\) at time step \(t\) for NEMA ring \(r\) and phase \(P\). This value is determined  
Figure 9: Backwards recursion flow chart. by the arrival rate \(\tau_{m}(t)\) of each moving vehicle in the direction of passage m. The arrival rate \(\tau_{m}(t)\) of each moving vehicle can be divided into a saturated arrival rate \(\tau_{m}^{s}(t)\) and an unsaturated arrival rate \(\tau_{m}^{r}(t)\):  
\[\tau_{p,r,j}^{s}=\sum_{m}\tau_{p,r,j}^{m}\tau_{m}^{s} \tag{10}\]  
\[\tau_{p,r,j}^{r}=\sum_{m}\tau_{p,r,j}^{m}\tau_{m}^{r} \tag{11}\]  
where \(\tau_{p,r,j}^{m}\) is defined to be 1 if the moving vehicle crosses the intersection under phase \(P\) of ring \(r\) of group \(j\) and 0 otherwise. The cumulative vehicle dissipation rate \(\theta_{p,r,j}(t)\) in Equation (8) is affected by the queue length and vehicle arrival rate, and considering the phase change, the cumulative vehicle dissipation rate \(\theta_{p,r,j}(t)\) is divided into \(\theta_{1,r,j}(t)\) and \(\theta_{2,r,j}(t)\) by phase:  
\[\theta_{1,r,j}(t)=\left\{ \begin{array}{l}min\Big{\{}\tau_{1,r,j}^{s}(t),l_{ 1,r,j}(t-1)+\tau_{1,r,j}^{r}(t)\Big{\}},\ if\ t_{0}+s_{j}<t\leq t_{0}+s_{j}+g_{ 1,j}\\ 0,\ \ \text{otherwise}\end{array} \right. \tag{12}\]  
\[\theta_{2,r,j}(t)=\left\{ \begin{array}{l}min\Big{\{}\tau_{2,r,j}^{s}(t),l_{ 2,r,j}(t-1)+\tau_{2,r,j}^{r}(t)\Big{\}},\ if\ t_{0}+s_{j}+g_{1,j}+\frac{R_{1,j}}{ \Delta t}<t\leq t_{0}+s_{j}+u_{j}-\frac{R_{2,j}}{\Delta t}\end{array} \right. \tag{13}\]  
where \(\frac{R_{p,j}}{\Delta t}\) should be an integer and \(g_{p,j}\) is the length of the green light during phase switching in phase \(j\).