Class AbstractGtuFollowingModelMobil
java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.following.AbstractGtuFollowingModelMobil
- All Implemented Interfaces:
- CarFollowingModel,- DesiredHeadwayModel,- DesiredSpeedModel,- GtuFollowingModelOld,- Initialisable
- Direct Known Subclasses:
- FixedAccelerationModel,- IdmOld,- IdmPlusOld,- SequentialFixedAccelerationModel
Code shared between various car following models. 
Note: many of the methods have a maxDistance, which may be "behind" the location of the next GTU, or stand-alone. Note that the maxDistance is equivalent to a GTU with zero speed, and not equivalent to a moving GTU.
Note: many of the methods have a maxDistance, which may be "behind" the location of the next GTU, or stand-alone. Note that the maxDistance is equivalent to a GTU with zero speed, and not equivalent to a moving GTU.
 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
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final DualAccelerationStepReturn value if lane change causes immediate collision.Fields inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModelCAR_FOLLOWING_MODEL
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal AccelerationStepcomputeAccelerationStep(org.djunits.value.vdouble.scalar.Speed followerSpeed, 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.Time currentTime) Compute the acceleration that would be used to follow a leader.final AccelerationStepcomputeAccelerationStep(org.djunits.value.vdouble.scalar.Speed followerSpeed, 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.Time currentTime, org.djunits.value.vdouble.scalar.Duration stepSize) Compute the acceleration that would be used to follow a leader.final AccelerationStepcomputeAccelerationStep(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit) Compute the acceleration that would be used to follow a leader.final AccelerationStepcomputeAccelerationStep(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Length maxDistance, 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.final AccelerationStepcomputeAccelerationStepWithNoLeader(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit) Compute the acceleration that would be used if the is not leader in sight.final AccelerationStepcomputeAccelerationStepWithNoLeader(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Duration stepSize) Compute the acceleration that would be used if the is not leader in sight.final DualAccelerationStepcomputeDualAccelerationStep(LaneBasedGtu referenceGTU, Collection<Headway> otherGTUs, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit) Compute the lowest accelerations (or most severe decelerations) that would be used if a referenceGTU is present (inserted, or not removed) in a set of other GTUs.
 If any GTU in the set of otherGTUs has a null headway (indicating that the other GTU is in fact parallel to the referenceGTU), prohibitive decelerations shall be returned.
 Two AccelerationStep values are returned in a DualAccelerationStep.
 or should slow down for a crossing from accelerating to unsafe speeds.final DualAccelerationStepcomputeDualAccelerationStep(LaneBasedGtu referenceGTU, Collection<Headway> otherHeadways, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Duration stepSize) Compute the lowest accelerations (or most severe decelerations) that would be used if a referenceGTU is present (inserted, or not removed) in a set of other GTUs.
 If any GTU in the set of otherGTUs has a null headway (indicating that the other GTU is in fact parallel to the referenceGTU), prohibitive decelerations shall be returned.
 Two AccelerationStep values are returned in a DualAccelerationStep.
 or should slow down for a crossing from accelerating to unsafe speeds.final org.djunits.value.vdouble.scalar.LengthminimumHeadway(org.djunits.value.vdouble.scalar.Speed followerSpeed, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length precision, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Speed followerMaximumSpeed) Compute the minimum net headway given the speed of the follower and the leader.
 At the returned headway, the follower would decelerate with it's maximum comfortable deceleration.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModelfollowingAcceleration, getLongName, getName, initMethods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.DesiredHeadwayModeldesiredHeadwayMethods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.DesiredSpeedModeldesiredSpeedMethods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.GtuFollowingModelOldcomputeAcceleration, computeAcceleration, getMaximumSafeDeceleration, getStepSize, setA, setFspeed, setT
- 
Field Details- 
TOODANGEROUSReturn value if lane change causes immediate collision.
 
- 
- 
Constructor Details- 
AbstractGtuFollowingModelMobilpublic AbstractGtuFollowingModelMobil()
 
- 
- 
Method Details- 
computeDualAccelerationSteppublic final DualAccelerationStep computeDualAccelerationStep(LaneBasedGtu referenceGTU, Collection<Headway> otherGTUs, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit) throws GtuException Compute the lowest accelerations (or most severe decelerations) that would be used if a referenceGTU is present (inserted, or not removed) in a set of other GTUs.
 If any GTU in the set of otherGTUs has a null headway (indicating that the other GTU is in fact parallel to the referenceGTU), prohibitive decelerations shall be returned.
 Two AccelerationStep values are returned in a DualAccelerationStep.
 or should slow down for a crossing from accelerating to unsafe speeds.- Specified by:
- computeDualAccelerationStepin interface- GtuFollowingModelOld
- Parameters:
- referenceGTU- LaneBasedGtu; the GTU for which the accelerations are computed
- otherGTUs- Collection<Headway>; the other GTUs. A negative headway value indicates that the other GTU is a follower. NB. If the referenceGTU is contained in this Collection, it is ignored.
- maxDistance- Length; 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:
- DualAccelerationStep; the result with the lowest accelerations (or most severe decelerations) of application of the GTU following model of the referenceGTU for each leader and follower
- Throws:
- GtuException- when the speed of the gtu cannot be determined
 
- 
computeDualAccelerationSteppublic final DualAccelerationStep computeDualAccelerationStep(LaneBasedGtu referenceGTU, Collection<Headway> otherHeadways, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Duration stepSize) throws GtuException Compute the lowest accelerations (or most severe decelerations) that would be used if a referenceGTU is present (inserted, or not removed) in a set of other GTUs.
 If any GTU in the set of otherGTUs has a null headway (indicating that the other GTU is in fact parallel to the referenceGTU), prohibitive decelerations shall be returned.
 Two AccelerationStep values are returned in a DualAccelerationStep.
 or should slow down for a crossing from accelerating to unsafe speeds.- Specified by:
- computeDualAccelerationStepin interface- GtuFollowingModelOld
- Parameters:
- referenceGTU- LaneBasedGtu; the GTU for which the accelerations are computed
- otherHeadways- Collection<Headway>; the other GTUs. A negative headway value indicates that the other GTU is a follower. NB. If the referenceGTU is contained in this Collection, it is ignored.
- maxDistance- Length; 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:
- DualAccelerationStep; the result with the lowest accelerations (or most severe decelerations) of application of the GTU following model of the referenceGTU for each leader and follower
- Throws:
- GtuException- when the speed of the gtu cannot be determined
 
- 
computeAccelerationSteppublic final AccelerationStep computeAccelerationStep(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit) throws GtuException Compute the acceleration that would be used to follow a leader.- Specified by:
- computeAccelerationStepin interface- GtuFollowingModelOld
- Parameters:
- gtu- LaneBasedGtu; the GTU for which acceleration is computed
- leaderSpeed- Speed; the speed of the leader
- headway- Length; the headway of the leader
- maxDistance- Length; 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:
- AccelerationStep; the result of application of the GTU following model
- Throws:
- GtuException- when the speed of the gtu cannot be determined
 
- 
computeAccelerationSteppublic final AccelerationStep computeAccelerationStep(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length headway, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Duration stepSize) throws GtuException Compute the acceleration that would be used to follow a leader.- Specified by:
- computeAccelerationStepin interface- GtuFollowingModelOld
- Parameters:
- gtu- LaneBasedGtu; the GTU for which acceleration is computed
- leaderSpeed- Speed; the speed of the leader
- headway- Length; the headway of the leader
- maxDistance- Length; 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:
- AccelerationStep; the result of application of the GTU following model
- Throws:
- GtuException- when the speed of the gtu cannot be determined
 
- 
computeAccelerationSteppublic final AccelerationStep computeAccelerationStep(org.djunits.value.vdouble.scalar.Speed followerSpeed, 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.Time currentTime) Compute the acceleration that would be used to follow a leader.- Specified by:
- computeAccelerationStepin interface- GtuFollowingModelOld
- Parameters:
- followerSpeed- Speed; the speed of the follower at the current time
- 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
- currentTime- Time; to be used to determine the validity of the AccelerationStep
- Returns:
- Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following model
 
- 
computeAccelerationSteppublic final AccelerationStep computeAccelerationStep(org.djunits.value.vdouble.scalar.Speed followerSpeed, 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.Time currentTime, org.djunits.value.vdouble.scalar.Duration stepSize) Compute the acceleration that would be used to follow a leader.- Specified by:
- computeAccelerationStepin interface- GtuFollowingModelOld
- Parameters:
- followerSpeed- Speed; the speed of the follower at the current time
- 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
- currentTime- Time; to be used to determine the validity of the AccelerationStep
- 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
 
- 
computeAccelerationStepWithNoLeaderpublic final AccelerationStep computeAccelerationStepWithNoLeader(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit) throws GtuException Compute the acceleration that would be used if the is not leader in sight.- Specified by:
- computeAccelerationStepWithNoLeaderin interface- GtuFollowingModelOld
- Parameters:
- gtu- LaneBasedGtu; the GTU for which acceleration is computed
- maxDistance- Length; 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:
- AccelerationStep; the result of application of the GTU following model
- Throws:
- GtuException- when the speed of the gtu cannot be determined
 
- 
computeAccelerationStepWithNoLeaderpublic final AccelerationStep computeAccelerationStepWithNoLeader(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Duration stepSize) throws GtuException Compute the acceleration that would be used if the is not leader in sight.- Specified by:
- computeAccelerationStepWithNoLeaderin interface- GtuFollowingModelOld
- Parameters:
- gtu- LaneBasedGtu; the GTU for which acceleration is computed
- maxDistance- Length; 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:
- AccelerationStep; the result of application of the GTU following model
- Throws:
- GtuException- when the speed of the gtu cannot be determined
 
- 
minimumHeadwaypublic final org.djunits.value.vdouble.scalar.Length minimumHeadway(org.djunits.value.vdouble.scalar.Speed followerSpeed, org.djunits.value.vdouble.scalar.Speed leaderSpeed, org.djunits.value.vdouble.scalar.Length precision, org.djunits.value.vdouble.scalar.Length maxDistance, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Speed followerMaximumSpeed) Compute the minimum net headway given the speed of the follower and the leader.
 At the returned headway, the follower would decelerate with it's maximum comfortable deceleration.- Specified by:
- minimumHeadwayin interface- GtuFollowingModelOld
- Parameters:
- followerSpeed- Speed; speed of the follower
- leaderSpeed- Speed; speed of the leader
- precision- Length; the required precision of the result (must be > 0)
- maxDistance- Length; 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
- followerMaximumSpeed- Speed; the maximum speed that the follower can drive at
- Returns:
- Length
 
 
-