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
public abstract class AbstractGTUFollowingModelMobil extends Object implements GTUFollowingModelOld
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.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: 1408 $, $LastChangedDate: 2015-09-24 15:17:25 +0200 (Thu, 24 Sep 2015) $, by $Author: pknoppers $,
initial version 19 feb. 2015
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Field Summary
Fields Modifier and Type Field Description static DualAccelerationStep
TOODANGEROUS
Return value if lane change causes immediate collision.-
Fields inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel
CAR_FOLLOWING_MODEL
-
-
Constructor Summary
Constructors Constructor Description AbstractGTUFollowingModelMobil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccelerationStep
computeAccelerationStep(Speed followerSpeed, Speed leaderSpeed, Length headway, Speed speedLimit, Time currentTime)
Compute the acceleration that would be used to follow a leader.AccelerationStep
computeAccelerationStep(Speed followerSpeed, Speed leaderSpeed, Length headway, Speed speedLimit, Time currentTime, Duration stepSize)
Compute the acceleration that would be used to follow a leader.AccelerationStep
computeAccelerationStep(LaneBasedGTU gtu, Speed leaderSpeed, Length headway, Length maxDistance, Speed speedLimit)
Compute the acceleration that would be used to follow a leader.AccelerationStep
computeAccelerationStep(LaneBasedGTU gtu, Speed leaderSpeed, Length headway, Length maxDistance, Speed speedLimit, Duration stepSize)
Compute the acceleration that would be used to follow a leader.AccelerationStep
computeAccelerationStepWithNoLeader(LaneBasedGTU gtu, Length maxDistance, Speed speedLimit)
Compute the acceleration that would be used if the is not leader in sight.AccelerationStep
computeAccelerationStepWithNoLeader(LaneBasedGTU gtu, Length maxDistance, Speed speedLimit, Duration stepSize)
Compute the acceleration that would be used if the is not leader in sight.DualAccelerationStep
computeDualAccelerationStep(LaneBasedGTU referenceGTU, Collection<Headway> otherGTUs, Length maxDistance, 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.DualAccelerationStep
computeDualAccelerationStep(LaneBasedGTU referenceGTU, Collection<Headway> otherHeadways, Length maxDistance, Speed speedLimit, 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.Length
minimumHeadway(Speed followerSpeed, Speed leaderSpeed, Length precision, Length maxDistance, Speed speedLimit, 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.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel
followingAcceleration, getLongName, getName, init
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.DesiredHeadwayModel
desiredHeadway
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.DesiredSpeedModel
desiredSpeed
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.following.GTUFollowingModelOld
computeAcceleration, computeAcceleration, getMaximumSafeDeceleration, getStepSize, setA, setFspeed, setT
-
-
-
-
Field Detail
-
TOODANGEROUS
public static final DualAccelerationStep TOODANGEROUS
Return value if lane change causes immediate collision.
-
-
Method Detail
-
computeDualAccelerationStep
public final DualAccelerationStep computeDualAccelerationStep(LaneBasedGTU referenceGTU, Collection<Headway> otherGTUs, Length maxDistance, 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:
computeDualAccelerationStep
in interfaceGTUFollowingModelOld
- Parameters:
referenceGTU
- LaneBasedGTU; the GTU for which the accelerations are computedotherGTUs
- 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 dropspeedLimit
- 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
-
computeDualAccelerationStep
public final DualAccelerationStep computeDualAccelerationStep(LaneBasedGTU referenceGTU, Collection<Headway> otherHeadways, Length maxDistance, Speed speedLimit, 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:
computeDualAccelerationStep
in interfaceGTUFollowingModelOld
- Parameters:
referenceGTU
- LaneBasedGTU; the GTU for which the accelerations are computedotherHeadways
- 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 dropspeedLimit
- Speed; the local speed limitstepSize
- 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
-
computeAccelerationStep
public final AccelerationStep computeAccelerationStep(LaneBasedGTU gtu, Speed leaderSpeed, Length headway, Length maxDistance, Speed speedLimit) throws GTUException
Compute the acceleration that would be used to follow a leader.- Specified by:
computeAccelerationStep
in interfaceGTUFollowingModelOld
- Parameters:
gtu
- LaneBasedGTU; the GTU for which acceleration is computedleaderSpeed
- Speed; the speed of the leaderheadway
- Length; the headway of the leadermaxDistance
- Length; the maximum distance we can cover at the current time, e.g. as the result of a lane dropspeedLimit
- 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
-
computeAccelerationStep
public final AccelerationStep computeAccelerationStep(LaneBasedGTU gtu, Speed leaderSpeed, Length headway, Length maxDistance, Speed speedLimit, Duration stepSize) throws GTUException
Compute the acceleration that would be used to follow a leader.- Specified by:
computeAccelerationStep
in interfaceGTUFollowingModelOld
- Parameters:
gtu
- LaneBasedGTU; the GTU for which acceleration is computedleaderSpeed
- Speed; the speed of the leaderheadway
- Length; the headway of the leadermaxDistance
- Length; the maximum distance we can cover at the current time, e.g. as the result of a lane dropspeedLimit
- Speed; the local speed limitstepSize
- 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
-
computeAccelerationStep
public final AccelerationStep computeAccelerationStep(Speed followerSpeed, Speed leaderSpeed, Length headway, Speed speedLimit, Time currentTime)
Compute the acceleration that would be used to follow a leader.- Specified by:
computeAccelerationStep
in interfaceGTUFollowingModelOld
- Parameters:
followerSpeed
- Speed; the speed of the follower at the current timeleaderSpeed
- Speed; the speed of the follower at the current timeheadway
- 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 dropspeedLimit
- Speed; the local speed limitcurrentTime
- 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
-
computeAccelerationStep
public final AccelerationStep computeAccelerationStep(Speed followerSpeed, Speed leaderSpeed, Length headway, Speed speedLimit, Time currentTime, Duration stepSize)
Compute the acceleration that would be used to follow a leader.- Specified by:
computeAccelerationStep
in interfaceGTUFollowingModelOld
- Parameters:
followerSpeed
- Speed; the speed of the follower at the current timeleaderSpeed
- Speed; the speed of the follower at the current timeheadway
- 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 dropspeedLimit
- Speed; the local speed limitcurrentTime
- Time; to be used to determine the validity of the AccelerationStepstepSize
- 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
-
computeAccelerationStepWithNoLeader
public final AccelerationStep computeAccelerationStepWithNoLeader(LaneBasedGTU gtu, Length maxDistance, Speed speedLimit) throws GTUException
Compute the acceleration that would be used if the is not leader in sight.- Specified by:
computeAccelerationStepWithNoLeader
in interfaceGTUFollowingModelOld
- Parameters:
gtu
- LaneBasedGTU; the GTU for which acceleration is computedmaxDistance
- Length; the maximum distance we can cover at the current time, e.g. as the result of a lane dropspeedLimit
- 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
-
computeAccelerationStepWithNoLeader
public final AccelerationStep computeAccelerationStepWithNoLeader(LaneBasedGTU gtu, Length maxDistance, Speed speedLimit, Duration stepSize) throws GTUException
Compute the acceleration that would be used if the is not leader in sight.- Specified by:
computeAccelerationStepWithNoLeader
in interfaceGTUFollowingModelOld
- Parameters:
gtu
- LaneBasedGTU; the GTU for which acceleration is computedmaxDistance
- Length; the maximum distance we can cover at the current time, e.g. as the result of a lane dropspeedLimit
- Speed; the local speed limitstepSize
- 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
-
minimumHeadway
public final Length minimumHeadway(Speed followerSpeed, Speed leaderSpeed, Length precision, Length maxDistance, Speed speedLimit, 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:
minimumHeadway
in interfaceGTUFollowingModelOld
- Parameters:
followerSpeed
- Speed; speed of the followerleaderSpeed
- Speed; speed of the leaderprecision
- 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 dropspeedLimit
- Speed; the local speed limitfollowerMaximumSpeed
- Speed; the maximum speed that the follower can drive at- Returns:
- Length
-
-