View Javadoc
1   package org.opentrafficsim.road.gtu.lane.control;
2   
3   import org.djunits.value.vdouble.scalar.Acceleration;
4   import org.djunits.value.vdouble.scalar.Duration;
5   import org.opentrafficsim.base.parameters.ParameterTypeDuration;
6   import org.opentrafficsim.base.parameters.constraint.NumericConstraint;
7   import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
8   
9   /**
10   * Delays the actuation of acceleration. This is not part of the vehicle model as that is used for both human and automated
11   * control, which follow different vehicle capability semantics.
12   * <p>
13   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
15   * </p>
16   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
17   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
18   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
19   */
20  public interface DelayedActuation
21  {
22  
23      /** No delayed actuation. */
24      DelayedActuation NONE = new DelayedActuation()
25      {
26          /** {@inheritDoc} */
27          @Override
28          public Acceleration delayActuation(final Acceleration desiredAcceleration, final LaneBasedGtu gtu)
29          {
30              return desiredAcceleration;
31          }
32      };
33  
34      /** Parameter for actuation delay. */
35      ParameterTypeDuration TAU = new ParameterTypeDuration("tau_actuation", "Actuation delay", Duration.instantiateSI(0.1),
36              NumericConstraint.POSITIVE);
37  
38      /** Tau delayed actuation. */
39      DelayedActuation TAUDELAYED = new DelayedActuation()
40      {
41          /** {@inheritDoc} */
42          @Override
43          public Acceleration delayActuation(final Acceleration desiredAcceleration, final LaneBasedGtu gtu)
44          {
45              // TODO: numerical implementation of tau rule
46              return desiredAcceleration.minus(gtu.getAcceleration());
47          }
48      };
49  
50      /**
51       * Delays the actuation of acceleration.
52       * @param desiredAcceleration Acceleration; desired acceleration
53       * @param gtu LaneBasedGtu; gtu
54       * @return Acceleration; delayed acceleration
55       */
56      Acceleration delayActuation(Acceleration desiredAcceleration, LaneBasedGtu gtu);
57  
58  }