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  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  @SuppressWarnings("checkstyle:interfaceistype")
24  public interface LmrsParameters
25  {
26  
27      
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                  
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      
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          
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      
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          
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      
84      ParameterTypeDouble DLEFT = new ParameterTypeDouble("dLeft", "Left lane change desire.", 0.0);
85  
86      
87      ParameterTypeDouble DRIGHT = new ParameterTypeDouble("dRight", "Right lane change desire.", 0.0);
88  
89      
90      ParameterTypeDouble DLC = new ParameterTypeDouble("dLaneChange", "Desire of current lane change.", 0.0);
91  
92      
93      ParameterTypeSpeed VGAIN =
94              new ParameterTypeSpeed("vGain", "Anticipation speed difference at " + "full lane change desired.",
95                      new Speed(69.6, SpeedUnit.KM_PER_HOUR), ConstraintInterface.POSITIVE);
96  
97      
98      ParameterTypeDouble COURTESY = new ParameterTypeDouble("Courtesy", "Courtesy level for courtesy lane changes.", 1.0);
99  
100     
101     ParameterTypeDouble SOCIO = new ParameterTypeDouble("Socio-speed sensitivity", "Sensitivity level for speed of others.",
102             1.0, ConstraintInterface.UNITINTERVAL);
103 
104 }