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://github.com/peter-knoppers">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                  @Override
35                  public void check(final Double value, final Parameters params) throws ParameterException
36                  {
37                      // @docs/06-behavior/parameters.md
38                      Double dSync = params.getParameterOrNull(DSYNC);
39                      Throw.when(dSync != null && value >= dSync, ParameterException.class,
40                              "Value of dFree is above or equal to dSync.");
41                      // @end
42                      Double dCoop = params.getParameterOrNull(DCOOP);
43                      Throw.when(dCoop != null && value >= dCoop, ParameterException.class,
44                              "Value of dFree is above or equal to dCoop.");
45                  }
46              };
47  
48      /** Synchronized lane change desire threshold. */
49      // @docs/06-behavior/parameters.md
50      ParameterTypeDouble DSYNC = new ParameterTypeDouble("dSync", "Synchronized lane change desire threshold", 0.577,
51              ConstraintInterface.UNITINTERVAL)
52      {
53          /** */
54          private static final long serialVersionUID = 20160413L;
55  
56          @Override
57          public void check(final Double value, final Parameters params) throws ParameterException
58          {
59              // @docs/06-behavior/parameters.md
60              Double dFree = params.getParameterOrNull(DFREE);
61              Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dSync is below or equal to dFree.");
62              // @end
63              Double dCoop = params.getParameterOrNull(DCOOP);
64              Throw.when(dCoop != null && value >= dCoop, ParameterException.class, "Value of dSync is above or equal to dCoop.");
65          }
66      };
67  
68      /** Cooperative lane change desire threshold. */
69      ParameterTypeDouble DCOOP = new ParameterTypeDouble("dCoop", "Cooperative lane change desire threshold", 0.788,
70              ConstraintInterface.UNITINTERVAL)
71      {
72          /** */
73          private static final long serialVersionUID = 20160413L;
74  
75          @Override
76          public void check(final Double value, final Parameters params) throws ParameterException
77          {
78              Double dFree = params.getParameterOrNull(DFREE);
79              Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dCoop is below or equal to dFree.");
80              Double dSync = params.getParameterOrNull(DSYNC);
81              Throw.when(dSync != null && value <= dSync, ParameterException.class, "Value of dCoop is below or equal to dSync.");
82          }
83      };
84  
85      /** Current left lane change desire. */
86      ParameterTypeDouble DLEFT = new ParameterTypeDouble("dLeft", "Left lane change desire", 0.0);
87  
88      /** Current right lane change desire. */
89      ParameterTypeDouble DRIGHT = new ParameterTypeDouble("dRight", "Right lane change desire", 0.0);
90  
91      /** Lane change desire of current lane change. */
92      ParameterTypeDouble DLC = new ParameterTypeDouble("dLaneChange", "Desire of current lane change", 0.0);
93  
94      /** Anticipation speed difference at full lane change desired. */
95      ParameterTypeSpeed VGAIN = new ParameterTypeSpeed("vGain", "Anticipation speed difference at full lane change desire",
96              new Speed(69.6, SpeedUnit.KM_PER_HOUR), ConstraintInterface.POSITIVE);
97  
98      /** Socio-speed sensitivity parameter. */
99      ParameterTypeDouble SOCIO =
100             new ParameterTypeDouble("socio", "Sensitivity level for speed of others", 1.0, ConstraintInterface.UNITINTERVAL);
101 
102 }