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
Default implementation where desired speed and headway are pre-calculated for car-following.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Field Summary
Fields inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel
CAR_FOLLOWING_MODEL
-
Constructor Summary
ConstructorDescriptionAbstractCarFollowingModel
(DesiredHeadwayModel desiredHeadwayModel, DesiredSpeedModel desiredSpeedModel) -
Method Summary
Modifier and TypeMethodDescriptionfinal org.djunits.value.vdouble.scalar.Length
desiredHeadway
(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed) Determines the desired headway in equilibrium conditions, i.e. no speed difference with the leader.final org.djunits.value.vdouble.scalar.Speed
desiredSpeed
(org.opentrafficsim.base.parameters.Parameters parameters, SpeedLimitInfo speedInfo) Determines the desired speed.protected abstract org.djunits.value.vdouble.scalar.Acceleration
followingAcceleration
(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Speed desiredSpeed, org.djunits.value.vdouble.scalar.Length desiredHeadway, PerceptionIterable<? extends Headway> leaders) Determination of car-following acceleration, possibly based on multiple leaders.final org.djunits.value.vdouble.scalar.Acceleration
followingAcceleration
(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed, SpeedLimitInfo speedLimitInfo, PerceptionIterable<? extends Headway> leaders) Determination of car-following acceleration, possibly based on multiple leaders.final void
init
(LaneBasedGtu gtu) Initialize car-following model.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 Details
-
AbstractCarFollowingModel
public AbstractCarFollowingModel(DesiredHeadwayModel desiredHeadwayModel, DesiredSpeedModel desiredSpeedModel) - Parameters:
desiredHeadwayModel
- DesiredHeadwayModel; desired headway modeldesiredSpeedModel
- DesiredSpeedModel; desired speed model
-
-
Method Details
-
desiredHeadway
public final org.djunits.value.vdouble.scalar.Length desiredHeadway(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed) throws org.opentrafficsim.base.parameters.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:
org.opentrafficsim.base.parameters.ParameterException
- if parameter exception occurs
-
desiredSpeed
public final org.djunits.value.vdouble.scalar.Speed desiredSpeed(org.opentrafficsim.base.parameters.Parameters parameters, SpeedLimitInfo speedInfo) throws org.opentrafficsim.base.parameters.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:
org.opentrafficsim.base.parameters.ParameterException
- if parameter exception occurs
-
followingAcceleration
public final org.djunits.value.vdouble.scalar.Acceleration followingAcceleration(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed, SpeedLimitInfo speedLimitInfo, PerceptionIterable<? extends Headway> leaders) throws org.opentrafficsim.base.parameters.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:
org.opentrafficsim.base.parameters.ParameterException
- if parameter exception occurs
-
followingAcceleration
protected abstract org.djunits.value.vdouble.scalar.Acceleration followingAcceleration(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed, org.djunits.value.vdouble.scalar.Speed desiredSpeed, org.djunits.value.vdouble.scalar.Length desiredHeadway, PerceptionIterable<? extends Headway> leaders) throws org.opentrafficsim.base.parameters.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:
org.opentrafficsim.base.parameters.ParameterException
- if parameter exception occurs
-
toString
-
init
Initialize car-following model.- Specified by:
init
in interfaceCarFollowingModel
- Specified by:
init
in interfaceInitialisable
- Parameters:
gtu
- LaneBasedGtu; gtu
-