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-2024 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://github.com/wjschakel">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 = 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 speedLimitInfo info regarding the desired speed for car-following 47 * @param leaders set of leader headways and speeds, ordered by headway (closest first) 48 * @throws ParameterException if parameter exception occurs 49 * @return car-following acceleration 50 */ 51 Acceleration followingAcceleration(Parameters parameters, Speed speed, SpeedLimitInfo speedLimitInfo, 52 PerceptionIterable<? extends Headway> leaders) throws ParameterException; 53 54 /** 55 * Return the name of the car-following model. 56 * @return name of the car-following model 57 */ 58 String getName(); 59 60 /** 61 * Return the complete name of the car-following model. 62 * @return complete name of the car-following model 63 */ 64 String getLongName(); 65 66 @Override 67 default void init(final LaneBasedGtu gtu) 68 { 69 // 70 } 71 72 }