View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.following;
2   
3   import java.util.SortedMap;
4   
5   import org.djunits.value.vdouble.scalar.Speed;
6   import org.djunits.value.vdouble.scalar.Length;
7   import org.djunits.value.vdouble.scalar.Acceleration;
8   import org.opentrafficsim.core.gtu.drivercharacteristics.ParameterException;
9   import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
10  
11  /**
12   * Methods that a car-following model has to implement. The GTU is supplied to obtain characteristics such as 
13   * parameters. Other input into the methods describe the car-following situation. The GTU should thus <b>not</b> be used
14   * to obtain: position, speed, speed limit at current location, leader, etc.
15   * @author Wouter Schakel
16   */
17  public interface CarFollowingModel {
18  
19  	/**
20  	 * Determines the desired speed.
21  	 * @param gtu GTU for which the acceleration is calculated.
22  	 * @param speedLimit Speed limit, static or dynamic.
23  	 * @param enforcement Whether the speed limit is enforced by camera, section control, etc.
24  	 * @param maximumVehicleSpeed Maximum speed of the vehicle.
25       * @throws ParameterException If parameter exception occurs.
26  	 * @return Desired speed.
27  	 */
28  	Speed desiredSpeed(LaneBasedGTU gtu, Speed speedLimit, boolean enforcement, Speed maximumVehicleSpeed) 
29  			throws ParameterException;				
30  
31  	/**
32  	 * Determines the desired headway.
33  	 * @param gtu GTU for which the acceleration is calculated.
34  	 * @param speed Speed to determine the desired headway at.
35       * @throws ParameterException If parameter exception occurs.
36  	 * @return Desired headway.
37  	 */
38  	Length.Rel desiredHeadway(LaneBasedGTU gtu, Speed speed) throws ParameterException;
39  
40  	/**
41  	 * Determines the acceleration if there is no reason to decelerate.
42  	 * @param gtu GTU for which the acceleration is calculated.
43  	 * @param speed Current speed.
44  	 * @param speedLimit Speed limit, static or dynamic.
45  	 * @param enforcement Whether the speed limit is enforced by camera, section control, etc.
46  	 * @param maximumVehicleSpeed Maximum speed of the vehicle.
47  	 * @throws ParameterException If parameter exception occurs.
48       * @return Acceleration if there is no reason to decelerate.
49  	 */ 
50  	Acceleration freeAcceleration(LaneBasedGTU gtu, Speed speed, Speed speedLimit, boolean enforcement, 
51  			Speed maximumVehicleSpeed) throws ParameterException;
52  
53  	/**
54  	 * Determines car-following acceleration. The implementation should be able to deal with:<br>
55  	 * The current speed being higher than the desired speed.
56  	 * The headway being negative.<br><br>
57  	 * @param gtu GTU for which the acceleration is calculated.
58  	 * @param speed Current speed.
59  	 * @param speedLimit Speed limit, static or dynamic.
60  	 * @param enforcement Whether the speed limit is enforced by camera, section control, etc.
61  	 * @param maximumVehicleSpeed Maximum speed of the vehicle.
62  	 * @param headway Net headway towards the leading vehicle.
63  	 * @param leaderSpeed Speed of the leading vehicle.
64       * @throws ParameterException If parameter exception occurs.
65  	 * @return Car-following acceleration.
66  	 */
67  	Acceleration followingAcceleration(LaneBasedGTU gtu, Speed speed, Speed speedLimit, boolean enforcement, 
68  			Speed maximumVehicleSpeed, Length.Rel headway, Speed leaderSpeed) throws ParameterException;
69  
70  	/**
71  	 * Multi-anticipative determination of car-following acceleration. The implementation should be able to deal with:<br>
72  	 * The current speed being higher than the desired speed.
73  	 * The headway being negative.
74  	 * The tactical planner determines whether multi-anticipative car-following is applied, including to how many
75  	 * leaders and within what distance, by including these vehicles in the set. The car-following model itself may
76  	 * however only respond to the first vehicle.
77  	 * @param gtu GTU for which the acceleration is calculated.
78  	 * @param speed Current speed.
79  	 * @param speedLimit Speed limit, static or dynamic.
80  	 * @param enforcement Whether the speed limit is enforced by camera, section control, etc.
81  	 * @param maximumVehicleSpeed Maximum speed of the vehicle.
82  	 * @param leaders Set of leader headways and speeds, ordered by headway (closest first).
83       * @throws ParameterException If parameter exception occurs.
84  	 * @return Car-following acceleration.
85  	 */
86  	Acceleration followingAcceleration(LaneBasedGTU gtu, Speed speed, Speed speedLimit, boolean enforcement, 
87  			Speed maximumVehicleSpeed, SortedMap<Length.Rel, Speed> leaders) throws ParameterException;
88  
89  	/**
90  	 * Return the name of the car-following model.
91  	 * @return Name of the car-following model. 
92  	 */
93  	String getName();
94  
95  	/**
96  	 * Return the name complete of the car-following model.
97  	 * @return Complete name of the car-following model. 
98  	 */
99  	String getLongName();
100 	
101 }