PloegCACC.java

  1. package org.opentrafficsim.road.gtu.lane.control;

  2. import org.djunits.value.vdouble.scalar.Acceleration;
  3. import org.opentrafficsim.base.parameters.ParameterException;
  4. import org.opentrafficsim.base.parameters.ParameterTypeDouble;
  5. import org.opentrafficsim.base.parameters.Parameters;
  6. import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
  7. import org.opentrafficsim.road.gtu.lane.perception.PerceptionCollectable;
  8. import org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayGTU;

  9. /**
  10.  * Linear CACC implementation based on derivatives by Jeroen Ploeg.
  11.  * <p>
  12.  * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  13.  * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
  14.  * <p>
  15.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version Mar 13, 2019 <br>
  16.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  17.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  18.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  19.  */
  20. public class PloegCACC extends PloegACC
  21. {

  22.     /** Acceleration error gain parameter. */
  23.     public static final ParameterTypeDouble KA = LinearCACC.KA;

  24.     /**
  25.      * Constructor using default sensors with no delay.
  26.      * @param delayedActuation DelayedActuation; delayed actuation
  27.      */
  28.     public PloegCACC(final DelayedActuation delayedActuation)
  29.     {
  30.         super(delayedActuation);
  31.     }

  32.     /** {@inheritDoc} */
  33.     @Override
  34.     public Acceleration getFollowingAcceleration(final LaneBasedGTU gtu,
  35.             final PerceptionCollectable<HeadwayGTU, LaneBasedGTU> leaders, final Parameters settings) throws ParameterException
  36.     {
  37.         HeadwayGTU leader = leaders.first();
  38.         if (leader.getAcceleration() == null)
  39.         {
  40.             return super.getFollowingAcceleration(gtu, leaders, settings);
  41.         }
  42.         double es =
  43.                 leader.getDistance().si - gtu.getSpeed().si * settings.getParameter(TDCACC).si - settings.getParameter(X0).si;
  44.         double esd = leader.getSpeed().si - gtu.getSpeed().si - gtu.getAcceleration().si * settings.getParameter(TDCACC).si;
  45.         double kaui = settings.getParameter(KA) * leader.getAcceleration().si;
  46.         return Acceleration.instantiateSI(settings.getParameter(KS) * es + settings.getParameter(KD) * esd + kaui);
  47.     }

  48. }