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-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

    Constructors
    Constructor
    Description
    AbstractCarFollowingModel(DesiredHeadwayModel desiredHeadwayModel, DesiredSpeedModel desiredSpeedModel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final 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
    Initialize car-following model.

    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 model
      desiredSpeedModel - 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 interface DesiredHeadwayModel
      Parameters:
      parameters - Parameters; parameters
      speed - 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 interface DesiredSpeedModel
      Parameters:
      parameters - Parameters; parameters
      speedInfo - 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 interface CarFollowingModel
      Parameters:
      parameters - Parameters; parameters
      speed - Speed; current speed
      speedLimitInfo - SpeedLimitInfo; info regarding the desired speed for car-following
      leaders - 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; parameters
      speed - Speed; current speed
      desiredSpeed - Speed; desired speed
      desiredHeadway - Length; desired headway
      leaders - 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

      public String toString()
      Overrides:
      toString in class Object
    • init

      public final void init(LaneBasedGtu gtu)
      Initialize car-following model.
      Specified by:
      init in interface CarFollowingModel
      Specified by:
      init in interface Initialisable
      Parameters:
      gtu - LaneBasedGtu; gtu