1 package org.opentrafficsim.road.gtu.lane.tactical.following;
2
3 import java.util.SortedMap;
4
5 import org.djunits.value.vdouble.scalar.Acceleration;
6 import org.djunits.value.vdouble.scalar.Length;
7 import org.djunits.value.vdouble.scalar.Speed;
8 import org.opentrafficsim.core.gtu.behavioralcharacteristics.BehavioralCharacteristics;
9 import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterException;
10 import org.opentrafficsim.road.network.speed.SpeedLimitInfo;
11
12 /**
13 * Methods that a car-following model has to implement. The behavioral characteristics are supplied to obtain parameters. The
14 * phrase 'car-following model' is the commonly used and therefore intuitive name, but in actuality it is much more.
15 * <ul>
16 * <li>Following other vehicle types: van, bus, truck.</li>
17 * <li>Following other GTU's: bicycle, pedestrian.</li>
18 * <li>Free driving.</li>
19 * <li>Approaching (theoretically different from following, usually the same formula).</li>
20 * <li>Stopping for a traffic light, intersection conflict, etc,</li>
21 * </ul>
22 * <p>
23 * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
24 * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
25 * <p>
26 * @version $Revision$, $LastChangedDate$, by $Author$, initial version Apr 22, 2016 <br>
27 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
28 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
29 */
30 public interface CarFollowingModel
31 {
32
33 /**
34 * Determines the desired speed.
35 * @param behavioralCharacteristics behavioral characteristics
36 * @param speedInfo info regarding the desired speed for car-following
37 * @throws ParameterException if parameter exception occurs
38 * @return desired speed
39 */
40 Speed desiredSpeed(BehavioralCharacteristics behavioralCharacteristics, SpeedLimitInfo speedInfo) throws ParameterException;
41
42 /**
43 * Determines the desired headway in equilibrium conditions, i.e. no speed difference with the leader.
44 * @param behavioralCharacteristics behavioral characteristics
45 * @param speed speed to determine the desired headway at
46 * @throws ParameterException if parameter exception occurs
47 * @return desired headway
48 */
49 Length desiredHeadway(BehavioralCharacteristics behavioralCharacteristics, Speed speed) throws ParameterException;
50
51 /**
52 * Determination of car-following acceleration, possibly based on multiple leaders. The implementation should be able to
53 * deal with:<br>
54 * <ul>
55 * <li>The current speed being higher than the desired speed.</li>
56 * <li>The headway being negative.</li>
57 * </ul>
58 * @param behavioralCharacteristics behavioral characteristics
59 * @param speed current speed
60 * @param speedLimitInfo info regarding the desired speed for car-following
61 * @param leaders set of leader headways and speeds, ordered by headway (closest first)
62 * @throws ParameterException if parameter exception occurs
63 * @return car-following acceleration
64 */
65 Acceleration followingAcceleration(BehavioralCharacteristics behavioralCharacteristics, Speed speed,
66 SpeedLimitInfo speedLimitInfo, SortedMap<Length, Speed> leaders) throws ParameterException;
67
68 /**
69 * Return the name of the car-following model.
70 * @return name of the car-following model
71 */
72 String getName();
73
74 /**
75 * Return the complete name of the car-following model.
76 * @return complete name of the car-following model
77 */
78 String getLongName();
79
80 }