Class SequentialFixedAccelerationModel

java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.following.AbstractGtuFollowingModelMobil
org.opentrafficsim.road.gtu.lane.tactical.following.SequentialFixedAccelerationModel
All Implemented Interfaces:
Serializable, CarFollowingModel, DesiredHeadwayModel, DesiredSpeedModel, GtuFollowingModelOld, Initialisable

public class SequentialFixedAccelerationModel extends AbstractGtuFollowingModelMobil implements Serializable
Extended version of FixedAccelerationModel. The addition is that this GtuFollowingModel stores a series of acceleration and duration values. Mostly used for testing.

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:
Alexander Verbraeck, Peter Knoppers
See Also:
  • Constructor Details

    • SequentialFixedAccelerationModel

      public SequentialFixedAccelerationModel(OtsSimulatorInterface simulator, org.djunits.value.vdouble.scalar.Acceleration maximumSafeDeceleration)
      Construct a SequentialFixedAccelerationModel with empty list of FixedAccelerationModel steps.
      Parameters:
      simulator - OtsSimulatorInterface; the simulator (needed to obtain the current simulation time)
      maximumSafeDeceleration - Acceleration; specified maximum safe deceleration
    • SequentialFixedAccelerationModel

      public SequentialFixedAccelerationModel(OtsSimulatorInterface simulator, org.djunits.value.vdouble.scalar.Acceleration maximumSafeDeceleration, Set<FixedAccelerationModel> steps)
      Construct a SequentialFixedAccelerationModel and load it with a list of FixedAccelerationModel steps.
      Parameters:
      simulator - OtsSimulatorInterface; the simulator (needed to obtain the current simulation time)
      maximumSafeDeceleration - Acceleration; specified maximum safe deceleration
      steps - Set<FixedAccelerationModel>; the list of FixedAccelerationModel steps.
  • Method Details

    • addStep

      Add one FixedAccelerationModel step to this SequentialFixedAccelerationModel.
      Parameters:
      step - FixedAccelerationModel; the step to add
      Returns:
      SequentialFixedAccelerationModel; this modified SequentialFixedAccelerationModel
    • size

      public final int size()
      Retrieve the number of FixedAccelerationModel steps in this SequentialFixedAccelerationModel.
      Returns:
      int; the number of steps in this SequentialFixedAccelerationModel
    • get

      public final FixedAccelerationModel get(int index)
      Retrieve one FixedAccelerationModel step.
      Parameters:
      index - int; the index of the retrieved FixedAccelerationModel step
      Returns:
      FixedAccelerationModel
    • timeAfterCompletionOfStep

      public final org.djunits.value.vdouble.scalar.Time timeAfterCompletionOfStep(int index)
      Retrieve the simulation time at the end of the Nth step of this SequentialFixedAccelerationModel.
      Parameters:
      index - int; the step
      Returns:
      Time
    • computeAcceleration

      public final org.djunits.value.vdouble.scalar.Acceleration computeAcceleration(org.djunits.value.vdouble.scalar.Speed followerSpeed, org.djunits.value.vdouble.scalar.Speed followerMaximumSpeed, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Speed speedLimit)
      Compute the acceleration that would be used to follow a leader.
      Specified by:
      computeAcceleration in interface GtuFollowingModelOld
      Parameters:
      followerSpeed - Speed; the speed of the follower at the current time
      followerMaximumSpeed - Speed; the maximum speed that the follower is capable of driving at
      leaderSpeed - Speed; the speed of the follower at the current time
      headway - Length; the net headway (distance between the front of the follower to the rear of the leader) at the current time, or the maximum distance we can cover at the current time, e.g. as the result of a lane drop
      speedLimit - Speed; the local speed limit
      Returns:
      Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following model
    • computeAcceleration

      public final org.djunits.value.vdouble.scalar.Acceleration computeAcceleration(org.djunits.value.vdouble.scalar.Speed followerSpeed, org.djunits.value.vdouble.scalar.Speed followerMaximumSpeed, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Duration stepSize)
      Compute the acceleration that would be used to follow a leader.
      Specified by:
      computeAcceleration in interface GtuFollowingModelOld
      Parameters:
      followerSpeed - Speed; the speed of the follower at the current time
      followerMaximumSpeed - Speed; the maximum speed that the follower is capable of driving at
      leaderSpeed - Speed; the speed of the follower at the current time
      headway - Length; the net headway (distance between the front of the follower to the rear of the leader) at the current time, or the maximum distance we can cover at the current time, e.g. as the result of a lane drop
      speedLimit - Speed; the local speed limit
      stepSize - Duration; given step size, which can be longer or shorter than the provided step size in the algorithms.
      Returns:
      Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following model
    • getMaximumSafeDeceleration

      public final org.djunits.value.vdouble.scalar.Acceleration getMaximumSafeDeceleration()
      Return the maximum safe deceleration for use in gap acceptance models. This is the deceleration that may be enforced upon a new follower due to entering a road or changing into an adjacent lane. The result shall be a positive value. In most car following models this value is named b.
      Specified by:
      getMaximumSafeDeceleration in interface GtuFollowingModelOld
      Returns:
      Acceleration; must be a positive value!
    • getStepSize

      public final org.djunits.value.vdouble.scalar.Duration getStepSize()
      Return the standard step size of this GTU following model.
      Specified by:
      getStepSize in interface GtuFollowingModelOld
      Returns:
      Duration; the standard step size of the GTU following model
    • getName

      public final String getName()
      Return the name of the car-following model.
      Specified by:
      getName in interface CarFollowingModel
      Returns:
      name of the car-following model
    • getLongName

      public final String getLongName()
      Return the complete name of the car-following model.
      Specified by:
      getLongName in interface CarFollowingModel
      Returns:
      complete name of the car-following model
    • setA

      public final void setA(org.djunits.value.vdouble.scalar.Acceleration a)
      Set value of acceleration parameter.
      Specified by:
      setA in interface GtuFollowingModelOld
      Parameters:
      a - Acceleration; value to set
    • setT

      public final void setT(org.djunits.value.vdouble.scalar.Duration t)
      Set value of desired headway.
      Specified by:
      setT in interface GtuFollowingModelOld
      Parameters:
      t - Duration; desired headway
    • setFspeed

      public final void setFspeed(double fSpeed)
      Set value of desired speed factor.
      Specified by:
      setFspeed in interface GtuFollowingModelOld
      Parameters:
      fSpeed - double; desired speed factor
    • 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
    • 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
    • followingAcceleration

      public final org.djunits.value.vdouble.scalar.Acceleration followingAcceleration(org.opentrafficsim.base.parameters.Parameters parameters, org.djunits.value.vdouble.scalar.Speed speed, SpeedLimitInfo speedInfo, 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
      speedInfo - 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
    • toString

      public final String toString()
      Overrides:
      toString in class Object