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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
16   * <p>
17   * @version $Revision$, $LastChangedDate$, by $Author$, initial version Mar 13, 2019 <br>
18   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
20   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
21   */
22  public class PloegCACC extends PloegACC
23  {
24  
25      /** Acceleration error gain parameter. */
26      public static final ParameterTypeDouble KA = LinearCACC.KA;
27  
28      /**
29       * Constructor using default sensors with no delay.
30       * @param delayedActuation DelayedActuation; delayed actuation
31       */
32      public PloegCACC(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          if (leader.getAcceleration() == null)
44          {
45              return super.getFollowingAcceleration(gtu, leaders, settings);
46          }
47          double es =
48                  leader.getDistance().si - gtu.getSpeed().si * settings.getParameter(TDCACC).si - settings.getParameter(X0).si;
49          double esd = leader.getSpeed().si - gtu.getSpeed().si - gtu.getAcceleration().si * settings.getParameter(TDCACC).si;
50          double kaui = settings.getParameter(KA) * leader.getAcceleration().si;
51          return Acceleration.instantiateSI(settings.getParameter(KS) * es + settings.getParameter(KD) * esd + kaui);
52      }
53  
54  }