1 package org.opentrafficsim.road.gtu.lane.tactical.following;
2
3 import org.djunits.value.vdouble.scalar.Acceleration;
4 import org.djunits.value.vdouble.scalar.Speed;
5 import org.opentrafficsim.base.parameters.ParameterException;
6 import org.opentrafficsim.base.parameters.ParameterTypeClass;
7 import org.opentrafficsim.base.parameters.Parameters;
8 import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
9 import org.opentrafficsim.road.gtu.lane.perception.PerceptionIterable;
10 import org.opentrafficsim.road.gtu.lane.perception.headway.Headway;
11 import org.opentrafficsim.road.network.speed.SpeedLimitInfo;
12
13 /**
14 * Methods that a car-following model has to implement. The parameters are supplied to obtain parameters. The phrase
15 * 'car-following model' is the commonly used and therefore intuitive name, but in actuality it is much more.
16 * <ul>
17 * <li>Following other vehicle types: van, bus, truck.</li>
18 * <li>Following other GTU's: bicycle, pedestrian.</li>
19 * <li>Free driving.</li>
20 * <li>Approaching (theoretically different from following, usually the same formula).</li>
21 * <li>Stopping for a traffic light, intersection conflict, etc,</li>
22 * </ul>
23 * <p>
24 * Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
25 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
26 * </p>
27 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
28 * @author <a href="https://dittlab.tudelft.nl">Wouter Schakel</a>
29 */
30 public interface CarFollowingModel extends DesiredHeadwayModel, DesiredSpeedModel, Initialisable
31 {
32
33 /** Parameter type for car-following model. */
34 ParameterTypeClass<CarFollowingModel> CAR_FOLLOWING_MODEL = new ParameterTypeClass<>("cf.model", "car-following model",
35 ParameterTypeClass.getValueClass(CarFollowingModel.class));
36
37 /**
38 * Determination of car-following acceleration, possibly based on multiple leaders. The implementation should be able to
39 * deal with:<br>
40 * <ul>
41 * <li>The current speed being higher than the desired speed.</li>
42 * <li>The headway being negative.</li>
43 * </ul>
44 * @param parameters Parameters; parameters
45 * @param speed Speed; current speed
46 * @param speedLimitInfo SpeedLimitInfo; info regarding the desired speed for car-following
47 * @param leaders PerceptionIterable<? extends Headway>; set of leader headways and speeds, ordered by headway
48 * (closest first)
49 * @throws ParameterException if parameter exception occurs
50 * @return car-following acceleration
51 */
52 Acceleration followingAcceleration(Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo,
53 PerceptionIterable<? extends Headway> leaders) throws ParameterException;
54
55 /**
56 * Return the name of the car-following model.
57 * @return name of the car-following model
58 */
59 String getName();
60
61 /**
62 * Return the complete name of the car-following model.
63 * @return complete name of the car-following model
64 */
65 String getLongName();
66
67 /** {@inheritDoc} */
68 @Override
69 default void init(LaneBasedGtu gtu)
70 {
71 //
72 }
73
74 }