1 package org.opentrafficsim.road.gtu.lane.tactical.following; 2 3 import java.util.Collection; 4 5 import org.djunits.value.vdouble.scalar.Acceleration; 6 import org.djunits.value.vdouble.scalar.Duration; 7 import org.djunits.value.vdouble.scalar.Length; 8 import org.djunits.value.vdouble.scalar.Speed; 9 import org.djunits.value.vdouble.scalar.Time; 10 import org.opentrafficsim.core.gtu.GTUException; 11 import org.opentrafficsim.road.gtu.lane.LaneBasedGTU; 12 import org.opentrafficsim.road.gtu.lane.perception.headway.Headway; 13 14 /** 15 * GTU following model interface. <br> 16 * GTU following models following this interface compute an acceleration. 17 * <p> 18 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 19 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 20 * <p> 21 * @version $Revision: 1401 $, $LastChangedDate: 2015-09-14 01:33:02 +0200 (Mon, 14 Sep 2015) $, by $Author: averbraeck $, 22 * initial version Jul 2, 2014 <br> 23 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 24 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 25 */ 26 public interface GTUFollowingModelOld extends CarFollowingModel 27 { 28 /** 29 * Compute the acceleration that would be used to follow a leader.<br> 30 * @param gtu LaneBasedGTU; the GTU for which acceleration is computed 31 * @param leaderSpeed Speed; the speed of the leader 32 * @param headway Length; the headway of the leader 33 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 34 * @param speedLimit Speed; the local speed limit 35 * @return AccelerationStep; the result of application of the GTU following model 36 * @throws GTUException when the speed of the gtu cannot be determined 37 */ 38 AccelerationStep computeAccelerationStep(final LaneBasedGTU gtu, final Speed leaderSpeed, final Length headway, 39 final Length maxDistance, final Speed speedLimit) throws GTUException; 40 41 /** 42 * Compute the acceleration that would be used to follow a leader.<br> 43 * @param gtu LaneBasedGTU; the GTU for which acceleration is computed 44 * @param leaderSpeed Speed; the speed of the leader 45 * @param headway Length; the headway of the leader 46 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 47 * @param speedLimit Speed; the local speed limit 48 * @param stepSize Duration; given step size, which can be longer or shorter than the provided step size in the algorithms. 49 * @return AccelerationStep; the result of application of the GTU following model 50 * @throws GTUException when the speed of the gtu cannot be determined 51 */ 52 AccelerationStep computeAccelerationStep(final LaneBasedGTU gtu, final Speed leaderSpeed, final Length headway, 53 final Length maxDistance, final Speed speedLimit, final Duration stepSize) throws GTUException; 54 55 /** 56 * Compute the acceleration that would be used to follow a leader.<br> 57 * @param followerSpeed Speed; the speed of the follower at the current time 58 * @param followerMaximumSpeed Speed; the maximum speed that the follower is capable of driving at 59 * @param leaderSpeed Speed; the speed of the follower at the current time 60 * @param headway Length; the <b>net</b> headway (distance between the front of the follower to the rear of the leader) at 61 * the current time, or the maximum distance we can cover at the current time, e.g. as the result of a lane drop 62 * @param speedLimit Speed; the local speed limit 63 * @return Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following 64 * model 65 */ 66 Acceleration computeAcceleration(final Speed followerSpeed, Speed followerMaximumSpeed, final Speed leaderSpeed, 67 final Length headway, final Speed speedLimit); 68 69 /** 70 * Compute the acceleration that would be used to follow a leader.<br> 71 * @param followerSpeed Speed; the speed of the follower at the current time 72 * @param followerMaximumSpeed Speed; the maximum speed that the follower is capable of driving at 73 * @param leaderSpeed Speed; the speed of the follower at the current time 74 * @param headway Length; the <b>net</b> headway (distance between the front of the follower to the rear of the leader) at 75 * the current time, or the maximum distance we can cover at the current time, e.g. as the result of a lane drop 76 * @param speedLimit Speed; the local speed limit 77 * @param stepSize Duration; given step size, which can be longer or shorter than the provided step size in the algorithms. 78 * @return Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following 79 * model 80 */ 81 Acceleration computeAcceleration(final Speed followerSpeed, Speed followerMaximumSpeed, final Speed leaderSpeed, 82 final Length headway, final Speed speedLimit, final Duration stepSize); 83 84 /** 85 * Compute the acceleration that would be used to follow a leader.<br> 86 * @param followerSpeed Speed; the speed of the follower at the current time 87 * @param leaderSpeed Speed; the speed of the follower at the current time 88 * @param headway Length; the <b>net</b> headway (distance between the front of the follower to the rear of the leader) at 89 * the current time, or the maximum distance we can cover at the current time, e.g. as the result of a lane drop 90 * @param speedLimit Speed; the local speed limit 91 * @param currentTime Time; to be used to determine the validity of the AccelerationStep 92 * @return Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following 93 * model 94 */ 95 AccelerationStep computeAccelerationStep(Speed followerSpeed, Speed leaderSpeed, Length headway, Speed speedLimit, 96 Time currentTime); 97 98 /** 99 * Compute the acceleration that would be used to follow a leader.<br> 100 * @param followerSpeed Speed; the speed of the follower at the current time 101 * @param leaderSpeed Speed; the speed of the follower at the current time 102 * @param headway Length; the <b>net</b> headway (distance between the front of the follower to the rear of the leader) at 103 * the current time, or the maximum distance we can cover at the current time, e.g. as the result of a lane drop 104 * @param speedLimit Speed; the local speed limit 105 * @param currentTime Time; to be used to determine the validity of the AccelerationStep 106 * @param stepSize Duration; given step size, which can be longer or shorter than the provided step size in the algorithms. 107 * @return Acceleration; the acceleration (or, if negative, deceleration) resulting from application of the GTU following 108 * model 109 */ 110 AccelerationStep computeAccelerationStep(Speed followerSpeed, Speed leaderSpeed, Length headway, Speed speedLimit, 111 Time currentTime, final Duration stepSize); 112 113 /** 114 * Compute the lowest accelerations (or most severe decelerations) that would be used if a referenceGTU is present 115 * (inserted, or not removed) in a set of other GTUs.<br> 116 * If any GTU in the set of otherGTUs has a null headway (indicating that the other GTU is in fact parallel to the 117 * referenceGTU), prohibitive decelerations shall be returned.<br> 118 * Two AccelerationStep values are returned in a DualAccelerationStep.<br> 119 * or should slow down for a crossing from accelerating to unsafe speeds. 120 * @param gtu LaneBasedGTU; the GTU for which the accelerations are computed 121 * @param otherHeadways Collection<Headway>; the other GTUs. A negative headway value indicates that the other GTU is 122 * a follower. NB. If the referenceGTU is contained in this Collection, it is ignored. 123 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 124 * @param speedLimit Speed; the local speed limit 125 * @return DualAccelerationStep; the result with the lowest accelerations (or most severe decelerations) of application of 126 * the GTU following model of the referenceGTU for each leader and follower 127 * @throws GTUException when the speed of the gtu cannot be determined 128 */ 129 DualAccelerationStep computeDualAccelerationStep(final LaneBasedGTU gtu, final Collection<Headway> otherHeadways, 130 final Length maxDistance, final Speed speedLimit) throws GTUException; 131 132 /** 133 * Compute the lowest accelerations (or most severe decelerations) that would be used if a referenceGTU is present 134 * (inserted, or not removed) in a set of other GTUs.<br> 135 * If any GTU in the set of otherGTUs has a null headway (indicating that the other GTU is in fact parallel to the 136 * referenceGTU), prohibitive decelerations shall be returned.<br> 137 * Two AccelerationStep values are returned in a DualAccelerationStep.<br> 138 * or should slow down for a crossing from accelerating to unsafe speeds. 139 * @param gtu LaneBasedGTU; the GTU for which the accelerations are computed 140 * @param otherHeadways Collection<Headway>; the other GTUs. A negative headway value indicates that the other GTU is 141 * a follower. NB. If the referenceGTU is contained in this Collection, it is ignored. 142 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 143 * @param speedLimit Speed; the local speed limit 144 * @param stepSize Duration; given step size, which can be longer or shorter than the provided step size in the algorithms. 145 * @return DualAccelerationStep; the result with the lowest accelerations (or most severe decelerations) of application of 146 * the GTU following model of the referenceGTU for each leader and follower 147 * @throws GTUException when the speed of the gtu cannot be determined 148 */ 149 DualAccelerationStep computeDualAccelerationStep(final LaneBasedGTU gtu, final Collection<Headway> otherHeadways, 150 final Length maxDistance, final Speed speedLimit, final Duration stepSize) throws GTUException; 151 152 /** 153 * Compute the acceleration that would be used if the is not leader in sight. 154 * @param gtu LaneBasedGTU; the GTU for which acceleration is computed 155 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 156 * @param speedLimit Speed; the local speed limit 157 * @return AccelerationStep; the result of application of the GTU following model 158 * @throws GTUException when the speed of the gtu cannot be determined 159 */ 160 AccelerationStep computeAccelerationStepWithNoLeader(final LaneBasedGTU gtu, final Length maxDistance, 161 final Speed speedLimit) throws GTUException; 162 163 /** 164 * Compute the acceleration that would be used if the is not leader in sight. 165 * @param gtu LaneBasedGTU; the GTU for which acceleration is computed 166 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 167 * @param speedLimit Speed; the local speed limit 168 * @param stepSize Duration; given step size, which can be longer or shorter than the provided step size in the algorithms. 169 * @return AccelerationStep; the result of application of the GTU following model 170 * @throws GTUException when the speed of the gtu cannot be determined 171 */ 172 AccelerationStep computeAccelerationStepWithNoLeader(final LaneBasedGTU gtu, final Length maxDistance, 173 final Speed speedLimit, final Duration stepSize) throws GTUException; 174 175 /** 176 * Compute the minimum <b>net</b> headway given the speed of the follower and the leader.<br> 177 * At the returned headway, the follower would decelerate with it's maximum comfortable deceleration. 178 * @param followerSpeed Speed; speed of the follower 179 * @param leaderSpeed Speed; speed of the leader 180 * @param precision Length; the required precision of the result (must be > 0) 181 * @param maxDistance Length; the maximum distance we can cover at the current time, e.g. as the result of a lane drop 182 * @param speedLimit Speed; the local speed limit 183 * @param followerMaximumSpeed Speed; the maximum speed that the follower can drive at 184 * @return Length 185 */ 186 Length minimumHeadway(Speed followerSpeed, Speed leaderSpeed, Length precision, final Length maxDistance, Speed speedLimit, 187 Speed followerMaximumSpeed); 188 189 /** 190 * Return the maximum safe deceleration for use in gap acceptance models. This is the deceleration that may be enforced upon 191 * a new follower due to entering a road or changing into an adjacent lane. The result shall be a <b>positive value</b>. In 192 * most car following models this value is named <cite>b</cite>. 193 * @return Acceleration; must be a positive value! 194 */ 195 Acceleration getMaximumSafeDeceleration(); 196 197 /** 198 * Return the standard step size of this GTU following model. 199 * @return Duration; the standard step size of the GTU following model 200 */ 201 Duration getStepSize(); 202 203 /** 204 * Set value of acceleration parameter. 205 * @param a Acceleration; value to set 206 */ 207 void setA(final Acceleration a); 208 209 /** 210 * Set value of desired headway. 211 * @param t Duration; desired headway 212 */ 213 void setT(final Duration t); 214 215 /** 216 * Set value of desired speed factor. 217 * @param fSpeed double; desired speed factor 218 */ 219 void setFspeed(final double fSpeed); 220 221 }