LmrsParameters.java

  1. package org.opentrafficsim.road.gtu.lane.tactical.util.lmrs;

  2. import org.djunits.unit.SpeedUnit;
  3. import org.djunits.value.vdouble.scalar.Speed;
  4. import org.djutils.exceptions.Throw;
  5. import org.opentrafficsim.base.parameters.ParameterException;
  6. import org.opentrafficsim.base.parameters.ParameterTypeDouble;
  7. import org.opentrafficsim.base.parameters.ParameterTypeSpeed;
  8. import org.opentrafficsim.base.parameters.Parameters;
  9. import org.opentrafficsim.base.parameters.constraint.ConstraintInterface;

  10. /**
  11.  * Interface with LMRS parameters.
  12.  * <p>
  13.  * Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  14.  * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
  15.  * <p>
  16.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version 3 apr. 2017 <br>
  17.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  18.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  19.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  20.  */
  21. @SuppressWarnings("checkstyle:interfaceistype")
  22. public interface LmrsParameters
  23. {

  24.     /** Free lane change desire threshold. */
  25.     ParameterTypeDouble DFREE =
  26.             new ParameterTypeDouble("dFree", "Free lane change desire threshold", 0.365, ConstraintInterface.UNITINTERVAL)
  27.             {
  28.                 /** */
  29.                 private static final long serialVersionUID = 20160413L;

  30.                 /** {@inheritDoc} */
  31.                 @Override
  32.                 public void check(final Double value, final Parameters params) throws ParameterException
  33.                 {
  34.                     Double dSync = params.getParameterOrNull(DSYNC);
  35.                     Throw.when(dSync != null && value >= dSync, ParameterException.class,
  36.                             "Value of dFree is above or equal to dSync.");
  37.                     Double dCoop = params.getParameterOrNull(DCOOP);
  38.                     Throw.when(dCoop != null && value >= dCoop, ParameterException.class,
  39.                             "Value of dFree is above or equal to dCoop.");
  40.                 }
  41.             };

  42.     /** Synchronized lane change desire threshold. */
  43.     ParameterTypeDouble DSYNC = new ParameterTypeDouble("dSync", "Synchronized lane change desire threshold", 0.577,
  44.             ConstraintInterface.UNITINTERVAL)
  45.     {
  46.         /** */
  47.         private static final long serialVersionUID = 20160413L;

  48.         /** {@inheritDoc} */
  49.         @Override
  50.         public void check(final Double value, final Parameters params) throws ParameterException
  51.         {
  52.             Double dFree = params.getParameterOrNull(DFREE);
  53.             Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dSync is below or equal to dFree.");
  54.             Double dCoop = params.getParameterOrNull(DCOOP);
  55.             Throw.when(dCoop != null && value >= dCoop, ParameterException.class, "Value of dSync is above or equal to dCoop.");
  56.         }
  57.     };

  58.     /** Cooperative lane change desire threshold. */
  59.     ParameterTypeDouble DCOOP = new ParameterTypeDouble("dCoop", "Cooperative lane change desire threshold", 0.788,
  60.             ConstraintInterface.UNITINTERVAL)
  61.     {
  62.         /** */
  63.         private static final long serialVersionUID = 20160413L;

  64.         /** {@inheritDoc} */
  65.         @Override
  66.         public void check(final Double value, final Parameters params) throws ParameterException
  67.         {
  68.             Double dFree = params.getParameterOrNull(DFREE);
  69.             Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dCoop is below or equal to dFree.");
  70.             Double dSync = params.getParameterOrNull(DSYNC);
  71.             Throw.when(dSync != null && value <= dSync, ParameterException.class, "Value of dCoop is below or equal to dSync.");
  72.         }
  73.     };

  74.     /** Current left lane change desire. */
  75.     ParameterTypeDouble DLEFT = new ParameterTypeDouble("dLeft", "Left lane change desire", 0.0);

  76.     /** Current right lane change desire. */
  77.     ParameterTypeDouble DRIGHT = new ParameterTypeDouble("dRight", "Right lane change desire", 0.0);

  78.     /** Lane change desire of current lane change. */
  79.     ParameterTypeDouble DLC = new ParameterTypeDouble("dLaneChange", "Desire of current lane change", 0.0);

  80.     /** Anticipation speed difference at full lane change desired. */
  81.     ParameterTypeSpeed VGAIN =
  82.             new ParameterTypeSpeed("vGain", "Anticipation speed difference at full lane change desire",
  83.                     new Speed(69.6, SpeedUnit.KM_PER_HOUR), ConstraintInterface.POSITIVE);

  84.     /** Courtesy parameter. */
  85.     ParameterTypeDouble COURTESY = new ParameterTypeDouble("courtesy", "Courtesy level for courtesy lane changes", 1.0);

  86.     /** Socio-speed sensitivity parameter. */
  87.     ParameterTypeDouble SOCIO = new ParameterTypeDouble("socio", "Sensitivity level for speed of others",
  88.             1.0, ConstraintInterface.UNITINTERVAL);

  89. }