View Javadoc
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-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
25   * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
26   * <p>
27   * @version $Revision$, $LastChangedDate$, by $Author$, initial version Apr 22, 2016 <br>
28   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
29   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
30   */
31  public interface CarFollowingModel extends DesiredHeadwayModel, DesiredSpeedModel, Initialisable
32  {
33  
34      /** Parameter type for car-following model. */
35      ParameterTypeClass<CarFollowingModel> CAR_FOLLOWING_MODEL = new ParameterTypeClass<>("cf.model", "car-following model",
36              ParameterTypeClass.getValueClass(CarFollowingModel.class));
37  
38      /**
39       * Determination of car-following acceleration, possibly based on multiple leaders. The implementation should be able to
40       * deal with:<br>
41       * <ul>
42       * <li>The current speed being higher than the desired speed.</li>
43       * <li>The headway being negative.</li>
44       * </ul>
45       * @param parameters Parameters; parameters
46       * @param speed Speed; current speed
47       * @param speedLimitInfo SpeedLimitInfo; info regarding the desired speed for car-following
48       * @param leaders PerceptionIterable&lt;? extends Headway&gt;; set of leader headways and speeds, ordered by headway
49       *            (closest first)
50       * @throws ParameterException if parameter exception occurs
51       * @return car-following acceleration
52       */
53      Acceleration followingAcceleration(Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo,
54              PerceptionIterable<? extends Headway> leaders) throws ParameterException;
55  
56      /**
57       * Return the name of the car-following model.
58       * @return name of the car-following model
59       */
60      String getName();
61  
62      /**
63       * Return the complete name of the car-following model.
64       * @return complete name of the car-following model
65       */
66      String getLongName();
67  
68      /** {@inheritDoc} */
69      @Override
70      default void init(LaneBasedGTU gtu)
71      {
72          //
73      }
74  
75  }