1 package org.opentrafficsim.base.parameters;
2
3 import org.djunits.unit.LengthUnit;
4 import org.djunits.unit.SpeedUnit;
5 import org.djunits.value.vdouble.scalar.Acceleration;
6 import org.djunits.value.vdouble.scalar.Duration;
7 import org.djunits.value.vdouble.scalar.Length;
8 import org.djunits.value.vdouble.scalar.Speed;
9 import org.djutils.exceptions.Throw;
10 import org.opentrafficsim.base.parameters.constraint.ConstraintInterface;
11
12
13
14
15
16
17
18
19
20
21
22 @SuppressWarnings("checkstyle:finalclass")
23 public class ParameterTypes implements ConstraintInterface
24 {
25
26 private ParameterTypes()
27 {
28
29 }
30
31
32 public static final ParameterTypeDuration DT;
33
34
35 public static final ParameterTypeLength S0;
36
37
38 public static final ParameterTypeAcceleration A;
39
40
41 public static final ParameterTypeAcceleration B;
42
43
44 public static final ParameterTypeAcceleration BCRIT;
45
46
47 public static final ParameterTypeAcceleration B0;
48
49
50 public static final ParameterTypeDuration T;
51
52
53 public static final ParameterTypeDuration TMIN;
54
55
56 public static final ParameterTypeDuration TMAX;
57
58
59 public static final ParameterTypeDuration TAU;
60
61
62 public static final ParameterTypeDuration T0;
63
64
65 public static final ParameterTypeLength LOOKAHEAD;
66
67
68 public static final ParameterTypeLength LOOKBACK;
69
70
71
72 public static final ParameterTypeLength LOOKBACKOLD;
73
74
75 public static final ParameterTypeDouble FSPEED;
76
77
78 public static final ParameterTypeSpeed VCONG;
79
80
81 public static final ParameterTypeDuration LCDUR;
82
83
84 public static final ParameterTypeLength PERCEPTION;
85
86
87 public static final ParameterTypeDuration TR;
88
89 static
90 {
91
92 DT = new ParameterTypeDuration("dt", "Fixed model time step", Duration.createSI(0.5), POSITIVE);
93
94 S0 = new ParameterTypeLength("s0", "Car-following stopping distance", Length.createSI(3.0), POSITIVE);
95
96 A = new ParameterTypeAcceleration("a", "Maximum (desired) car-following acceleration", Acceleration.createSI(1.25),
97 POSITIVE);
98
99 B = new ParameterTypeAcceleration("b", "Maximum comfortable car-following deceleration", Acceleration.createSI(2.09),
100 POSITIVE)
101 {
102
103 private static final long serialVersionUID = 20170203L;
104
105 @Override
106 public void check(final Acceleration value, final Parameters params) throws ParameterException
107 {
108 Acceleration b0 = params.getParameterOrNull(B0);
109 Throw.when(b0 != null && value.si <= b0.si, ParameterException.class, "Value of b is below or equal to b0");
110 Acceleration bCrit = params.getParameterOrNull(BCRIT);
111 Throw.when(bCrit != null && value.si >= bCrit.si, ParameterException.class,
112 "Value of b is above or equal to bCrit");
113 }
114 };
115
116 BCRIT = new ParameterTypeAcceleration("bCrit", "Maximum critical deceleration, e.g. stop/go at traffic light",
117 Acceleration.createSI(3.5), POSITIVE)
118 {
119
120 private static final long serialVersionUID = 20170203L;
121
122 @Override
123 public void check(final Acceleration value, final Parameters params) throws ParameterException
124 {
125 Acceleration b0 = params.getParameterOrNull(B0);
126 Throw.when(b0 != null && value.si <= b0.si, ParameterException.class, "Value of bCrit is below or equal to b0");
127 Acceleration b = params.getParameterOrNull(B);
128 Throw.when(b != null && value.si <= b.si, ParameterException.class, "Value of bCrit is below or equal to b");
129 }
130 };
131
132 B0 = new ParameterTypeAcceleration("b0", "Maximum adjustment deceleration, e.g. when speed limit drops",
133 Acceleration.createSI(0.5), POSITIVE)
134 {
135
136 private static final long serialVersionUID = 20170203L;
137
138 @Override
139 public void check(final Acceleration value, final Parameters params) throws ParameterException
140 {
141 Acceleration b = params.getParameterOrNull(B);
142 Throw.when(b != null && value.si >= b.si, ParameterException.class, "Value of b0 is above or equal to b");
143 Acceleration bCrit = params.getParameterOrNull(BCRIT);
144 Throw.when(bCrit != null && value.si >= bCrit.si, ParameterException.class,
145 "Value of b0 is above or equal to bCrit");
146 }
147 };
148
149 T = new ParameterTypeDuration("T", "Current car-following headway", Duration.createSI(1.2), POSITIVE);
150
151 TMIN = new ParameterTypeDuration("Tmin", "Minimum car-following headway", Duration.createSI(0.56), POSITIVE)
152 {
153
154 private static final long serialVersionUID = 20160400L;
155
156 @Override
157 public void check(final Duration value, final Parameters params) throws ParameterException
158 {
159 Duration tMax = params.getParameterOrNull(TMAX);
160 Throw.when(tMax != null && value.si >= tMax.si, ParameterException.class,
161 "Value of Tmin is above or equal to Tmax");
162 }
163 };
164
165 TMAX = new ParameterTypeDuration("Tmax", "Maximum car-following headway", Duration.createSI(1.2), POSITIVE)
166 {
167
168 private static final long serialVersionUID = 20160400L;
169
170 @Override
171 public void check(final Duration value, final Parameters params) throws ParameterException
172 {
173 Duration tMin = params.getParameterOrNull(TMIN);
174 Throw.when(tMin != null && value.si <= tMin.si, ParameterException.class,
175 "Value of Tmax is below or equal to Tmin");
176 }
177 };
178
179 TAU = new ParameterTypeDuration("tau", "Headway relaxation time", Duration.createSI(25.0), POSITIVE);
180
181 T0 = new ParameterTypeDuration("t0", "Look-ahead time for mandatory lane changes", Duration.createSI(43.0), POSITIVE);
182
183 LOOKAHEAD = new ParameterTypeLength("Look-ahead", "Look-ahead distance", Length.createSI(295.0), POSITIVE);
184
185 LOOKBACK = new ParameterTypeLength("Look-back", "Look-back distance", Length.createSI(200.0), POSITIVE);
186
187 LOOKBACKOLD = new ParameterTypeLength("Look-back old", "Look-back distance (old version for MOBIL code)",
188 Length.createSI(-200.0), NEGATIVE);
189
190 FSPEED = new ParameterTypeDouble("fSpeed", "Speed limit adherence factor", 1.0, POSITIVE);
191
192 VCONG = new ParameterTypeSpeed("vCong", "Speed threshold below which traffic is considered congested",
193 new Speed(60, SpeedUnit.KM_PER_HOUR), POSITIVE);
194
195 LCDUR = new ParameterTypeDuration("lcDur", "Regular lane change duration", Duration.createSI(3.0), POSITIVE);
196
197 PERCEPTION = new ParameterTypeLength("perception", "Mental map length", new Length(2.0, LengthUnit.KILOMETER), POSITIVE);
198
199 TR = new ParameterTypeDuration("Tr", "Reaction time", Duration.createSI(0.5), POSITIVEZERO);
200
201 }
202
203 }