# A Microscopic On-Ramp Model Based on Macroscopic Network Flows
## 2 Methods
### Transformation to Microscopic Model  
We consider a car-following model that determines the vehicle accelerations, which we denote as \(a\), based on the longitudinal positions (\(x\)), velocities (\(v\)), and vehicle lengths (\(L\)) of a vehicle pair (leader with index \(L\) and follower with index \(F\) on the same lane), i.e.,  
\[a_{F}=f(x_{L},x_{F},v_{L},v_{F},L_{L},L_{F}), \tag{4}\]  
where the function \(f\) is specified below. A car-following model combines Equation (4) with the kinematic relationships \(a_{F}=v_{F}\) and \(v_{F}=x_{F}\), giving rise to a system of ordinarydifferential equations (ODEs) [37]. After discretizing these relations in time, the model is stated using the ballistic update formulas for speed and position of a follower; see, e.g., [38]:  
\[v_{F}(t+\Delta t) =v_{F}(t)+a_{F}(t)\Delta t, \tag{5}\] \[x_{F}(t+\Delta t) =x_{F}(t)+\frac{\Delta t}{2}(v_{F}(t)+v_{F}(t+\Delta t)). \tag{6}\]  
In the following, we include information from the macroscopic model in the car-following model (5). Therefore, we note the following relations: the flow is the inverse of the mean (gross) time headway (\(Q=1/T\)) at a specific location, i.e., the difference between the times when two subsequent vehicles reach a fixed reference point. The density is the inverse of the mean (gross) spacing (\(\rho=1/S\)) at a specific time, and the spacing \(S\) here refers to the difference between the positions of two subsequent vehicles. The macroscopic fundamental equation of traffic flow (\(Q=v\rho\)) thus takes the following form:  
\[v=\frac{S}{T}. \tag{7}\]  
Equation (7) holds for the mean speed, spacing, and time headway, as well as for the speed, spacing, and time headway of individual vehicles. We use the equation to model the speed of microscopic vehicles within a predefined stretch of road at the time \(t+\Delta t\) from the spacing and the flow at time t, as predicted by the macroscopic model:  
\[\bar{v}_{F}(t)=S(t)\,Q(t)=\bigg{(}x_{L}(t)-x_{F}(t)-\frac{L_{L}+L_{F}}{2} \bigg{)}Q(t). \tag{8}\]  
Here, \(L_{L}\) and \(L_{F}\) denote the lengths of the leading and the following vehicles, respectively. The flow is obtained using (3). As a macroscopic quantity, the flow is the same for all vehicles at the considered stretch of road, but the spacing may be different depending on the traffic conditions at time t. Taking into account Equation (7), the speed of the vehicles on the stretch may differ. The flow \(Q(t)\) in (8) is obtained from the macroscopic coupling model (3) using densities computed from the current vehicle positions on the on-ramp as input. To avoid sudden speed changes, we model the acceleration using the Full Velocity Difference Model (FVDM) by [17] using the formula  
\[a_{F}(t)=\frac{\bar{v}_{F}(t)-v_{F}(t)}{\tau}-\lambda(v_{F}(t)-v_{L}(t)). \tag{9}\]  
The first term accounts for vehicle acceleration proportional to the difference between its current speed and the target speed. The second term introduces a reduction proportional to the speed difference between leader and follower to avoid collisions if the leader is very slow. In Equation (9), the adaptation time that determines the sensitivity to speed differences between the current and the modeled speed is denoted by \(\tau\), and the sensitivity to speed differences between leader and follower is denoted by \(\lambda\). Note that we only adopt the principle of the FVDM, but we employ the speed \(\bar{v}_{F}\) from the macroscopic model. Unlike the macroscopic model, the microscopic car-following model allows for different accelerations for each vehicle. For segments 2 and 3 (see Figure 2 bottom), where vehicles mainly follow the leader on the same lane, this model can be directly applied. For the on-ramp (segment 1), however, there are two additional phenomena that require modifications: (1) vehicles on the entry lane adapt their speed and spacing to the vehicles on the adjacent through lane, and (2) vehicles on the through lane may reduce their speed and increase the gap when a vehicle on the on-ramp wants to merge.