View Javadoc
1   package org.opentrafficsim.road.gtu.lane.control;
2   
3   import org.djunits.value.vdouble.scalar.Acceleration;
4   import org.opentrafficsim.base.parameters.ParameterException;
5   import org.opentrafficsim.base.parameters.ParameterTypeDouble;
6   import org.opentrafficsim.base.parameters.Parameters;
7   import org.opentrafficsim.base.parameters.constraint.NumericConstraint;
8   import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
9   import org.opentrafficsim.road.gtu.lane.perception.PerceptionCollectable;
10  import org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayGtu;
11  
12  /**
13   * <p>
14   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
16   * </p>
17   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
19   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
20   */
21  public class PloegAcc extends LinearAcc
22  {
23  
24      /** Gap error derivative gain parameter. */
25      public static final ParameterTypeDouble KD =
26              new ParameterTypeDouble("kd", "Gap error derivative gain", 0.7, NumericConstraint.POSITIVE);
27  
28      /**
29       * Constructor using default sensors with no delay.
30       * @param delayedActuation DelayedActuation; delayed actuation
31       */
32      public PloegAcc(final DelayedActuation delayedActuation)
33      {
34          super(delayedActuation);
35      }
36  
37      /** {@inheritDoc} */
38      @Override
39      public Acceleration getFollowingAcceleration(final LaneBasedGtu gtu,
40              final PerceptionCollectable<HeadwayGtu, LaneBasedGtu> leaders, final Parameters settings) throws ParameterException
41      {
42          HeadwayGtu leader = leaders.first();
43          double es =
44                  leader.getDistance().si - gtu.getSpeed().si * settings.getParameter(TDACC).si - settings.getParameter(X0).si;
45          double esd = leader.getSpeed().si - gtu.getSpeed().si - gtu.getAcceleration().si * settings.getParameter(TDACC).si;
46          return Acceleration.instantiateSI(settings.getParameter(KS) * es + settings.getParameter(KD) * esd);
47      }
48  
49  }