1 package org.opentrafficsim.core.definitions;
2
3 import java.util.Locale;
4 import java.util.function.BiFunction;
5
6 import org.djunits.unit.SpeedUnit;
7 import org.djunits.value.vdouble.scalar.Length;
8 import org.djunits.value.vdouble.scalar.Speed;
9 import org.opentrafficsim.core.distributions.ConstantGenerator;
10 import org.opentrafficsim.core.gtu.GtuTemplate;
11 import org.opentrafficsim.core.gtu.GtuType;
12 import org.opentrafficsim.core.network.LinkType;
13 import org.opentrafficsim.core.object.DetectorType;
14 import org.opentrafficsim.core.units.distributions.ContinuousDistSpeed;
15
16 import nl.tudelft.simulation.jstats.distributions.DistNormal;
17 import nl.tudelft.simulation.jstats.streams.StreamInterface;
18
19
20
21
22
23
24
25
26
27
28
29 public final class DefaultsNl extends Defaults implements BiFunction<GtuType, StreamInterface, GtuTemplate>
30 {
31
32
33
34
35 DefaultsNl()
36 {
37 super(new Locale("nl", "NL"));
38 }
39
40
41
42
43
44
45 public static final GtuType ROAD_USER = new GtuType("NL.ROAD_USER");
46
47
48 public static final GtuType PEDESTRIAN = new GtuType("NL.PEDESTRIAN", ROAD_USER);
49
50
51 public static final GtuType BICYCLE = new GtuType("NL.BICYCLE", ROAD_USER);
52
53
54 public static final GtuType MOPED = new GtuType("NL.MOPED", BICYCLE);
55
56
57 public static final GtuType VEHICLE = new GtuType("NL.VEHICLE", ROAD_USER);
58
59
60 public static final GtuType EMERGENCY_VEHICLE = new GtuType("NL.EMERGENCY_VEHICLE", VEHICLE);
61
62
63 public static final GtuType CAR = new GtuType("NL.CAR", VEHICLE);
64
65
66 public static final GtuType MOTORCYCLE = new GtuType("NL.MOTORCYCLE", VEHICLE);
67
68
69 public static final GtuType VAN = new GtuType("NL.VAN", VEHICLE);
70
71
72 public static final GtuType BUS = new GtuType("NL.BUS", VEHICLE);
73
74
75 public static final GtuType TRUCK = new GtuType("NL.TRUCK", VEHICLE);
76
77
78 public static final GtuType SCHEDULED_BUS = new GtuType("NL.SCHEDULED_BUS", BUS);
79
80
81
82
83
84
85
86
87
88
89
90
91 @Override
92 public GtuTemplate apply(final GtuType gtuType, final StreamInterface randomStream)
93 {
94 GtuTemplate template = null;
95 if (gtuType.equals(CAR))
96 {
97
98 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(4.19)),
99 new ConstantGenerator<>(Length.instantiateSI(1.7)),
100 new ConstantGenerator<>(new Speed(180, SpeedUnit.KM_PER_HOUR)));
101 }
102 else if (gtuType.equals(TRUCK))
103 {
104
105 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(12.0)),
106 new ConstantGenerator<>(Length.instantiateSI(2.55)),
107 new ContinuousDistSpeed(new DistNormal(randomStream, 85.0, 2.5), SpeedUnit.KM_PER_HOUR));
108 }
109 else if (gtuType.equals(BUS))
110 {
111 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(12.0)),
112 new ConstantGenerator<>(Length.instantiateSI(2.55)),
113 new ConstantGenerator<>(new Speed(90, SpeedUnit.KM_PER_HOUR)));
114 }
115 else if (gtuType.equals(VAN))
116 {
117 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(5.0)),
118 new ConstantGenerator<>(Length.instantiateSI(2.4)),
119 new ConstantGenerator<>(new Speed(180, SpeedUnit.KM_PER_HOUR)));
120 }
121 else if (gtuType.equals(EMERGENCY_VEHICLE))
122 {
123 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(5.0)),
124 new ConstantGenerator<>(Length.instantiateSI(2.55)),
125 new ConstantGenerator<>(new Speed(180, SpeedUnit.KM_PER_HOUR)));
126 }
127 else if (gtuType.equals(MOTORCYCLE))
128 {
129
130 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(2.1)),
131 new ConstantGenerator<>(Length.instantiateSI(0.7)),
132 new ConstantGenerator<>(new Speed(180, SpeedUnit.KM_PER_HOUR)));
133 }
134 else if (gtuType.equals(BICYCLE))
135 {
136
137
138 template = new GtuTemplate(gtuType, new ConstantGenerator<>(Length.instantiateSI(1.9)),
139 new ConstantGenerator<>(Length.instantiateSI(0.6)),
140 new ConstantGenerator<>(new Speed(35, SpeedUnit.KM_PER_HOUR)));
141 }
142 return template;
143 };
144
145
146
147
148
149
150 public static final LinkType CONNECTOR = new LinkType("NL.CONNECTOR");
151
152
153 public static final LinkType ROAD = new LinkType("NL.ROAD");
154
155
156 public static final LinkType FREEWAY = new LinkType("NL.FREEWAY", ROAD);
157
158
159 public static final LinkType HIGHWAY = new LinkType("NL.HIGHWAY", ROAD);
160
161
162 public static final LinkType PROVINCIAL = new LinkType("NL.PROVINCIAL", ROAD);
163
164
165 public static final LinkType RURAL = new LinkType("NL.RURAL", ROAD);
166
167
168 public static final LinkType URBAN = new LinkType("NL.URBAN", ROAD);
169
170
171 public static final LinkType RESIDENTIAL = new LinkType("NL.RESIDENTIAL", ROAD);
172
173 static
174 {
175 CONNECTOR.addCompatibleGtuType(ROAD_USER);
176 ROAD.addCompatibleGtuType(ROAD_USER);
177 FREEWAY.addIncompatibleGtuType(PEDESTRIAN);
178 FREEWAY.addIncompatibleGtuType(BICYCLE);
179 HIGHWAY.addIncompatibleGtuType(PEDESTRIAN);
180 HIGHWAY.addIncompatibleGtuType(BICYCLE);
181 PROVINCIAL.addIncompatibleGtuType(PEDESTRIAN);
182 PROVINCIAL.addIncompatibleGtuType(BICYCLE);
183 }
184
185
186
187
188
189
190 public static final DetectorType ROAD_USERS = new DetectorType("NL.ROAD_USERS");
191
192
193 public static final DetectorType VEHICLES = new DetectorType("NL.VEHICLES");
194
195
196 public static final DetectorType LOOP_DETECTOR = new DetectorType("NL.LOOP_DETECTOR", VEHICLES);
197
198
199 public static final DetectorType TRAFFIC_LIGHT = new DetectorType("NL.TRAFFIC_LIGHT", LOOP_DETECTOR);
200
201 static
202 {
203 ROAD_USERS.addCompatibleGtuType(DefaultsNl.ROAD_USER);
204 VEHICLES.addCompatibleGtuType(DefaultsNl.VEHICLE);
205 TRAFFIC_LIGHT.addCompatibleGtuType(DefaultsNl.BICYCLE);
206 }
207
208 }