# Non-Compliant Behaviour of Automated Vehicles in a Mixed Traffic Environment
## 3 Implementation of Automated Driving Functions in Microscopic Simulation
### Trajectory Planning Algorithm
The minimum required distance to a vehicle in front on the target lane is calculated using the current velocity of the ego vehicle \(\mathrm{v_{ego}}\), combined with a time gap \(\mathrm{\tau_{min}}\) and an offset \(\mathrm{c_{min}}\) at standstill:  
\[1(t=t_{0})=1_{0},\quad v_{lat,\,0}(t=t_{0})=v_{lat,0},\quad a_{lat}(t=t_{0})=a_{lat,0} \tag{2}\]6  
Similarly, the rearward safety distance to a vehicle approaching from behind in the target lane is computed using the velocity of the lag vehicle \(\mathrm{v_{lag}}\), a time gap \(\mathrm{\tau_{min}}\), and the clearance minimum \(\mathrm{c_{min}}\) at standstill:  
\[1(t=t_{0})=1_{0},\quad v_{lat,\,0}(t=t_{0})=v_{lat,0},\quad a_{lat}(t=t_{0})=a_{lat,0} \tag{2}\]7  
Reference values for the time gap \(\mathrm{\tau_{min}}\) and the distance \(\mathrm{c_{min}}\) can be found in the International Standard ISO 15622, which defines specifications for adaptive cruise control (ACC) systems. To evaluate whether a safe lane change is possible, the available space both in front of and behind the ego vehicle in the target lane must be assessed. The analysis distinguishes between four distinct situations, depending on the presence and position of surrounding vehicles relative to the ego vehicle's current state. If no relevant lead or lag vehicle is detected, the respective case is disregarded. The first two cases address the rearward environment, focusing on potential following vehicles in the target lane that may pose a conflict when changing lane. Case 1: \(\mathrm{v_{Lag}}^{*}<\mathrm{v_{ego}}\)  
In situations where the ego vehicle is traveling at a higher speed than a vehicle approaching from behind on the adjacent lane (see Figure 2), it must maintain at least the predefined safety distance (as defined in Equation (8)) before initiating a lane change. If the actual gap falls below this threshold, the lane change is considered unsafe and must be postponed. \[1(t=t_{0})=1_{0},\quad v_{lat,\,0}(t=t_{0})=v_{lat,0},\quad a_{lat}(t=t_{0})=a_{lat,0} \tag{2}\]8 Vehicles involved in a discretionary lane-change maneuver and definition of relevant variables. (*) denotes that the quantity refers to the surrounding vehicle in the target lane. Figure adapted from [41]. \[1(t=t_{0})=1_{0},\quad v_{lat,\,0}(t=t_{0})=v_{lat,0},\quad a_{lat}(t=t_{0})=a_{lat,0} \tag{2}\]9 Illustration of case 1. If the lag vehicle in the target lane is moving at a higher speed than the ego vehicle (see Figure 3), a predictive comparison of both vehicles' positions during the expected duration of the lane change must be conducted. This comparison ensures that a minimum safety buffer is maintained throughout the maneuver. \[1(t=t_{f})=1_{f},\quad v_{lat,\,f}(t=t_{f})=v_{lat,f},\quad a_{lat}(t =t_{f})=a_{lat,f}\]0  
\[1(t=t_{f})=1_{f},\quad v_{lat,\,f}(t=t_{f})=v_{lat,f},\quad a_{lat}(t =t_{f})=a_{lat,f}\]1  
with \(\mathrm{d_{Lag}}^{*}\) as the distance between the ego and the lag vehicle. The comparison of \(\mathrm{s_{Lag}}^{*}\) and \(\mathrm{s_{ego}}\) yields the following equation, which has to be true for safe lane-change maneuvers:  
\[1(t=t_{f})=1_{f},\quad v_{lat,\,f}(t=t_{f})=v_{lat,f},\quad a_{lat}(t =t_{f})=a_{lat,f}\]2  
Equation (11) considers the acceleration \(\mathrm{a_{ego}}\) of the ego vehicle and the deceleration of the lag vehicle in the target lane \(\mathrm{a_{Lag}}^{*}\). This formulation takes into account both the acceleration capabilities of the ego vehicle and the assumed deceleration behavior of the lag vehicle, denoted as \(\mathrm{a_{maxLag}}^{*}\), which reflects the maximum deceleration the lag vehicle is expected or permitted to apply in cooperative situations. The value of this accepted deceleration is critical from both a safety and traffic flow perspective. It directly influences how assertively an AV can merge with flowing traffic. The selection of this parameter is context-dependent and can vary with the urgency of the maneuver and the location on the road.