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