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