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