View Javadoc
1   package org.opentrafficsim.road.gtu.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.LaneBasedGtu;
9   import org.opentrafficsim.road.gtu.perception.PerceptionIterable;
10  import org.opentrafficsim.road.gtu.perception.object.PerceivedObject;
11  import org.opentrafficsim.road.network.speed.SpeedLimits;
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-2026 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 Alexander Verbraeck
28   * @author Wouter Schakel
29   */
30  public interface CarFollowingModel extends DesiredHeadwayModel, DesiredSpeedModel, Initialisable
31  {
32  
33      /** Parameter type for car-following model. */
34      ParameterTypeClass<CarFollowingModel> CAR_FOLLOWING_MODEL =
35              new ParameterTypeClass<>("cf.model", "car-following model", CarFollowingModel.class, IdmPlus.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
45       * @param speed current speed
46       * @param speedLimits speed limits
47       * @param maxVehicleSpeed maximum vehicle speed
48       * @param leaders set of leader headways and speeds, ordered by headway (closest first)
49       * @throws ParameterException if parameter exception occurs
50       * @return car-following acceleration
51       */
52      Acceleration followingAcceleration(Parameters parameters, Speed speed, SpeedLimits speedLimits, Speed maxVehicleSpeed,
53              PerceptionIterable<? extends PerceivedObject> 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      @Override
68      default void init(final LaneBasedGtu gtu)
69      {
70          //
71      }
72  
73  }