View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.util.lmrs;
2   
3   import static org.opentrafficsim.core.gtu.behavioralcharacteristics.AbstractParameterType.Check.UNITINTERVAL;
4   
5   import org.djunits.unit.SpeedUnit;
6   import org.djunits.value.vdouble.scalar.Speed;
7   import org.opentrafficsim.core.gtu.behavioralcharacteristics.AbstractParameterType;
8   import org.opentrafficsim.core.gtu.behavioralcharacteristics.BehavioralCharacteristics;
9   import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterException;
10  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypeDouble;
11  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypeSpeed;
12  
13  import nl.tudelft.simulation.language.Throw;
14  
15  /**
16   * <p>
17   * Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
18   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
19   * <p>
20   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 3 apr. 2017 <br>
21   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
22   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
23   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
24   */
25  @SuppressWarnings("checkstyle:interfaceistype")
26  public interface LmrsParameters
27  {
28  
29      /** Free lane change desire threshold. */
30      ParameterTypeDouble DFREE = new ParameterTypeDouble("dFree", "Free lane change desire threshold.", 0.365, UNITINTERVAL)
31      {
32          /** */
33          private static final long serialVersionUID = 20160413L;
34  
35          public void check(final double value, final BehavioralCharacteristics bc) throws ParameterException
36          {
37              Throw.when(bc.contains(DSYNC) && value >= bc.getParameter(DSYNC), ParameterException.class,
38                      "Value of dFree is above or equal to dSync.");
39              Throw.when(bc.contains(DCOOP) && value >= bc.getParameter(DCOOP), ParameterException.class,
40                      "Value of dFree is above or equal to dCoop.");
41          }
42      };
43  
44      /** Synchronized lane change desire threshold. */
45      ParameterTypeDouble DSYNC =
46              new ParameterTypeDouble("dSync", "Synchronized lane change desire threshold.", 0.577, UNITINTERVAL)
47              {
48                  /** */
49                  private static final long serialVersionUID = 20160413L;
50  
51                  public void check(final double value, final BehavioralCharacteristics bc) throws ParameterException
52                  {
53                      Throw.when(bc.contains(DFREE) && value <= bc.getParameter(DFREE), ParameterException.class,
54                              "Value of dSync is below or equal to dFree.");
55                      Throw.when(bc.contains(DCOOP) && value >= bc.getParameter(DCOOP), ParameterException.class,
56                              "Value of dSync is above or equal to dCoop.");
57                  }
58              };
59  
60      /** Cooperative lane change desire threshold. */
61      ParameterTypeDouble DCOOP =
62              new ParameterTypeDouble("dCoop", "Cooperative lane change desire threshold.", 0.788, UNITINTERVAL)
63              {
64                  /** */
65                  private static final long serialVersionUID = 20160413L;
66  
67                  public void check(final double value, final BehavioralCharacteristics bc) throws ParameterException
68                  {
69                      Throw.when(bc.contains(DFREE) && value <= bc.getParameter(DFREE), ParameterException.class,
70                              "Value of dCoop is below or equal to dFree.");
71                      Throw.when(bc.contains(DSYNC) && value <= bc.getParameter(DSYNC), ParameterException.class,
72                              "Value of dCoop is below or equal to dSync.");
73                  }
74              };
75  
76      /** Current left lane change desire. */
77      ParameterTypeDouble DLEFT = new ParameterTypeDouble("dLeft", "Left lane change desire.", 0.0);
78  
79      /** Current right lane change desire. */
80      ParameterTypeDouble DRIGHT = new ParameterTypeDouble("dRight", "Right lane change desire.", 0.0);
81  
82      /** Lane change desire of current lane change. */
83      ParameterTypeDouble DLC = new ParameterTypeDouble("dLaneChange", "Desire of current lane change.", 0.0);
84  
85      /** Anticipation speed difference at full lane change desired. */
86      ParameterTypeSpeed VGAIN =
87              new ParameterTypeSpeed("vGain", "Anticipation speed difference at " + "full lane change desired.",
88                      new Speed(69.6, SpeedUnit.KM_PER_HOUR), AbstractParameterType.Check.POSITIVE);
89  
90      /** Courtesy parameter. */
91      ParameterTypeDouble COURTESY = new ParameterTypeDouble("Courtesy", "Courtesy level for courtesy lane changes.", 1.0);
92  
93      /** Hierarchy parameter. */
94      ParameterTypeDouble HIERARCHY = new ParameterTypeDouble("Hierarchy", "Hierarchy level for hierarchal lane changes.", 1.0);
95  
96  }