# Early Gapping and Platoon Merging Strategies for Autonomous Vehicles using Local Controllers
## 2 Methods
### Gap Profile Method  
In this study, we assume that the portion of the road \(0\leq x\leq L\) in interest is equipped with RSUs distributed along the road, transmitting to the vehicle receivers the desired gap profile \(g_{d}(x)\) at their current location \(x\). RSUs are assumed to be distributed, such that they may enable a realization of sufficiently smooth gap profiles. Specific technological solutions for this are out of the scope of this study.  
We assume that the entire line of vehicles in the road (each of length \(l_{i}\)) drive at speed \(v_{s}\), which we set as the road speed limit. To allow merging, vehicles should open a gap large enough for new vehicles to merge. To increase the gap from the vehicle ahead (vehicle \(i-1\)), the speed of vehicle \(i\) must be lower than the speed of vehicle \(i-1\). The way that vehicle \(i\) decelerates is governed by a gap profile, i.e., the deceleration is set according to the desired \(g_{d}(x)\). The \(i\)-th vehicle at \(x_{i}(t)\) compares its current gap:  
\[g_{i}(t)=x_{i-1}(t)-l_{i-1}-x_{i}(t) \tag{1}\]  
with the desired gap \(g_{d}(x=x_{i})\). Thus, to acquire \(g_{d}(x=x_{i})\) the required deceleration \(a_{i,d}(t)\) within a time interval \(\Delta t\) is:  
\[a_{i}(t)=\frac{2(g_{i}(t)-g_{d}(t)+[v_{i-1}(t)-v_{i}(t)]\Delta t)}{\Delta t^{ 2}} \tag{2}\]  
Figure 1: Schematic description of AVs in a merging site with RSUs, defining the length (\(l_{i}\)) of the \(i\)-th vehicle, the gap size (\(g_{i}\)) between vehicles \(i\) and \(i-1\). The vehicles’ locations and speeds are marked by \(x_{i}\), \(x_{i-1}\) and \(v_{i}\), \(v_{i-1}\), respectively, and the total preparation distance is marked by \(x_{merge}\). The gap is the distance between the front of vehicle \(i\) to the end of vehicle \(i-1\).  
The deceleration is limited to the vehicle's maximal deceleration capabilities (and perhaps also to passenger comfort) and is also limited by the need to maintain a safety gap between vehicles. To prevent collision between the vehicles, the deceleration should also comply with the following safety conditions [22; 23; 24]:  
1. The current gap should be larger than the previous gap, i.e., \(g_{i}(t)>g_{i}(t-\Delta t)\).
2. The gap should be larger than a safety gap \(g_{s}\), i.e., \(g_{i}(t)>g_{s}(v_{i}(t))\).  
If one of these conditions is not met, then the following Proportional-Differential (PD) controlled deceleration will be calculated:  
\[a_{i,control}(t)=K_{P}[g_{i}(t)-g_{s}(v_{i}(t))]+K_{D}\frac{g_{i}(t)-g_{i}(t- \Delta t)}{\Delta t} \tag{3}\]  
where \(K_{P}\) and \(K_{D}\) are the proportional and derivative positive constants, respectively, and \(g_{s}(v_{i}(t))\) is the safety gap (also known as allowed gap), which changes according to the speed of vehicle \(i\). Equation (3) should suffice in most cases to prevent a collision. Since each vehicle has its mechanical limitations, a uniform safety time gap \(g_{s}(v_{i}(t))=T_{s}\cdot v_{i}(t)\) was used, where \(T_{s}\) is the predefined safety time gap and is measured in seconds (as the _two-second rule_).  
After calculating the control deceleration Equation (3), the deceleration applied is confined to the maximal acceleration and deceleration of the vehicle \(a_{i\text{-}vehicle}\):  
\[a_{i}(t)=max\big{\{}min\big{\{}a_{i,d}(t),a_{i,control}(t)\big{\}},a_{i,vehicle} \big{\}} \tag{4}\]  
More involved control schemes may be considered, but for the sake of simplicity, the above scheme was chosen to demonstrate our suggested approach.  
Having \(a_{i}(t)\), one can find the speed \(v_{i}(t+Dt)\) and the position \(x_{i}(t+Dt)\) at the following time step, which must comply with the maximal speed.