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.instantiateSI(0.5), POSITIVE);
93
94 S0 = new ParameterTypeLength("s0", "Car-following stopping distance", Length.instantiateSI(3.0), POSITIVE);
95
96 A = new ParameterTypeAcceleration("a", "Maximum (desired) car-following acceleration", Acceleration.instantiateSI(
97 1.25), POSITIVE);
98
99 B = new ParameterTypeAcceleration("b", "Maximum comfortable car-following deceleration", Acceleration.instantiateSI(
100 2.09), 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.instantiateSI(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,
127 "Value of bCrit is below or equal to b0");
128 Acceleration b = params.getParameterOrNull(B);
129 Throw.when(b != null && value.si <= b.si, ParameterException.class, "Value of bCrit is below or equal to b");
130 }
131 };
132
133 B0 = new ParameterTypeAcceleration("b0", "Maximum adjustment deceleration, e.g. when speed limit drops", Acceleration
134 .instantiateSI(0.5), POSITIVE)
135 {
136
137 private static final long serialVersionUID = 20170203L;
138
139 @Override
140 public void check(final Acceleration value, final Parameters params) throws ParameterException
141 {
142 Acceleration b = params.getParameterOrNull(B);
143 Throw.when(b != null && value.si >= b.si, ParameterException.class, "Value of b0 is above or equal to b");
144 Acceleration bCrit = params.getParameterOrNull(BCRIT);
145 Throw.when(bCrit != null && value.si >= bCrit.si, ParameterException.class,
146 "Value of b0 is above or equal to bCrit");
147 }
148 };
149
150 T = new ParameterTypeDuration("T", "Current car-following headway", Duration.instantiateSI(1.2), POSITIVE);
151
152 TMIN = new ParameterTypeDuration("Tmin", "Minimum car-following headway", Duration.instantiateSI(0.56), POSITIVE)
153 {
154
155 private static final long serialVersionUID = 20160400L;
156
157 @Override
158 public void check(final Duration value, final Parameters params) throws ParameterException
159 {
160 Duration tMax = params.getParameterOrNull(TMAX);
161 Throw.when(tMax != null && value.si >= tMax.si, ParameterException.class,
162 "Value of Tmin is above or equal to Tmax");
163 }
164 };
165
166 TMAX = new ParameterTypeDuration("Tmax", "Maximum car-following headway", Duration.instantiateSI(1.2), POSITIVE)
167 {
168
169 private static final long serialVersionUID = 20160400L;
170
171 @Override
172 public void check(final Duration value, final Parameters params) throws ParameterException
173 {
174 Duration tMin = params.getParameterOrNull(TMIN);
175 Throw.when(tMin != null && value.si <= tMin.si, ParameterException.class,
176 "Value of Tmax is below or equal to Tmin");
177 }
178 };
179
180 TAU = new ParameterTypeDuration("tau", "Headway relaxation time", Duration.instantiateSI(25.0), POSITIVE);
181
182 T0 = new ParameterTypeDuration("t0", "Look-ahead time for mandatory lane changes", Duration.instantiateSI(43.0),
183 POSITIVE);
184
185 LOOKAHEAD = new ParameterTypeLength("Look-ahead", "Look-ahead distance", Length.instantiateSI(295.0), POSITIVE);
186
187 LOOKBACK = new ParameterTypeLength("Look-back", "Look-back distance", Length.instantiateSI(200.0), POSITIVE);
188
189 LOOKBACKOLD = new ParameterTypeLength("Look-back old", "Look-back distance (old version for MOBIL code)", Length
190 .instantiateSI(-200.0), NEGATIVE);
191
192 FSPEED = new ParameterTypeDouble("fSpeed", "Speed limit adherence factor", 1.0, POSITIVE);
193
194 VCONG = new ParameterTypeSpeed("vCong", "Speed threshold below which traffic is considered congested", new Speed(60,
195 SpeedUnit.KM_PER_HOUR), POSITIVE);
196
197 LCDUR = new ParameterTypeDuration("lcDur", "Regular lane change duration", Duration.instantiateSI(3.0), POSITIVE);
198
199 PERCEPTION = new ParameterTypeLength("perception", "Mental map length", new Length(2.0, LengthUnit.KILOMETER),
200 POSITIVE);
201
202 TR = new ParameterTypeDuration("Tr", "Reaction time", Duration.instantiateSI(0.5), POSITIVEZERO);
203
204 }
205
206 }