View Javadoc
1   package org.opentrafficsim.road.gtu.lane;
2   
3   import org.djunits.value.vdouble.scalar.Acceleration;
4   
5   /**
6    * Interface for vehicle models.
7    * <p>
8    * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
9    * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
10   * <p>
11   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 22 mei 2018 <br>
12   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
13   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
14   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
15   */
16  public interface VehicleModel
17  {
18  
19      /** No bounds. */
20      VehicleModel NONE = new VehicleModel()
21      {
22          @Override
23          public Acceleration boundAcceleration(final Acceleration acceleration, final LaneBasedGTU gtu)
24          {
25              return acceleration;
26          }
27      };
28  
29      /** Acceleration bounded by GTU min and max acceleration. */
30      VehicleModel MINMAX = new VehicleModel()
31      {
32          @Override
33          public Acceleration boundAcceleration(final Acceleration acceleration, final LaneBasedGTU gtu)
34          {
35              return acceleration.si > gtu.getMaximumDeceleration().si
36                      ? (acceleration.si < gtu.getMaximumAcceleration().si ? acceleration : gtu.getMaximumAcceleration())
37                      : gtu.getMaximumDeceleration();
38          }
39      };
40  
41      /**
42       * Returns a bounded acceleration.
43       * @param acceleration Acceleration; intended acceleration
44       * @param gtu LaneBasedGTU; gtu
45       * @return Acceleration; possible acceleration
46       */
47      Acceleration boundAcceleration(Acceleration acceleration, LaneBasedGTU gtu);
48  
49  }