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.road.gtu.lane.LaneBasedGtu;
8   import org.opentrafficsim.road.gtu.lane.perception.PerceptionCollectable;
9   import org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayGtu;
10  
11  /**
12   * Linear CACC implementation based on derivatives by Jeroen Ploeg.
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 PloegCacc extends PloegAcc
22  {
23  
24      /** Acceleration error gain parameter. */
25      public static final ParameterTypeDouble KA = LinearCacc.KA;
26  
27      /**
28       * Constructor using default sensors with no delay.
29       * @param delayedActuation DelayedActuation; delayed actuation
30       */
31      public PloegCacc(final DelayedActuation delayedActuation)
32      {
33          super(delayedActuation);
34      }
35  
36      /** {@inheritDoc} */
37      @Override
38      public Acceleration getFollowingAcceleration(final LaneBasedGtu gtu,
39              final PerceptionCollectable<HeadwayGtu, LaneBasedGtu> leaders, final Parameters settings) throws ParameterException
40      {
41          HeadwayGtu leader = leaders.first();
42          if (leader.getAcceleration() == null)
43          {
44              return super.getFollowingAcceleration(gtu, leaders, settings);
45          }
46          double es =
47                  leader.getDistance().si - gtu.getSpeed().si * settings.getParameter(TDCACC).si - settings.getParameter(X0).si;
48          double esd = leader.getSpeed().si - gtu.getSpeed().si - gtu.getAcceleration().si * settings.getParameter(TDCACC).si;
49          double kaui = settings.getParameter(KA) * leader.getAcceleration().si;
50          return Acceleration.instantiateSI(settings.getParameter(KS) * es + settings.getParameter(KD) * esd + kaui);
51      }
52  
53  }