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