Class AbstractCarFollowingModel
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.tactical.following.AbstractCarFollowingModel
-
- All Implemented Interfaces:
CarFollowingModel
,DesiredHeadwayModel
,DesiredSpeedModel
,Initialisable
- Direct Known Subclasses:
AbstractIDM
,ToledoCarFollowing
public abstract class AbstractCarFollowingModel extends Object implements CarFollowingModel
Default implementation where desired speed and headway are pre-calculated for car-following.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 Apr 2016
- Author:
- Wouter Schakel
-
-
Field Summary
-
Fields inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel
CAR_FOLLOWING_MODEL
-
-
Constructor Summary
Constructors Constructor Description AbstractCarFollowingModel(DesiredHeadwayModel desiredHeadwayModel, DesiredSpeedModel desiredSpeedModel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Length
desiredHeadway(Parameters parameters, Speed speed)
Determines the desired headway in equilibrium conditions, i.e.Speed
desiredSpeed(Parameters parameters, SpeedLimitInfo speedInfo)
Determines the desired speed.protected abstract Acceleration
followingAcceleration(Parameters parameters, Speed speed, Speed desiredSpeed, Length desiredHeadway, PerceptionIterable<? extends Headway> leaders)
Determination of car-following acceleration, possibly based on multiple leaders.Acceleration
followingAcceleration(Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, PerceptionIterable<? extends Headway> leaders)
Determination of car-following acceleration, possibly based on multiple leaders.void
init(LaneBasedGTU gtu)
Initialize car-following model.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel
getLongName, getName
-
-
-
-
Constructor Detail
-
AbstractCarFollowingModel
public AbstractCarFollowingModel(DesiredHeadwayModel desiredHeadwayModel, DesiredSpeedModel desiredSpeedModel)
- Parameters:
desiredHeadwayModel
- DesiredHeadwayModel; desired headway modeldesiredSpeedModel
- DesiredSpeedModel; desired speed model
-
-
Method Detail
-
desiredHeadway
public final Length desiredHeadway(Parameters parameters, Speed speed) throws ParameterException
Determines the desired headway in equilibrium conditions, i.e. no speed difference with the leader.- Specified by:
desiredHeadway
in interfaceDesiredHeadwayModel
- Parameters:
parameters
- Parameters; parametersspeed
- Speed; speed to determine the desired headway at- Returns:
- desired headway
- Throws:
ParameterException
- if parameter exception occurs
-
desiredSpeed
public final Speed desiredSpeed(Parameters parameters, SpeedLimitInfo speedInfo) throws ParameterException
Determines the desired speed.- Specified by:
desiredSpeed
in interfaceDesiredSpeedModel
- Parameters:
parameters
- Parameters; parametersspeedInfo
- SpeedLimitInfo; info regarding the desired speed for car-following- Returns:
- desired speed
- Throws:
ParameterException
- if parameter exception occurs
-
followingAcceleration
public final Acceleration followingAcceleration(Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, PerceptionIterable<? extends Headway> leaders) throws ParameterException
Determination of car-following acceleration, possibly based on multiple leaders. The implementation should be able to deal with:
- The current speed being higher than the desired speed.
- The headway being negative.
- Specified by:
followingAcceleration
in interfaceCarFollowingModel
- Parameters:
parameters
- Parameters; parametersspeed
- Speed; current speedspeedLimitInfo
- SpeedLimitInfo; info regarding the desired speed for car-followingleaders
- PerceptionIterable<? extends Headway>; set of leader headways and speeds, ordered by headway (closest first)- Returns:
- car-following acceleration
- Throws:
ParameterException
- if parameter exception occurs
-
followingAcceleration
protected abstract Acceleration followingAcceleration(Parameters parameters, Speed speed, Speed desiredSpeed, Length desiredHeadway, PerceptionIterable<? extends Headway> leaders) throws ParameterException
Determination of car-following acceleration, possibly based on multiple leaders.- Parameters:
parameters
- Parameters; parametersspeed
- Speed; current speeddesiredSpeed
- Speed; desired speeddesiredHeadway
- Length; desired headwayleaders
- PerceptionIterable<? extends Headway>; set of leader headways (guaranteed positive) and speeds, ordered by headway (closest first)- Returns:
- car-following acceleration
- Throws:
ParameterException
- if parameter exception occurs
-
init
public final void init(LaneBasedGTU gtu)
Initialize car-following model.- Specified by:
init
in interfaceCarFollowingModel
- Specified by:
init
in interfaceInitialisable
- Parameters:
gtu
- LaneBasedGTU; gtu
-
-