Class CarFollowingUtil
- java.lang.Object
- 
- org.opentrafficsim.road.gtu.lane.tactical.util.CarFollowingUtil
 
- 
 public final class CarFollowingUtil extends Object Static methods regarding car-following for composition in tactical planners.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. 
 BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version May 23, 2016 
- Author:
- Alexander Verbraeck, Wouter Schakel
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classCarFollowingUtil.CarFollowingHeadwaySimple headway implementation for minimum car-following information.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static AccelerationapproachTargetSpeed(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, Length distance, Speed targetSpeed)Returns an acceleration based on the car-following model in order to adjust the speed to a given value at some location ahead.static AccelerationconstantAccelerationStop(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, Length distance)Return constant acceleration in order to stop in specified distance.static AccelerationfollowSingleLeader(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, Length distance, Speed leaderSpeed)Follow a set of headway GTUs.static AccelerationfollowSingleLeader(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, HeadwayGTU leader)Follow a set of headway GTUs.static AccelerationfreeAcceleration(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo)Calculate free acceleration.static Accelerationstop(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, Length distance)Stop within given distance.
 
- 
- 
- 
Method Detail- 
followSingleLeaderpublic static Acceleration followSingleLeader(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, Length distance, Speed leaderSpeed) throws ParameterException Follow a set of headway GTUs.- Parameters:
- carFollowingModel- CarFollowingModel; car-following model
- parameters- Parameters; parameters
- speed- Speed; current speed
- speedLimitInfo- SpeedLimitInfo; speed limit info
- distance- Length; distance
- leaderSpeed- Speed; speed of the leader
- Returns:
- acceleration for following the leader
- Throws:
- ParameterException- if a parameter is not given or out of bounds
 
 - 
followSingleLeaderpublic static Acceleration followSingleLeader(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, HeadwayGTU leader) throws ParameterException Follow a set of headway GTUs.- Parameters:
- carFollowingModel- CarFollowingModel; car-following model
- parameters- Parameters; parameters
- speed- Speed; current speed
- speedLimitInfo- SpeedLimitInfo; speed limit info
- leader- HeadwayGTU; leader
- Returns:
- acceleration for following the leader
- Throws:
- ParameterException- if a parameter is not given or out of bounds
 
 - 
stoppublic static Acceleration stop(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, Length distance) throws ParameterException Stop within given distance.- Parameters:
- carFollowingModel- CarFollowingModel; car-following model
- parameters- Parameters; parameters
- speed- Speed; current speed
- speedLimitInfo- SpeedLimitInfo; speed limit info
- distance- Length; distance to stop over
- Returns:
- acceleration to stop over distance
- Throws:
- ParameterException- if a parameter is not given or out of bounds
 
 - 
constantAccelerationStoppublic static Acceleration constantAccelerationStop(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, Length distance) throws ParameterException Return constant acceleration in order to stop in specified distance. The car-following model is used to determine the stopping distance (i.e. distance remaining at stand still, e.g. 1-3m).- Parameters:
- carFollowingModel- CarFollowingModel; car-following model
- parameters- Parameters; parameters
- speed- Speed; current speed
- distance- Length; distance to stop over
- Returns:
- constant acceleration in order to stop in specified distance
- Throws:
- ParameterException- on missing parameter
 
 - 
freeAccelerationpublic static Acceleration freeAcceleration(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo) throws ParameterException Calculate free acceleration.- Parameters:
- carFollowingModel- CarFollowingModel; car-following model
- parameters- Parameters; parameters
- speed- Speed; current speed
- speedLimitInfo- SpeedLimitInfo; speed limit info
- Returns:
- acceleration free acceleration
- Throws:
- ParameterException- if a parameter is not given or out of bounds
 
 - 
approachTargetSpeedpublic static Acceleration approachTargetSpeed(CarFollowingModel carFollowingModel, Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, Length distance, Speed targetSpeed) throws ParameterException Returns an acceleration based on the car-following model in order to adjust the speed to a given value at some location ahead. This is done by placing a virtual vehicle somewhere near the location. Both the location and speed of this virtual vehicle are dynamically adjusted to resemble a car-following situation. To explain, first consider the situation where a virtual vehicle is placed at the target speed and such that the equilibrium headway is in line with the location:___ location of target speed --)| ___ |___|(--------------s--------------) (--h--)|___| ))) vTar Here,sis the distance to the target speed, andhis the desired headway if the vehicle would drive at the target speedvTar.
 
 In this way car-following models will first underestimate the required deceleration, as the virtual vehicle is actually stationary and does not move withvTarat all. Because of this underestimation, strong deceleration is required later. This behavior is not in line with the sensitivity parameters of the car-following model.
 
 To correct for the fact that the virtual vehicle is actually not moving, the speed difference should be larger, i.e. the speed of the virtual vehiclevTar'should be lower. We require:- if v = vTarthenvTar' = vTar, otherwise there is an incentive to accelerate or decelerate for no good reason
- if vTar ~ 0thenvTar' ~ 0, as car-following models are suitable for stopping and need no additional incentive to decelerate in such cases
- if 0 < vTar < vthenvTar' < vTar, introducing additional deceleration to compensate for the fact that the virtual vehicle does not move
 vTar' = vTar * (vTar/v) = vTar^2/v.
 
 Furthermore, ifv < vTarwe getvTar' > vTarleading to additional acceleration. Acceleration is then appropriate, and possibly limited by a free term in the car-following model.
 
 The virtual vehicle is thus placed with speedvTar'at a distances + h'whereh'is the desired headway if the vehicle would drive at speedvTar'. BothvTar'andh'depend on the current speed of the vehicle, so the virtual vehicle in this case actually moves, but not withvTar.
 
 This approach has been tested with the IDM+ to deliver decelerations in line with the parameters. On a plane with initial speed ranging from 0 to 33.33m/s and a target speed in 300m also ranging from 0 to 33.33m/s, strongest deceleration is equal to the car-following model stopping from 33.33m/s to a stand-still vehicle in 300m (+ stopping distance of 3m). Throughout the plane the maximum deceleration of each scenario is close to this value, unless the initial speed is so low, and the target speed is so high, that such levels of deceleration are never required.
 - Parameters:
- carFollowingModel- CarFollowingModel; car-following model to use
- parameters- Parameters; parameters
- speed- Speed; current speed
- speedLimitInfo- SpeedLimitInfo; info regarding the desired speed for car-following
- distance- Length; distance to the location of the target speed
- targetSpeed- Speed; target speed
- Returns:
- acceleration acceleration based on the car-following model in order to adjust the speed
- Throws:
- ParameterException- if parameter exception occurs
- NullPointerException- if any input is null
- IllegalArgumentException- if the distance or target speed is not at least 0
 
- if 
 
- 
 
-