View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.util.lmrs;
2   
3   import org.djunits.unit.SpeedUnit;
4   import org.djunits.value.vdouble.scalar.Speed;
5   import org.djutils.exceptions.Throw;
6   import org.opentrafficsim.base.parameters.ParameterException;
7   import org.opentrafficsim.base.parameters.ParameterTypeDouble;
8   import org.opentrafficsim.base.parameters.ParameterTypeSpeed;
9   import org.opentrafficsim.base.parameters.Parameters;
10  import org.opentrafficsim.base.parameters.constraint.ConstraintInterface;
11  
12  /**
13   * Interface with LMRS parameters.
14   * <p>
15   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
16   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
17   * </p>
18   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
19   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
20   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
21   */
22  @SuppressWarnings("checkstyle:interfaceistype")
23  public interface LmrsParameters
24  {
25  
26      /** Free lane change desire threshold. */
27      // @docs/06-behavior/parameters.md
28      ParameterTypeDouble DFREE =
29              new ParameterTypeDouble("dFree", "Free lane change desire threshold", 0.365, ConstraintInterface.UNITINTERVAL)
30              {
31                  /** */
32                  private static final long serialVersionUID = 20160413L;
33  
34                  /** {@inheritDoc} */
35                  @Override
36                  public void check(final Double value, final Parameters params) throws ParameterException
37                  {
38                      // @docs/06-behavior/parameters.md
39                      Double dSync = params.getParameterOrNull(DSYNC);
40                      Throw.when(dSync != null && value >= dSync, ParameterException.class,
41                              "Value of dFree is above or equal to dSync.");
42                      // @end
43                      Double dCoop = params.getParameterOrNull(DCOOP);
44                      Throw.when(dCoop != null && value >= dCoop, ParameterException.class,
45                              "Value of dFree is above or equal to dCoop.");
46                  }
47              };
48  
49      /** Synchronized lane change desire threshold. */
50      // @docs/06-behavior/parameters.md
51      ParameterTypeDouble DSYNC = new ParameterTypeDouble("dSync", "Synchronized lane change desire threshold", 0.577,
52              ConstraintInterface.UNITINTERVAL)
53      {
54          /** */
55          private static final long serialVersionUID = 20160413L;
56  
57          /** {@inheritDoc} */
58          @Override
59          public void check(final Double value, final Parameters params) throws ParameterException
60          {
61              // @docs/06-behavior/parameters.md
62              Double dFree = params.getParameterOrNull(DFREE);
63              Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dSync is below or equal to dFree.");
64              // @end
65              Double dCoop = params.getParameterOrNull(DCOOP);
66              Throw.when(dCoop != null && value >= dCoop, ParameterException.class, "Value of dSync is above or equal to dCoop.");
67          }
68      };
69  
70      /** Cooperative lane change desire threshold. */
71      ParameterTypeDouble DCOOP = new ParameterTypeDouble("dCoop", "Cooperative lane change desire threshold", 0.788,
72              ConstraintInterface.UNITINTERVAL)
73      {
74          /** */
75          private static final long serialVersionUID = 20160413L;
76  
77          /** {@inheritDoc} */
78          @Override
79          public void check(final Double value, final Parameters params) throws ParameterException
80          {
81              Double dFree = params.getParameterOrNull(DFREE);
82              Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dCoop is below or equal to dFree.");
83              Double dSync = params.getParameterOrNull(DSYNC);
84              Throw.when(dSync != null && value <= dSync, ParameterException.class, "Value of dCoop is below or equal to dSync.");
85          }
86      };
87  
88      /** Current left lane change desire. */
89      ParameterTypeDouble DLEFT = new ParameterTypeDouble("dLeft", "Left lane change desire", 0.0);
90  
91      /** Current right lane change desire. */
92      ParameterTypeDouble DRIGHT = new ParameterTypeDouble("dRight", "Right lane change desire", 0.0);
93  
94      /** Lane change desire of current lane change. */
95      ParameterTypeDouble DLC = new ParameterTypeDouble("dLaneChange", "Desire of current lane change", 0.0);
96  
97      /** Anticipation speed difference at full lane change desired. */
98      ParameterTypeSpeed VGAIN = new ParameterTypeSpeed("vGain", "Anticipation speed difference at full lane change desire",
99              new Speed(69.6, SpeedUnit.KM_PER_HOUR), ConstraintInterface.POSITIVE);
100 
101     /** Socio-speed sensitivity parameter. */
102     ParameterTypeDouble SOCIO =
103             new ParameterTypeDouble("socio", "Sensitivity level for speed of others", 1.0, ConstraintInterface.UNITINTERVAL);
104 
105 }