Eclipse SUMO - Simulation of Urban MObility
NBFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Sets and checks options for netbuild
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <fstream>
27 #include "NBFrame.h"
28 #include "NBNodeCont.h"
29 #include "NBEdgeCont.h"
31 #include "NBDistrictCont.h"
32 #include "NBRequest.h"
33 #include "NBTypeCont.h"
38 #include <utils/common/ToString.h>
42 
43 
44 // ===========================================================================
45 // method definitions
46 // ===========================================================================
47 void
48 NBFrame::fillOptions(bool forNetgen) {
50  // register building defaults
51  oc.doRegister("default.lanenumber", 'L', new Option_Integer(1));
52  oc.addSynonyme("default.lanenumber", "lanenumber", true);
53  oc.addDescription("default.lanenumber", "Building Defaults", "The default number of lanes in an edge");
54 
55  oc.doRegister("default.lanewidth", new Option_Float(NBEdge::UNSPECIFIED_WIDTH));
56  oc.addSynonyme("default.lanewidth", "lanewidth", true);
57  oc.addDescription("default.lanewidth", "Building Defaults", "The default width of lanes");
58 
59  oc.doRegister("default.speed", 'S', new Option_Float((double) 13.89));
60  oc.addSynonyme("default.speed", "speed", true);
61  oc.addDescription("default.speed", "Building Defaults", "The default speed on an edge (in m/s)");
62 
63  oc.doRegister("default.priority", 'P', new Option_Integer(-1));
64  oc.addSynonyme("default.priority", "priority", true);
65  oc.addDescription("default.priority", "Building Defaults", "The default priority of an edge");
66 
67  oc.doRegister("default.type", new Option_String());
68  oc.addDescription("default.type", "Building Defaults", "The default edge type");
69 
70  oc.doRegister("default.sidewalk-width", new Option_Float((double) 2.0));
71  oc.addDescription("default.sidewalk-width", "Building Defaults", "The default width of added sidewalks");
72 
73  oc.doRegister("default.bikelane-width", new Option_Float((double) 1.0));
74  oc.addDescription("default.bikelane-width", "Building Defaults", "The default width of added bike lanes");
75 
76  oc.doRegister("default.crossing-width", new Option_Float((double) 4.0));
77  oc.addDescription("default.crossing-width", "Building Defaults", "The default width of a pedestrian crossing");
78 
79  oc.doRegister("default.disallow", new Option_String());
80  oc.addDescription("default.disallow", "Building Defaults", "The default for disallowed vehicle classes");
81 
82  oc.doRegister("default.junctions.keep-clear", new Option_Bool(true));
83  oc.addDescription("default.junctions.keep-clear", "Building Defaults", "Whether junctions should be kept clear by default");
84 
85  oc.doRegister("default.junctions.radius", new Option_Float(4));
86  oc.addDescription("default.junctions.radius", "Building Defaults", "The default turning radius of intersections");
87 
88  oc.doRegister("default.right-of-way", new Option_String("default"));
89  oc.addDescription("default.right-of-way", "Building Defaults", "The default algorithm for computing right of way rules ('default', 'edgePriority')");
90 
91  oc.doRegister("junctions.right-before-left.speed-threshold", new Option_Float(49 / 3.6));
92  oc.addDescription("junctions.right-before-left.speed-threshold", "Junctions", "Allow building right-before-left junctions when the incoming edge speeds are below FLOAT (m/s)");
93 
94  // register the data processing options
95  oc.doRegister("no-internal-links", new Option_Bool(false)); // !!! not described
96  oc.addDescription("no-internal-links", "Junctions", "Omits internal links");
97 
98  oc.doRegister("numerical-ids", new Option_Bool(false));
99  oc.addDescription("numerical-ids", "Processing", "Remaps alphanumerical IDs of nodes and edges to ensure that all IDs are integers");
100 
102  oc.doRegister("reserved-ids", new Option_FileName());
103  oc.addDescription("reserved-ids", "Processing", "Ensures that generated ids do not included any of the typed IDs from FILE (SUMO-GUI selection file format)");
104 
105  if (!forNetgen) {
106  oc.doRegister("dismiss-vclasses", new Option_Bool(false));
107  oc.addDescription("dismiss-vclasses", "Processing", "Removes vehicle class restrictions from imported edges");
108  }
109 
110  oc.doRegister("no-turnarounds", new Option_Bool(false));
111  oc.addDescription("no-turnarounds", "Junctions", "Disables building turnarounds");
112 
113  oc.doRegister("no-turnarounds.tls", new Option_Bool(false));
114  oc.addSynonyme("no-turnarounds.tls", "no-tls-turnarounds", true);
115  oc.addDescription("no-turnarounds.tls", "Junctions", "Disables building turnarounds at tls-controlled junctions");
116 
117  oc.doRegister("no-turnarounds.geometry", new Option_Bool(true));
118  oc.addDescription("no-turnarounds.geometry", "Junctions", "Disables building turnarounds at geometry-like junctions");
119 
120  oc.doRegister("no-turnarounds.except-deadend", new Option_Bool(false));
121  oc.addDescription("no-turnarounds.except-deadend", "Junctions", "Disables building turnarounds except at dead end junctions");
122 
123  oc.doRegister("no-left-connections", new Option_Bool(false));
124  oc.addDescription("no-left-connections", "Junctions", "Disables building connections to left");
125 
126  if (!forNetgen) {
127  oc.doRegister("geometry.split", new Option_Bool(false)); // !!!not described
128  oc.addSynonyme("geometry.split", "split-geometry", true);
129  oc.addDescription("geometry.split", "Processing", "Splits edges across geometry nodes");
130 
131  oc.doRegister("geometry.remove", 'R', new Option_Bool(false));
132  oc.addSynonyme("geometry.remove", "remove-geometry", true);
133  oc.addDescription("geometry.remove", "Processing", "Replace nodes which only define edge geometry by geometry points (joins edges)");
134 
135  oc.doRegister("geometry.remove.keep-edges.explicit", new Option_StringVector());
136  oc.addDescription("geometry.remove.keep-edges.explicit", "Processing", "Ensure that the given list of edges is not modified");
137 
138  oc.doRegister("geometry.remove.keep-edges.input-file", new Option_FileName());
139  oc.addDescription("geometry.remove.keep-edges.input-file", "Processing",
140  "Ensure that the edges in FILE are not modified (Each id on a single line. Selection files from SUMO-GUI are also supported)");
141 
142  oc.doRegister("geometry.remove.min-length", new Option_Float(0));
143  oc.addDescription("geometry.remove.min-length", "Processing",
144  "Allow merging edges with differing attributes when their length is below min-length");
145 
146  oc.doRegister("geometry.remove.width-tolerance", new Option_Float(0));
147  oc.addDescription("geometry.remove.width-tolerance", "Processing",
148  "Allow merging edges with differing lane widths if the difference is below FLOAT");
149 
150  oc.doRegister("geometry.max-segment-length", new Option_Float(0));
151  oc.addDescription("geometry.max-segment-length", "Processing", "splits geometry to restrict segment length");
152 
153  oc.doRegister("geometry.min-dist", new Option_Float(-1));
154  oc.addDescription("geometry.min-dist", "Processing", "reduces too similar geometry points");
155 
156  oc.doRegister("geometry.max-angle", new Option_Float(99));
157  oc.addDescription("geometry.max-angle", "Processing", "Warn about edge geometries with an angle above DEGREES in successive segments");
158 
159  oc.doRegister("geometry.min-radius", new Option_Float(9));
160  oc.addDescription("geometry.min-radius", "Processing", "Warn about edge geometries with a turning radius less than METERS at the start or end");
161 
162  oc.doRegister("geometry.min-radius.fix", new Option_Bool(false));
163  oc.addDescription("geometry.min-radius.fix", "Processing", "Straighten edge geometries to avoid turning radii less than geometry.min-radius");
164 
165  oc.doRegister("geometry.min-radius.fix.railways", new Option_Bool(true));
166  oc.addDescription("geometry.min-radius.fix.railways", "Processing", "Straighten edge geometries to avoid turning radii less than geometry.min-radius (only railways)");
167 
168  oc.doRegister("geometry.junction-mismatch-threshold", new Option_Float(20));
169  oc.addDescription("geometry.junction-mismatch-threshold", "Processing", "Warn if the junction shape is to far away from the original node position");
170 
171  oc.doRegister("geometry.check-overlap", new Option_Float(0));
172  oc.addDescription("geometry.check-overlap", "Processing", "Warn if edges overlap by more than the given threshold value");
173 
174  oc.doRegister("geometry.check-overlap.vertical-threshold", new Option_Float(4));
175  oc.addDescription("geometry.check-overlap.vertical-threshold", "Processing", "Ignore overlapping edges if they are separated vertically by the given threshold.");
176 
177  oc.doRegister("geometry.avoid-overlap", new Option_Bool(true));
178  oc.addDescription("geometry.avoid-overlap", "Processing", "Modify edge geometries to avoid overlap at junctions");
179 
180  oc.doRegister("join-lanes", new Option_Bool(false));
181  oc.addDescription("join-lanes", "Processing", "join adjacent lanes that have the same permissions and which do not admit lane-changing (sidewalks and disallowed lanes)");
182 
183  oc.doRegister("ptline.match-dist", new Option_Float(100));
184  oc.addDescription("ptline.match-dist", "Processing", "Matches stops outside the road network to the referencing pt line when below the given distance");
185  // railway processing options
186 
187  oc.doRegister("railway.topology.repair", new Option_Bool(false));
188  oc.addDescription("railway.topology.repair", "Railway", "Repair topology of the railway network");
189 
190  oc.doRegister("railway.topology.repair.connect-straight", new Option_Bool(false));
191  oc.addDescription("railway.topology.repair.connect-straight", "Railway", "Allow bidiretional rail use wherever rails with opposite directions meet at a straight angle");
192 
193  oc.doRegister("railway.topology.all-bidi", new Option_Bool(false));
194  oc.addDescription("railway.topology.all-bidi", "Railway", "Make all rails usable in both direction");
195 
196  oc.doRegister("railway.access-distance", new Option_Float(150.f));
197  oc.addDescription("railway.access-distance", "Railway", "The search radius for finding suitable road accesses for rail stops");
198  oc.addSynonyme("railway.access-distance", "osm.stop-output.footway-access-distance", true);
199 
200  oc.doRegister("railway.max-accesses", new Option_Integer(5));
201  oc.addDescription("railway.max-accesses", "Railway", "The maximum roud accesses registered per rail stops");
202  oc.addSynonyme("railway.max-accesses", "osm.stop-output.footway-max-accesses", true);
203 
204  oc.doRegister("railway.access-factor", new Option_Float(1.5));
205  oc.addDescription("railway.access-factor", "Railway", "The walking length of the access is computed as air-line distance multiplied by FLOAT");
206  oc.addSynonyme("railway.access-factor", "osm.stop-output.footway-access-factor", true);
207  }
208 
209  oc.doRegister("geometry.max-grade", new Option_Float(10));
210  oc.addDescription("geometry.max-grade", "Processing", "Warn about edge geometries with a grade in % above FLOAT.");
211 
212  oc.doRegister("geometry.max-grade.fix", new Option_Bool(true));
213  oc.addDescription("geometry.max-grade.fix", "Processing", "Smooth edge edge geometries with a grade in above the warning threshold.");
214 
215  oc.doRegister("offset.disable-normalization", new Option_Bool(false));
216  oc.addSynonyme("offset.disable-normalization", "disable-normalize-node-positions", true);
217  oc.addDescription("offset.disable-normalization", "Processing", "Turn off normalizing node positions");
218 
219  oc.doRegister("offset.x", new Option_Float(0));
220  oc.addSynonyme("offset.x", "x-offset-to-apply", true);
221  oc.addDescription("offset.x", "Processing", "Adds FLOAT to net x-positions");
222 
223  oc.doRegister("offset.y", new Option_Float(0));
224  oc.addSynonyme("offset.y", "y-offset-to-apply", true);
225  oc.addDescription("offset.y", "Processing", "Adds FLOAT to net y-positions");
226 
227  oc.doRegister("offset.z", new Option_Float(0));
228  oc.addDescription("offset.z", "Processing", "Adds FLOAT to net z-positions");
229 
230  oc.doRegister("flip-y-axis", new Option_Bool(false));
231  oc.addSynonyme("flip-y-axis", "flip-y");
232  oc.addDescription("flip-y-axis", "Processing", "Flips the y-coordinate along zero");
233 
234  oc.doRegister("roundabouts.guess", new Option_Bool(true));
235  oc.addSynonyme("roundabouts.guess", "guess-roundabouts", true);
236  oc.addDescription("roundabouts.guess", "Processing", "Enable roundabout-guessing");
237 
238  oc.doRegister("opposites.guess", new Option_Bool(false));
239  oc.addDescription("opposites.guess", "Processing", "Enable guessing of opposite direction lanes usable for overtaking");
240 
241  oc.doRegister("opposites.guess.fix-lengths", new Option_Bool(false));
242  oc.addDescription("opposites.guess.fix-lengths", "Processing", "Ensure that opposite edges have the same length");
243 
244  oc.doRegister("lefthand", new Option_Bool(false));
245  oc.addDescription("lefthand", "Processing", "Assumes left-hand traffic on the network");
246 
247  oc.doRegister("edges.join", new Option_Bool(false));
248  oc.addDescription("edges.join", "Processing",
249  "Merges edges which connect the same nodes and are close to each other (recommended for VISSIM import)");
250 
251  oc.doRegister("junctions.join", new Option_Bool(false));
252  oc.addDescription("junctions.join", "Junctions",
253  "Joins junctions that are close to each other (recommended for OSM import)");
254 
255  oc.doRegister("junctions.join-dist", new Option_Float(10));
256  oc.addDescription("junctions.join-dist", "Junctions",
257  "Determines the maximal distance for joining junctions (defaults to 10)");
258 
259  if (!forNetgen) {
260  oc.doRegister("junctions.join-exclude", new Option_StringVector());
261  oc.addDescription("junctions.join-exclude", "Junctions", "Interprets STR[] as list of junctions to exclude from joining");
262 
263  oc.doRegister("speed.offset", new Option_Float(0));
264  oc.addDescription("speed.offset", "Processing", "Modifies all edge speeds by adding FLOAT");
265 
266  oc.doRegister("speed.factor", new Option_Float(1));
267  oc.addDescription("speed.factor", "Processing", "Modifies all edge speeds by multiplying by FLOAT");
268 
269  oc.doRegister("speed.minimum", new Option_Float(0));
270  oc.addDescription("speed.minimum", "Processing", "Modifies all edge speeds to at least FLOAT");
271  }
272 
273  oc.doRegister("junctions.corner-detail", new Option_Integer(5));
274  oc.addDescription("junctions.corner-detail", "Junctions", "Generate INT intermediate points to smooth out intersection corners");
275 
276  oc.doRegister("junctions.internal-link-detail", new Option_Integer(5));
277  oc.addDescription("junctions.internal-link-detail", "Junctions", "Generate INT intermediate points to smooth out lanes within the intersection");
278 
279  oc.doRegister("junctions.scurve-stretch", new Option_Float(0));
280  oc.addDescription("junctions.scurve-stretch", "Junctions", "Generate longer intersections to allow for smooth s-curves when the number of lanes changes");
281 
282  oc.doRegister("junctions.join-turns", new Option_Bool(false));
283  oc.addDescription("junctions.join-turns", "Junctions",
284  "Builds common edges for turning connections with common from- and to-edge. This causes discrepancies between geometrical length and assigned length due to averaging but enables lane-changing while turning");
285 
286  oc.doRegister("junctions.limit-turn-speed", new Option_Float(5.5));
287  oc.addDescription("junctions.limit-turn-speed", "Junctions",
288  "Limits speed on junctions to an average lateral acceleration of at most FLOAT m/s^2)");
289 
290  oc.doRegister("junctions.limit-turn-speed.min-angle", new Option_Float(15));
291  oc.addDescription("junctions.limit-turn-speed.min-angle", "Junctions",
292  "Do not limit turn speed for angular changes below FLOAT (degrees). The value is subtracted from the geometric angle before computing the turning radius.");
293 
294  oc.doRegister("junctions.limit-turn-speed.min-angle.railway", new Option_Float(35));
295  oc.addDescription("junctions.limit-turn-speed.min-angle.railway", "Junctions",
296  "Do not limit turn speed for angular changes below FLOAT (degrees) on railway edges. The value is subtracted from the geometric angle before computing the turning radius.");
297 
298  oc.doRegister("junctions.limit-turn-speed.warn.straight", new Option_Float(5));
299  oc.addDescription("junctions.limit-turn-speed.warn.straight", "Junctions",
300  "Warn about turn speed limits that reduce the speed of straight connections by more than FLOAT");
301 
302  oc.doRegister("junctions.limit-turn-speed.warn.turn", new Option_Float(22));
303  oc.addDescription("junctions.limit-turn-speed.warn.turn", "Junctions",
304  "Warn about turn speed limits that reduce the speed of turning connections (no u-turns) by more than FLOAT");
305 
306 
307  oc.doRegister("junctions.small-radius", new Option_Float(1.5));
308  oc.addDescription("junctions.small-radius", "Junctions",
309  "Default radius for junctions that do not require wide vehicle turns");
310 
311  oc.doRegister("rectangular-lane-cut", new Option_Bool(false));
312  oc.addDescription("rectangular-lane-cut", "Junctions", "Forces rectangular cuts between lanes and intersections");
313 
314  oc.doRegister("check-lane-foes.roundabout", new Option_Bool(true));
315  oc.addDescription("check-lane-foes.roundabout", "Junctions",
316  "Allow driving onto a multi-lane road if there are foes on other lanes (at roundabouts)");
317 
318  oc.doRegister("check-lane-foes.all", new Option_Bool(false));
319  oc.addDescription("check-lane-foes.all", "Junctions",
320  "Allow driving onto a multi-lane road if there are foes on other lanes (everywhere)");
321 
322  oc.doRegister("sidewalks.guess", new Option_Bool(false));
323  oc.addDescription("sidewalks.guess", "Pedestrian",
324  "Guess pedestrian sidewalks based on edge speed");
325 
326  oc.doRegister("sidewalks.guess.max-speed", new Option_Float((double) 13.89));
327  oc.addDescription("sidewalks.guess.max-speed", "Pedestrian",
328  "Add sidewalks for edges with a speed equal or below the given limit");
329 
330  oc.doRegister("sidewalks.guess.min-speed", new Option_Float((double) 5.8));
331  oc.addDescription("sidewalks.guess.min-speed", "Pedestrian",
332  "Add sidewalks for edges with a speed above the given limit");
333 
334  oc.doRegister("sidewalks.guess.from-permissions", new Option_Bool(false));
335  oc.addDescription("sidewalks.guess.from-permissions", "Pedestrian",
336  "Add sidewalks for edges that allow pedestrians on any of their lanes regardless of speed");
337 
338  oc.doRegister("sidewalks.guess.exclude", new Option_StringVector());
339  oc.addDescription("sidewalks.guess.exclude", "Pedestrian",
340  "Do not guess sidewalks for the given list of edges");
341 
342  oc.doRegister("bikelanes.guess", new Option_Bool(false));
343  oc.addDescription("bikelanes.guess", "Bicycle",
344  "Guess bike lanes based on edge speed");
345 
346  oc.doRegister("bikelanes.guess.max-speed", new Option_Float((double) 22.22));
347  oc.addDescription("bikelanes.guess.max-speed", "Bicycle",
348  "Add bike lanes for edges with a speed equal or below the given limit");
349 
350  oc.doRegister("bikelanes.guess.min-speed", new Option_Float((double) 5.8));
351  oc.addDescription("bikelanes.guess.min-speed", "Bicycle",
352  "Add bike lanes for edges with a speed above the given limit");
353 
354  oc.doRegister("bikelanes.guess.from-permissions", new Option_Bool(false));
355  oc.addDescription("bikelanes.guess.from-permissions", "Bicycle",
356  "Add bike lanes for edges that allow bicycles on any of their lanes regardless of speed");
357 
358  oc.doRegister("bikelanes.guess.exclude", new Option_StringVector());
359  oc.addDescription("bikelanes.guess.exclude", "Bicycle",
360  "Do not guess bikelanes for the given list of edges");
361 
362  oc.doRegister("crossings.guess", new Option_Bool(false));
363  oc.addDescription("crossings.guess", "Pedestrian",
364  "Guess pedestrian crossings based on the presence of sidewalks");
365 
366  oc.doRegister("crossings.guess.speed-threshold", new Option_Float(13.89));
367  oc.addDescription("crossings.guess.speed-threshold", "Pedestrian",
368  "At uncontrolled nodes, do not build crossings across edges with a speed above the threshold");
369 
370  oc.doRegister("walkingareas", new Option_Bool(false));
371  oc.addDescription("walkingareas", "Pedestrian", "Always build walking areas even if there are no crossings");
372 
373  // tls setting options
374  // explicit tls
375  oc.doRegister("tls.set", new Option_StringVector());
376  oc.addSynonyme("tls.set", "explicite-tls", true);
377  oc.addDescription("tls.set", "TLS Building", "Interprets STR[] as list of junctions to be controlled by TLS");
378 
379  oc.doRegister("tls.unset", new Option_StringVector());
380  oc.addSynonyme("tls.unset", "explicite-no-tls", true);
381  oc.addDescription("tls.unset", "TLS Building", "Interprets STR[] as list of junctions to be not controlled by TLS");
382 
383  // tls-guessing
384  oc.doRegister("tls.guess", new Option_Bool(false));
385  oc.addSynonyme("tls.guess", "guess-tls", true);
386  oc.addDescription("tls.guess", "TLS Building", "Turns on TLS guessing");
387 
388  oc.doRegister("tls.guess.threshold", new Option_Float(250 / 3.6));
389  oc.addDescription("tls.guess.threshold", "TLS Building", "Sets minimum value for the sum of all incoming lane speeds when guessing TLS");
390 
391  if (!forNetgen) {
392  oc.doRegister("tls.taz-nodes", new Option_Bool(false));
393  oc.addSynonyme("tls.taz-nodes", "tls-guess.district-nodes", true);
394  oc.addDescription("tls.taz-nodes", "TLS Building", "Sets district nodes as tls-controlled"); // !!! describe
395  }
396 
397  oc.doRegister("tls.guess.joining", new Option_Bool(false));
398  oc.addSynonyme("tls.guess.joining", "tls-guess.joining", true);
399  oc.addDescription("tls.guess.joining", "TLS Building", "Includes node clusters into guess"); // !!! describe
400 
401  oc.doRegister("tls.join", new Option_Bool(false));
402  oc.addSynonyme("tls.join", "try-join-tls", true);
403  oc.addDescription("tls.join", "TLS Building", "Tries to cluster tls-controlled nodes"); // !!! describe
404 
405  oc.doRegister("tls.join-dist", new Option_Float(20));
406  oc.addDescription("tls.join-dist", "TLS Building",
407  "Determines the maximal distance for joining traffic lights (defaults to 20)");
408 
409  oc.doRegister("tls.uncontrolled-within", new Option_Bool(false));
410  oc.addDescription("tls.uncontrolled-within", "TLS Building",
411  "Do not control edges that lie fully within a joined traffic light. This may cause collisions but allows old traffic light plans to be used");
412 
413  oc.doRegister("tls.ignore-internal-junction-jam", new Option_Bool(false));
414  oc.addDescription("tls.ignore-internal-junction-jam", "TLS Building",
415  "Do not build mutually conflicting response matrix, potentially ignoring vehicles that are stuck at an internal junction when their phase has ended");
416 
417  if (!forNetgen) {
418  oc.doRegister("tls.guess-signals", new Option_Bool(false));
419  oc.addDescription("tls.guess-signals", "TLS Building", "Interprets tls nodes surrounding an intersection as signal positions for a larger TLS. This is typical pattern for OSM-derived networks");
420 
421  oc.doRegister("tls.guess-signals.dist", new Option_Float(25));
422  oc.addDescription("tls.guess-signals.dist", "TLS Building", "Distance for interpreting nodes as signal locations");
423  }
424 
425 
426  // computational
427  oc.doRegister("tls.cycle.time", new Option_Integer(90));
428  oc.addDescription("tls.cycle.time", "TLS Building", "Use INT as cycle duration");
429 
430  oc.doRegister("tls.green.time", new Option_Integer(31));
431  oc.addSynonyme("tls.green.time", "traffic-light-green", true);
432  oc.addDescription("tls.green.time", "TLS Building", "Use INT as green phase duration");
433 
434  oc.doRegister("tls.yellow.min-decel", 'D', new Option_Float(3.0));
435  oc.addSynonyme("tls.yellow.min-decel", "min-decel", true);
436  oc.addDescription("tls.yellow.min-decel", "TLS Building", "Defines smallest vehicle deceleration");
437 
438  oc.doRegister("tls.yellow.patch-small", new Option_Bool(false));
439  oc.addSynonyme("tls.yellow.patch-small", "patch-small-tyellow", true);
440  oc.addDescription("tls.yellow.patch-small", "TLS Building", "Given yellow times are patched even if being too short");
441 
442  oc.doRegister("tls.yellow.time", new Option_Integer(-1));
443  oc.addSynonyme("tls.yellow.time", "traffic-light-yellow", true);
444  oc.addDescription("tls.yellow.time", "TLS Building", "Set INT as fixed time for yellow phase durations");
445 
446  oc.doRegister("tls.red.time", new Option_Integer(5));
447  oc.addDescription("tls.red.time", "TLS Building", "Set INT as fixed time for red phase duration at traffic lights that do not have a conflicting flow");
448 
449  oc.doRegister("tls.allred.time", new Option_Integer(0));
450  oc.addDescription("tls.allred.time", "TLS Building", "Set INT as fixed time for intermediate red phase after every switch");
451 
452  oc.doRegister("tls.minor-left.max-speed", new Option_Float(19.44)); // 70km/h
453  oc.addDescription("tls.minor-left.max-speed", "TLS Building", "Use FLOAT as threshold for allowing left-turning vehicles to move in the same phase as oncoming straight-going vehicles");
454 
455  oc.doRegister("tls.left-green.time", new Option_Integer(6));
456  oc.addDescription("tls.left-green.time", "TLS Building", "Use INT as green phase duration for left turns (s). Setting this value to 0 disables additional left-turning phases");
457 
458  oc.doRegister("tls.crossing-min.time", new Option_Integer(4));
459  oc.addDescription("tls.crossing-min.time", "TLS Building", "Use INT as minimum green duration for pedestrian crossings (s).");
460 
461  oc.doRegister("tls.crossing-clearance.time", new Option_Integer(5));
462  oc.addDescription("tls.crossing-clearance.time", "TLS Building", "Use INT as clearance time for pedestrian crossings (s).");
463 
464  oc.doRegister("tls.scramble.time", new Option_Integer(5));
465  oc.addDescription("tls.scramble.time", "TLS Building", "Use INT as green phase duration for pedestrian scramble phase (s).");
466 
467  // tls-shifts
468  oc.doRegister("tls.half-offset", new Option_StringVector());
469  oc.addSynonyme("tls.half-offset", "tl-logics.half-offset", true);
470  oc.addDescription("tls.half-offset", "TLS Building", "TLSs in STR[] will be shifted by half-phase");
471 
472  oc.doRegister("tls.quarter-offset", new Option_StringVector());
473  oc.addSynonyme("tls.quarter-offset", "tl-logics.quarter-offset", true);
474  oc.addDescription("tls.quarter-offset", "TLS Building", "TLSs in STR[] will be shifted by quarter-phase");
475 
476  // tls type
477  oc.doRegister("tls.default-type", new Option_String("static"));
478  oc.addDescription("tls.default-type", "TLS Building", "TLSs with unspecified type will use STR as their algorithm");
479 
480  oc.doRegister("tls.layout", new Option_String("opposites"));
481  oc.addDescription("tls.layout", "TLS Building", "Set phase layout four grouping opposite directions or grouping all movements for one incoming edge ['opposites', 'incoming']");
482 
483  oc.doRegister("tls.min-dur", new Option_Integer(5));
484  oc.addDescription("tls.min-dur", "TLS Building", "Default minimum phase duration for traffic lights with variable phase length");
485 
486  oc.doRegister("tls.max-dur", new Option_Integer(50));
487  oc.addDescription("tls.max-dur", "TLS Building", "Default maximum phase duration for traffic lights with variable phase length");
488 
489  // edge pruning
490  oc.doRegister("keep-edges.min-speed", new Option_Float(-1));
491  oc.addSynonyme("keep-edges.min-speed", "edges-min-speed", true);
492  oc.addDescription("keep-edges.min-speed", "Edge Removal", "Only keep edges with speed in meters/second > FLOAT");
493 
494  oc.doRegister("remove-edges.explicit", new Option_StringVector());
495  oc.addSynonyme("remove-edges.explicit", "remove-edges");
496  oc.addDescription("remove-edges.explicit", "Edge Removal", "Remove edges in STR[]");
497 
498  oc.doRegister("keep-edges.explicit", new Option_StringVector());
499  oc.addSynonyme("keep-edges.explicit", "keep-edges");
500  oc.addDescription("keep-edges.explicit", "Edge Removal", "Only keep edges in STR[] or those which are kept due to other keep-edges or remove-edges options");
501 
502  oc.doRegister("keep-edges.input-file", new Option_FileName());
503  oc.addDescription("keep-edges.input-file", "Edge Removal", "Only keep edges in FILE (Each id on a single line. Selection files from SUMO-GUI are also supported) or those which are kept due to other keep-edges or remove-edges options");
504 
505  oc.doRegister("remove-edges.input-file", new Option_FileName());
506  oc.addDescription("remove-edges.input-file", "Edge Removal", "Remove edges in FILE. (Each id on a single line. Selection files from SUMO-GUI are also supported)");
507 
508  if (!forNetgen) {
509  oc.doRegister("keep-edges.postload", new Option_Bool(false));
510  oc.addDescription("keep-edges.postload", "Edge Removal", "Remove edges after joining");
511  }
512 
513  oc.doRegister("keep-edges.in-boundary", new Option_StringVector());
514  oc.addDescription("keep-edges.in-boundary", "Edge Removal", "Only keep edges which are located within the given boundary (given either as CARTESIAN corner coordinates <xmin,ymin,xmax,ymax> or as polygon <x0,y0,x1,y1,...>)");
515 
516  oc.doRegister("keep-edges.in-geo-boundary", new Option_StringVector());
517  oc.addDescription("keep-edges.in-geo-boundary", "Edge Removal", "Only keep edges which are located within the given boundary (given either as GEODETIC corner coordinates <lon-min,lat-min,lon-max,lat-max> or as polygon <lon0,lat0,lon1,lat1,...>)");
518 
519  if (!forNetgen) {
520  oc.doRegister("keep-edges.by-vclass", new Option_StringVector());
521  oc.addDescription("keep-edges.by-vclass", "Edge Removal", "Only keep edges which allow one of the vclasss in STR[]");
522 
523  oc.doRegister("remove-edges.by-vclass", new Option_StringVector());
524  oc.addDescription("remove-edges.by-vclass", "Edge Removal", "Remove edges which allow only vclasses from STR[]");
525 
526  oc.doRegister("keep-edges.by-type", new Option_StringVector());
527  oc.addDescription("keep-edges.by-type", "Edge Removal", "Only keep edges where type is in STR[]");
528 
529  oc.doRegister("keep-edges.components", new Option_Integer(0));
530  oc.addDescription("keep-edges.components", "Edge Removal", "Only keep the INT largest weakly connected components");
531 
532  oc.doRegister("remove-edges.by-type", new Option_StringVector());
533  oc.addDescription("remove-edges.by-type", "Edge Removal", "Remove edges where type is in STR[]");
534 
535  oc.doRegister("remove-edges.isolated", new Option_Bool(false));
536  oc.addSynonyme("remove-edges.isolated", "remove-isolated", true);
537  oc.addDescription("remove-edges.isolated", "Edge Removal", "Removes isolated edges");
538  }
539 
540 
541  // unregulated nodes options
542  oc.doRegister("keep-nodes-unregulated", new Option_Bool(false));
543  oc.addSynonyme("keep-nodes-unregulated", "keep-unregulated");
544  oc.addDescription("keep-nodes-unregulated", "Unregulated Nodes", "All nodes will be unregulated");
545 
546  oc.doRegister("keep-nodes-unregulated.explicit", new Option_StringVector());
547  oc.addSynonyme("keep-nodes-unregulated.explicit", "keep-unregulated.explicit");
548  oc.addSynonyme("keep-nodes-unregulated.explicit", "keep-unregulated.nodes", true);
549  oc.addDescription("keep-nodes-unregulated.explicit", "Unregulated Nodes", "Do not regulate nodes in STR[]");
550 
551  oc.doRegister("keep-nodes-unregulated.district-nodes", new Option_Bool(false));
552  oc.addSynonyme("keep-nodes-unregulated.district-nodes", "keep-unregulated.district-nodes");
553  oc.addDescription("keep-nodes-unregulated.district-nodes", "Unregulated Nodes", "Do not regulate district nodes");
554 
555  // ramp guessing options
556  if (!forNetgen) {
557  oc.doRegister("ramps.guess", new Option_Bool(false));
558  oc.addSynonyme("ramps.guess", "guess-ramps", true);
559  oc.addDescription("ramps.guess", "Ramp Guessing", "Enable ramp-guessing");
560 
561  oc.doRegister("ramps.guess-acceleration-lanes", new Option_Bool(true));
562  oc.addDescription("ramps.guess-acceleration-lanes", "Ramp Guessing", "Guess on-ramps and mark acceleration lanes if they exist but do not add new lanes");
563 
564  oc.doRegister("ramps.max-ramp-speed", new Option_Float(-1));
565  oc.addSynonyme("ramps.max-ramp-speed", "ramp-guess.max-ramp-speed", true);
566  oc.addDescription("ramps.max-ramp-speed", "Ramp Guessing", "Treat edges with speed > FLOAT as no ramps");
567 
568  oc.doRegister("ramps.min-highway-speed", new Option_Float((double)(79 / 3.6)));
569  oc.addSynonyme("ramps.min-highway-speed", "ramp-guess.min-highway-speed", true);
570  oc.addDescription("ramps.min-highway-speed", "Ramp Guessing", "Treat edges with speed < FLOAT as no highways");
571 
572  oc.doRegister("ramps.ramp-length", new Option_Float(100));
573  oc.addSynonyme("ramps.ramp-length", "ramp-guess.ramp-length", true);
574  oc.addDescription("ramps.ramp-length", "Ramp Guessing", "Use FLOAT as ramp-length");
575 
576  oc.doRegister("ramps.set", new Option_StringVector());
577  oc.addSynonyme("ramps.set", "ramp-guess.explicite", true);
578  oc.addDescription("ramps.set", "Ramp Guessing", "Tries to handle the given edges as ramps");
579 
580  oc.doRegister("ramps.unset", new Option_StringVector());
581  oc.addDescription("ramps.unset", "Ramp Guessing", "Do not consider the given edges as ramps");
582 
583  oc.doRegister("ramps.no-split", new Option_Bool(false));
584  oc.addSynonyme("ramps.no-split", "ramp-guess.no-split", true);
585  oc.addDescription("ramps.no-split", "Ramp Guessing", "Avoids edge splitting");
586  }
587 }
588 
589 
590 bool
593  bool ok = true;
594  //
595  if (!SUMOXMLDefinitions::TrafficLightTypes.hasString(oc.getString("tls.default-type"))) {
596  WRITE_ERROR("unsupported value '" + oc.getString("tls.default-type") + "' for option '--tls.default-type'");
597  ok = false;
598  }
599  if (oc.isSet("keep-edges.in-boundary") && oc.isSet("keep-edges.in-geo-boundary")) {
600  WRITE_ERROR("only one of the options 'keep-edges.in-boundary' or 'keep-edges.in-geo-boundary' may be given");
601  ok = false;
602  }
603  if (oc.getBool("no-internal-links") && oc.getBool("crossings.guess")) {
604  WRITE_ERROR("only one of the options 'no-internal-links' or 'crossings.guess' may be given");
605  ok = false;
606  }
607  if (oc.getBool("no-internal-links") && oc.getBool("walkingareas")) {
608  WRITE_ERROR("only one of the options 'no-internal-links' or 'walkareas' may be given");
609  ok = false;
610  }
611  if (!oc.isDefault("tls.green.time") && !oc.isDefault("tls.cycle.time")) {
612  WRITE_ERROR("only one of the options 'tls.green.time' or 'tls.cycle.time' may be given");
613  ok = false;
614  }
615  if (oc.getInt("junctions.internal-link-detail") < 2) {
616  WRITE_ERROR("junctions.internal-link-detail must >= 2");
617  ok = false;
618  }
619  if (oc.getFloat("junctions.scurve-stretch") > 0) {
620  if (oc.getBool("no-internal-links")) {
621  WRITE_WARNING("option 'junctions.scurve-stretch' requires internal lanes to work. Option '--no-internal-links' was disabled.");
622  }
623  // make sure the option is set so heuristics cannot ignore it
624  oc.set("no-internal-links", "false");
625  }
626  if (oc.getFloat("junctions.small-radius") > oc.getFloat("default.junctions.radius") && oc.getFloat("default.junctions.radius") >= 0) {
627  WRITE_ERROR("option 'default.junctions.radius' cannot be smaller than option 'junctions.small-radius'");
628  ok = false;
629  }
630  if (oc.getString("tls.layout") != "opposites" && oc.getString("tls.layout") != "incoming") {
631  WRITE_ERROR("tls.layout must be 'opposites' or 'incoming'");
632  ok = false;
633  }
634  if (!oc.isDefault("default.right-of-way") &&
635  !SUMOXMLDefinitions::RightOfWayValues.hasString(oc.getString("default.right-of-way"))) {
636  WRITE_ERROR("default.right-of-way must be one of '" + toString(SUMOXMLDefinitions::RightOfWayValues.getStrings()) + "'");
637  ok = false;
638  }
639  if (oc.isDefault("railway.topology.repair") && oc.getBool("railway.topology.repair.connect-straight")) {
640  oc.set("railway.topology.repair", "true");
641  }
642  return ok;
643 }
644 
645 
646 /****************************************************************************/
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
OptionsCont::getInt
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
Definition: OptionsCont.cpp:215
ToString.h
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
Option_Bool
Definition: Option.h:538
OptionsCont.h
OptionsCont::set
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
Definition: OptionsCont.cpp:241
MsgHandler.h
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
SUMOXMLDefinitions::RightOfWayValues
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
Definition: SUMOXMLDefinitions.h:1377
NBRequest.h
NBEdgeCont.h
GeoConvHelper.h
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
OptionsCont::addDescription
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
Definition: OptionsCont.cpp:469
NBFrame::checkOptions
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
Definition: NBFrame.cpp:591
OptionsCont::addSynonyme
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
Definition: OptionsCont.cpp:95
NBTypeCont.h
OutputDevice.h
OptionsCont::doRegister
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:74
Option_String
Definition: Option.h:399
UtilExceptions.h
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NBFrame::fillOptions
static void fillOptions(bool forNetgen)
Inserts options used by the network converter.
Definition: NBFrame.cpp:48
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:163
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
NBNodeCont.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
Option_StringVector
Definition: Option.h:720
Option_Float
Definition: Option.h:470
NBDistrictCont.h
NBEdge::UNSPECIFIED_WIDTH
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:315
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1392
config.h
NBFrame.h
Option_FileName
Definition: Option.h:783
StringBijection::hasString
bool hasString(const std::string &str) const
Definition: StringBijection.h:116
StringTokenizer.h
NBTrafficLightLogicCont.h
Option_Integer
An integer-option.
Definition: Option.h:331
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
SUMOXMLDefinitions.h