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-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
16   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
17   * <p>
18   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 3 apr. 2017 <br>
19   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
20   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
21   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
22   */
23  @SuppressWarnings("checkstyle:interfaceistype")
24  public interface LmrsParameters
25  {
26  
27      /** Free lane change desire threshold. */
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                      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                      Double dCoop = params.getParameterOrNull(DCOOP);
42                      Throw.when(dCoop != null && value >= dCoop, ParameterException.class,
43                              "Value of dFree is above or equal to dCoop.");
44                  }
45              };
46  
47      /** Synchronized lane change desire threshold. */
48      ParameterTypeDouble DSYNC = new ParameterTypeDouble("dSync", "Synchronized lane change desire threshold", 0.577,
49              ConstraintInterface.UNITINTERVAL)
50      {
51          /** */
52          private static final long serialVersionUID = 20160413L;
53  
54          /** {@inheritDoc} */
55          @Override
56          public void check(final Double value, final Parameters params) throws ParameterException
57          {
58              Double dFree = params.getParameterOrNull(DFREE);
59              Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dSync is below or equal to dFree.");
60              Double dCoop = params.getParameterOrNull(DCOOP);
61              Throw.when(dCoop != null && value >= dCoop, ParameterException.class, "Value of dSync is above or equal to dCoop.");
62          }
63      };
64  
65      /** Cooperative lane change desire threshold. */
66      ParameterTypeDouble DCOOP = new ParameterTypeDouble("dCoop", "Cooperative lane change desire threshold", 0.788,
67              ConstraintInterface.UNITINTERVAL)
68      {
69          /** */
70          private static final long serialVersionUID = 20160413L;
71  
72          /** {@inheritDoc} */
73          @Override
74          public void check(final Double value, final Parameters params) throws ParameterException
75          {
76              Double dFree = params.getParameterOrNull(DFREE);
77              Throw.when(dFree != null && value <= dFree, ParameterException.class, "Value of dCoop is below or equal to dFree.");
78              Double dSync = params.getParameterOrNull(DSYNC);
79              Throw.when(dSync != null && value <= dSync, ParameterException.class, "Value of dCoop is below or equal to dSync.");
80          }
81      };
82  
83      /** Current left lane change desire. */
84      ParameterTypeDouble DLEFT = new ParameterTypeDouble("dLeft", "Left lane change desire", 0.0);
85  
86      /** Current right lane change desire. */
87      ParameterTypeDouble DRIGHT = new ParameterTypeDouble("dRight", "Right lane change desire", 0.0);
88  
89      /** Lane change desire of current lane change. */
90      ParameterTypeDouble DLC = new ParameterTypeDouble("dLaneChange", "Desire of current lane change", 0.0);
91  
92      /** Anticipation speed difference at full lane change desired. */
93      ParameterTypeSpeed VGAIN =
94              new ParameterTypeSpeed("vGain", "Anticipation speed difference at full lane change desire",
95                      new Speed(69.6, SpeedUnit.KM_PER_HOUR), ConstraintInterface.POSITIVE);
96  
97      /** Courtesy parameter. */
98      ParameterTypeDouble COURTESY = new ParameterTypeDouble("courtesy", "Courtesy level for courtesy lane changes", 1.0);
99  
100     /** Socio-speed sensitivity parameter. */
101     ParameterTypeDouble SOCIO = new ParameterTypeDouble("socio", "Sensitivity level for speed of others",
102             1.0, ConstraintInterface.UNITINTERVAL);
103 
104 }