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