Eclipse SUMO - Simulation of Urban MObility
MSFrame.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2002-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
24// Sets and checks options for microsim; inits global outputs and settings
25/****************************************************************************/
26#include <config.h>
27
28#include <iostream>
29#include <iomanip>
30#include <fstream>
31#include <ctime>
42#include <microsim/MSJunction.h>
43#include <microsim/MSRoute.h>
44#include <microsim/MSNet.h>
45#include <microsim/MSLane.h>
46#include <microsim/MSGlobals.h>
52#include "MSFrame.h"
54
55
56// ===========================================================================
57// method definitions
58// ===========================================================================
59void
62 oc.addCallExample("-b 0 -e 1000 -n net.xml -r routes.xml", "start a simulation from time 0 to 1000 with given net and routes");
63 oc.addCallExample("-c munich_config.cfg", "start with a configuration file");
64 oc.addCallExample("--help", "print help");
65
66 // insert options sub-topics
67 SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
68 oc.addOptionSubTopic("Input");
69 oc.addOptionSubTopic("Output");
70 oc.addOptionSubTopic("Time");
71 oc.addOptionSubTopic("Processing");
72 oc.addOptionSubTopic("Routing");
73
74 // register configuration options
75 // register input options
76 oc.doRegister("net-file", 'n', new Option_FileName());
77 oc.addSynonyme("net-file", "net");
78 oc.addDescription("net-file", "Input", "Load road network description from FILE");
79 oc.addXMLDefault("net-file", "net");
80
81 oc.doRegister("route-files", 'r', new Option_FileName());
82 oc.addSynonyme("route-files", "routes");
83 oc.addDescription("route-files", "Input", "Load routes descriptions from FILE(s)");
84
85 oc.doRegister("additional-files", 'a', new Option_FileName());
86 oc.addSynonyme("additional-files", "additional");
87 oc.addDescription("additional-files", "Input", "Load further descriptions from FILE(s)");
88
89 oc.doRegister("weight-files", 'w', new Option_FileName());
90 oc.addSynonyme("weight-files", "weights");
91 oc.addDescription("weight-files", "Input", "Load edge/lane weights for online rerouting from FILE");
92 oc.doRegister("weight-attribute", 'x', new Option_String("traveltime"));
93 oc.addSynonyme("weight-attribute", "measure", true);
94 oc.addDescription("weight-attribute", "Input", "Name of the xml attribute which gives the edge weight");
95
96 oc.doRegister("load-state", new Option_FileName());
97 oc.addDescription("load-state", "Input", "Loads a network state from FILE");
98 oc.doRegister("load-state.offset", new Option_String("0", "TIME"));
99 oc.addDescription("load-state.offset", "Input", "Shifts all times loaded from a saved state by the given offset");
100 oc.doRegister("load-state.remove-vehicles", new Option_StringVector(StringVector({""})));
101 oc.addDescription("load-state.remove-vehicles", "Input", "Removes vehicles with the given IDs from the loaded state");
102
103 oc.doRegister("junction-taz", new Option_Bool(false));
104 oc.addDescription("junction-taz", "Input", "Initialize a TAZ for every junction to use attributes toJunction and fromJunction");
105
106 // need to do this here to be able to check for network and route input options
108
109 // register output options
110 oc.doRegister("netstate-dump", new Option_FileName());
111 oc.addSynonyme("netstate-dump", "ndump");
112 oc.addSynonyme("netstate-dump", "netstate");
113 oc.addSynonyme("netstate-dump", "netstate-output");
114 oc.addDescription("netstate-dump", "Output", "Save complete network states into FILE");
115 oc.doRegister("netstate-dump.empty-edges", new Option_Bool(false));
116 oc.addSynonyme("netstate-dump.empty-edges", "netstate.empty-edges");
117 oc.addSynonyme("netstate-dump.empty-edges", "netstate-output.empty-edges");
118 oc.addSynonyme("netstate-dump.empty-edges", "dump-empty-edges", true);
119 oc.addDescription("netstate-dump.empty-edges", "Output", "Write also empty edges completely when dumping");
120 oc.doRegister("netstate-dump.precision", new Option_Integer(2));
121 oc.addSynonyme("netstate-dump.precision", "netstate.precision");
122 oc.addSynonyme("netstate-dump.precision", "netstate-output.precision");
123 oc.addSynonyme("netstate-dump.precision", "dump-precision", true);
124 oc.addDescription("netstate-dump.precision", "Output", "Write positions and speeds with the given precision (default 2)");
125
126
127 oc.doRegister("emission-output", new Option_FileName());
128 oc.addDescription("emission-output", "Output", "Save the emission values of each vehicle");
129 oc.doRegister("emission-output.precision", new Option_Integer(2));
130 oc.addDescription("emission-output.precision", "Output", "Write emission values with the given precision (default 2)");
131 oc.doRegister("emission-output.geo", new Option_Bool(false));
132 oc.addDescription("emission-output.geo", "Output", "Save the positions in emission output using geo-coordinates (lon/lat)");
133
134 oc.doRegister("emission-output.step-scaled", new Option_Bool(false));
135 oc.addDescription("emission-output.step-scaled", "Output", "Write emission values scaled to the step length rather than as per-second values");
136
137 oc.doRegister("battery-output", new Option_FileName());
138 oc.addDescription("battery-output", "Output", "Save the battery values of each vehicle");
139 oc.doRegister("battery-output.precision", new Option_Integer(2));
140 oc.addDescription("battery-output.precision", "Output", "Write battery values with the given precision (default 2)");
141
142 oc.doRegister("elechybrid-output", new Option_FileName());
143 oc.addDescription("elechybrid-output", "Output", "Save the elecHybrid values of each vehicle");
144 oc.doRegister("elechybrid-output.precision", new Option_Integer(2));
145 oc.addDescription("elechybrid-output.precision", "Output", "Write elecHybrid values with the given precision (default 2)");
146 oc.doRegister("elechybrid-output.aggregated", new Option_Bool(false));
147 oc.addDescription("elechybrid-output.aggregated", "Output", "Write elecHybrid values into one aggregated file");
148
149 oc.doRegister("chargingstations-output", new Option_FileName());
150 oc.addDescription("chargingstations-output", "Output", "Write data of charging stations");
151
152 oc.doRegister("overheadwiresegments-output", new Option_FileName());
153 oc.addDescription("overheadwiresegments-output", "Output", "Write data of overhead wire segments");
154
155 oc.doRegister("substations-output", new Option_FileName());
156 oc.addDescription("substations-output", "Output", "Write data of electrical substation stations");
157 oc.doRegister("substations-output.precision", new Option_Integer(2));
158 oc.addDescription("substations-output.precision", "Output", "Write substation values with the given precision (default 2)");
159
160 oc.doRegister("fcd-output", new Option_FileName());
161 oc.addDescription("fcd-output", "Output", "Save the Floating Car Data");
162 oc.doRegister("fcd-output.geo", new Option_Bool(false));
163 oc.addDescription("fcd-output.geo", "Output", "Save the Floating Car Data using geo-coordinates (lon/lat)");
164 oc.doRegister("fcd-output.signals", new Option_Bool(false));
165 oc.addDescription("fcd-output.signals", "Output", "Add the vehicle signal state to the FCD output (brake lights etc.)");
166 oc.doRegister("fcd-output.distance", new Option_Bool(false));
167 oc.addDescription("fcd-output.distance", "Output", "Add kilometrage to the FCD output (linear referencing)");
168 oc.doRegister("fcd-output.acceleration", new Option_Bool(false));
169 oc.addDescription("fcd-output.acceleration", "Output", "Add acceleration to the FCD output");
170 oc.doRegister("fcd-output.max-leader-distance", new Option_Float(-1));
171 oc.addDescription("fcd-output.max-leader-distance", "Output", "Add leader vehicle information to the FCD output (within the given distance)");
172 oc.doRegister("fcd-output.params", new Option_StringVector());
173 oc.addDescription("fcd-output.params", "Output", "Add generic parameter values to the FCD output");
174 oc.doRegister("fcd-output.filter-edges.input-file", new Option_FileName());
175 oc.addDescription("fcd-output.filter-edges.input-file", "Output", "Restrict fcd output to the edge selection from the given input file");
176 oc.doRegister("fcd-output.attributes", new Option_StringVector());
177 oc.addDescription("fcd-output.attributes", "Output", "List attributes that should be included in the FCD output");
178 oc.doRegister("fcd-output.filter-shapes", new Option_StringVector());
179 oc.addDescription("fcd-output.filter-shapes", "Output", "List shape names that should be used to filter the FCD output");
180
181 oc.doRegister("device.ssm.filter-edges.input-file", new Option_FileName());
182 oc.addDescription("device.ssm.filter-edges.input-file", "Output", "Restrict SSM device output to the edge selection from the given input file");
183
184 oc.doRegister("full-output", new Option_FileName());
185 oc.addDescription("full-output", "Output", "Save a lot of information for each timestep (very redundant)");
186
187 oc.doRegister("queue-output", new Option_FileName());
188 oc.addDescription("queue-output", "Output", "Save the vehicle queues at the junctions (experimental)");
189 oc.doRegister("queue-output.period", new Option_String("-1", "TIME"));
190 oc.addDescription("queue-output.period", "Output", "Save vehicle queues with the given period");
191
192 oc.doRegister("vtk-output", new Option_FileName());
193 oc.addDescription("vtk-output", "Output", "Save complete vehicle positions inclusive speed values in the VTK Format (usage: /path/out will produce /path/out_$TIMESTEP$.vtp files)");
194 oc.doRegister("amitran-output", new Option_FileName());
195 oc.addDescription("amitran-output", "Output", "Save the vehicle trajectories in the Amitran format");
196
197
198 oc.doRegister("summary-output", new Option_FileName());
199 oc.addSynonyme("summary-output", "summary");
200 oc.addDescription("summary-output", "Output", "Save aggregated vehicle departure info into FILE");
201
202 oc.doRegister("summary-output.period", new Option_String("-1", "TIME"));
203 oc.addDescription("summary-output.period", "Output", "Save summary-output with the given period");
204
205 oc.doRegister("person-summary-output", new Option_FileName());
206 oc.addDescription("person-summary-output", "Output", "Save aggregated person counts into FILE");
207
208 oc.doRegister("tripinfo-output", new Option_FileName());
209 oc.addSynonyme("tripinfo-output", "tripinfo");
210 oc.addDescription("tripinfo-output", "Output", "Save single vehicle trip info into FILE");
211
212 oc.doRegister("tripinfo-output.write-unfinished", new Option_Bool(false));
213 oc.addDescription("tripinfo-output.write-unfinished", "Output", "Write tripinfo output for vehicles which have not arrived at simulation end");
214
215 oc.doRegister("tripinfo-output.write-undeparted", new Option_Bool(false));
216 oc.addDescription("tripinfo-output.write-undeparted", "Output", "Write tripinfo output for vehicles which have not departed at simulation end because of depart delay");
217
218 oc.doRegister("vehroute-output", new Option_FileName());
219 oc.addSynonyme("vehroute-output", "vehroutes");
220 oc.addDescription("vehroute-output", "Output", "Save single vehicle route info into FILE");
221
222 oc.doRegister("vehroute-output.exit-times", new Option_Bool(false));
223 oc.addSynonyme("vehroute-output.exit-times", "vehroutes.exit-times");
224 oc.addDescription("vehroute-output.exit-times", "Output", "Write the exit times for all edges");
225
226 oc.doRegister("vehroute-output.last-route", new Option_Bool(false));
227 oc.addSynonyme("vehroute-output.last-route", "vehroutes.last-route");
228 oc.addDescription("vehroute-output.last-route", "Output", "Write the last route only");
229
230 oc.doRegister("vehroute-output.sorted", new Option_Bool(false));
231 oc.addSynonyme("vehroute-output.sorted", "vehroutes.sorted");
232 oc.addDescription("vehroute-output.sorted", "Output", "Sorts the output by departure time");
233
234 oc.doRegister("vehroute-output.dua", new Option_Bool(false));
235 oc.addSynonyme("vehroute-output.dua", "vehroutes.dua");
236 oc.addDescription("vehroute-output.dua", "Output", "Write the output in the duarouter alternatives style");
237
238 oc.doRegister("vehroute-output.cost", new Option_Bool(false));
239 oc.addDescription("vehroute-output.cost", "Output", "Write costs for all routes");
240
241 oc.doRegister("vehroute-output.intended-depart", new Option_Bool(false));
242 oc.addSynonyme("vehroute-output.intended-depart", "vehroutes.intended-depart");
243 oc.addDescription("vehroute-output.intended-depart", "Output", "Write the output with the intended instead of the real departure time");
244
245 oc.doRegister("vehroute-output.route-length", new Option_Bool(false));
246 oc.addSynonyme("vehroute-output.route-length", "vehroutes.route-length");
247 oc.addDescription("vehroute-output.route-length", "Output", "Include total route length in the output");
248
249 oc.doRegister("vehroute-output.write-unfinished", new Option_Bool(false));
250 oc.addDescription("vehroute-output.write-unfinished", "Output", "Write vehroute output for vehicles which have not arrived at simulation end");
251
252 oc.doRegister("vehroute-output.skip-ptlines", new Option_Bool(false));
253 oc.addDescription("vehroute-output.skip-ptlines", "Output", "Skip vehroute output for public transport vehicles");
254
255 oc.doRegister("vehroute-output.incomplete", new Option_Bool(false));
256 oc.addDescription("vehroute-output.incomplete", "Output", "Include invalid routes and route stubs in vehroute output");
257
258 oc.doRegister("vehroute-output.stop-edges", new Option_Bool(false));
259 oc.addDescription("vehroute-output.stop-edges", "Output", "Include information about edges between stops");
260
261 oc.doRegister("vehroute-output.speedfactor", new Option_Bool(false));
262 oc.addDescription("vehroute-output.speedfactor", "Output", "Write the vehicle speedFactor (defaults to 'true' if departSpeed is written)");
263
264 oc.doRegister("vehroute-output.internal", new Option_Bool(false));
265 oc.addDescription("vehroute-output.internal", "Output", "Include internal edges in the output");
266
267 oc.doRegister("personroute-output", new Option_FileName());
268 oc.addSynonyme("personroute-output", "personroutes");
269 oc.addDescription("personroute-output", "Output", "Save person and container routes to separate FILE");
270
271 oc.doRegister("link-output", new Option_FileName());
272 oc.addDescription("link-output", "Output", "Save links states into FILE");
273
274 oc.doRegister("railsignal-block-output", new Option_FileName());
275 oc.addDescription("railsignal-block-output", "Output", "Save railsignal-blocks into FILE");
276
277 oc.doRegister("bt-output", new Option_FileName());
278 oc.addDescription("bt-output", "Output", "Save bluetooth visibilities into FILE (in conjunction with device.btreceiver and device.btsender)");
279
280 oc.doRegister("lanechange-output", new Option_FileName());
281 oc.addDescription("lanechange-output", "Output", "Record lane changes and their motivations for all vehicles into FILE");
282
283 oc.doRegister("lanechange-output.started", new Option_Bool(false));
284 oc.addDescription("lanechange-output.started", "Output", "Record start of lane change manoeuvres");
285
286 oc.doRegister("lanechange-output.ended", new Option_Bool(false));
287 oc.addDescription("lanechange-output.ended", "Output", "Record end of lane change manoeuvres");
288
289 oc.doRegister("lanechange-output.xy", new Option_Bool(false));
290 oc.addDescription("lanechange-output.xy", "Output", "Record coordinates of lane change manoeuvres");
291
292 oc.doRegister("stop-output", new Option_FileName());
293 oc.addDescription("stop-output", "Output", "Record stops and loading/unloading of passenger and containers for all vehicles into FILE");
294 oc.doRegister("stop-output.write-unfinished", new Option_Bool(false));
295 oc.addDescription("stop-output.write-unfinished", "Output", "Write stop output for stops which have not ended at simulation end");
296
297 oc.doRegister("collision-output", new Option_FileName());
298 oc.addDescription("collision-output", "Output", "Write collision information into FILE");
299
300 oc.doRegister("edgedata-output", new Option_FileName());
301 oc.addDescription("edgedata-output", "Output", "Write aggregated traffic statistics for all edges into FILE");
302 oc.doRegister("lanedata-output", new Option_FileName());
303 oc.addDescription("lanedata-output", "Output", "Write aggregated traffic statistics for all lanes into FILE");
304
305 oc.doRegister("statistic-output", new Option_FileName());
306 oc.addSynonyme("statistic-output", "statistics-output");
307 oc.addDescription("statistic-output", "Output", "Write overall statistics into FILE");
308
309#ifdef _DEBUG
310 oc.doRegister("movereminder-output", new Option_FileName());
311 oc.addDescription("movereminder-output", "Output", "Save movereminder states of selected vehicles into FILE");
312 oc.doRegister("movereminder-output.vehicles", new Option_StringVector());
313 oc.addDescription("movereminder-output.vehicles", "Output", "List of vehicle ids which shall save their movereminder states");
314#endif
315
316 oc.doRegister("save-state.times", new Option_StringVector());
317 oc.addDescription("save-state.times", "Output", "Use TIME[] as times at which a network state written");
318 oc.doRegister("save-state.period", new Option_String("-1", "TIME"));
319 oc.addDescription("save-state.period", "Output", "save state repeatedly after TIME period");
320 oc.doRegister("save-state.period.keep", new Option_Integer(0));
321 oc.addDescription("save-state.period.keep", "Output", "Keep only the last INT periodic state files");
322 oc.doRegister("save-state.prefix", new Option_FileName(StringVector({ "state" })));
323 oc.addDescription("save-state.prefix", "Output", "Prefix for network states");
324 oc.doRegister("save-state.suffix", new Option_String(".xml.gz"));
325 oc.addDescription("save-state.suffix", "Output", "Suffix for network states (.xml.gz or .xml)");
326 oc.doRegister("save-state.files", new Option_FileName());
327 oc.addDescription("save-state.files", "Output", "Files for network states");
328 oc.doRegister("save-state.rng", new Option_Bool(false));
329 oc.addDescription("save-state.rng", "Output", "Save random number generator states");
330 oc.doRegister("save-state.transportables", new Option_Bool(false));
331 oc.addDescription("save-state.transportables", "Output", "Save person and container states (experimental)");
332 oc.doRegister("save-state.constraints", new Option_Bool(false));
333 oc.addDescription("save-state.constraints", "Output", "Save rail signal constraints");
334 oc.doRegister("save-state.precision", new Option_Integer(2));
335 oc.addDescription("save-state.precision", "Output", "Write internal state values with the given precision (default 2)");
336
337 // register the simulation settings
338 oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
339 oc.addDescription("begin", "Time", "Defines the begin time in seconds; The simulation starts at this time");
340
341 oc.doRegister("end", 'e', new Option_String("-1", "TIME"));
342 oc.addDescription("end", "Time", "Defines the end time in seconds; The simulation ends at this time");
343
344 oc.doRegister("step-length", new Option_String("1", "TIME"));
345 oc.addDescription("step-length", "Time", "Defines the step duration in seconds");
346
347 oc.doRegister("step-method.ballistic", new Option_Bool(false));
348 oc.addDescription("step-method.ballistic", "Processing", "Whether to use ballistic method for the positional update of vehicles (default is a semi-implicit Euler method).");
349
350 oc.doRegister("extrapolate-departpos", new Option_Bool(false));
351 oc.addDescription("extrapolate-departpos", "Processing", "Whether vehicles that depart between simulation steps should extrapolate the depart position");
352
353 oc.doRegister("threads", new Option_Integer(1));
354 oc.addDescription("threads", "Processing", "Defines the number of threads for parallel simulation");
355
356 oc.doRegister("lateral-resolution", new Option_Float(-1));
357 oc.addDescription("lateral-resolution", "Processing", "Defines the resolution in m when handling lateral positioning within a lane (with -1 all vehicles drive at the center of their lane");
358
359 // register the processing options
360 oc.doRegister("route-steps", 's', new Option_String("200", "TIME"));
361 oc.addDescription("route-steps", "Processing", "Load routes for the next number of seconds ahead");
362
363 oc.doRegister("no-internal-links", new Option_Bool(false));
364 oc.addDescription("no-internal-links", "Processing", "Disable (junction) internal links");
365
366 oc.doRegister("ignore-junction-blocker", new Option_String("-1", "TIME"));
367 oc.addDescription("ignore-junction-blocker", "Processing", "Ignore vehicles which block the junction after they have been standing for SECONDS (-1 means never ignore)");
368
369 oc.doRegister("ignore-route-errors", new Option_Bool(false));
370 oc.addDescription("ignore-route-errors", "Processing", "Do not check whether routes are connected");
371
372 oc.doRegister("ignore-accidents", new Option_Bool(false));
373 oc.addDescription("ignore-accidents", "Processing", "Do not check whether accidents occur");
374
375 oc.doRegister("collision.action", new Option_String("teleport"));
376 oc.addDescription("collision.action", "Processing", "How to deal with collisions: [none,warn,teleport,remove]");
377
378 oc.doRegister("collision.stoptime", new Option_String("0", "TIME"));
379 oc.addDescription("collision.stoptime", "Processing", "Let vehicle stop for TIME before performing collision.action (except for action 'none')");
380
381 oc.doRegister("collision.check-junctions", new Option_Bool(false));
382 oc.addDescription("collision.check-junctions", "Processing", "Enables collisions checks on junctions");
383
384 oc.doRegister("collision.check-junctions.mingap", new Option_Float(0));
385 oc.addDescription("collision.check-junctions.mingap", "Processing", "Increase or decrease sensitivity for junction collision check");
386
387 oc.doRegister("collision.mingap-factor", new Option_Float(-1));
388 oc.addDescription("collision.mingap-factor", "Processing", "Sets the fraction of minGap that must be maintained to avoid collision detection. If a negative value is given, the carFollowModel parameter is used");
389
390 oc.doRegister("max-num-vehicles", new Option_Integer(-1));
391 oc.addDescription("max-num-vehicles", "Processing", "Delay vehicle insertion to stay within the given maximum number");
392
393 oc.doRegister("max-num-teleports", new Option_Integer(-1));
394 oc.addDescription("max-num-teleports", "Processing", "Abort the simulation if the given maximum number of teleports is exceeded");
395
396 oc.doRegister("scale", new Option_Float(1.));
397 oc.addDescription("scale", "Processing", "Scale demand by the given factor (by discarding or duplicating vehicles)");
398
399 oc.doRegister("scale-suffix", new Option_String("."));
400 oc.addDescription("scale-suffix", "Processing", "Suffix to be added when creating ids for cloned vehicles");
401
402 oc.doRegister("time-to-teleport", new Option_String("300", "TIME"));
403 oc.addDescription("time-to-teleport", "Processing", "Specify how long a vehicle may wait until being teleported, defaults to 300, non-positive values disable teleporting");
404
405 oc.doRegister("time-to-teleport.highways", new Option_String("0", "TIME"));
406 oc.addDescription("time-to-teleport.highways", "Processing", "The waiting time after which vehicles on a fast road (speed > 69km/h) are teleported if they are on a non-continuing lane");
407
408 oc.doRegister("time-to-teleport.highways.min-speed", new Option_Float(69 / 3.6));
409 oc.addDescription("time-to-teleport.highways.min-speed", "Processing", "The waiting time after which vehicles on a fast road (default: speed > 69km/h) are teleported if they are on a non-continuing lane");
410
411 oc.doRegister("time-to-teleport.disconnected", new Option_String("-1", "TIME"));
412 oc.addDescription("time-to-teleport.disconnected", "Processing", "The waiting time after which vehicles with a disconnected route are teleported. Negative values disable teleporting");
413
414 oc.doRegister("time-to-teleport.remove", new Option_Bool(false));
415 oc.addDescription("time-to-teleport.remove", "Processing", "Whether vehicles shall be removed after waiting too long instead of being teleported");
416
417 oc.doRegister("time-to-teleport.ride", new Option_String("-1", "TIME"));
418 oc.addDescription("time-to-teleport.ride", "Processing", "The waiting time after which persons / containers waiting for a pickup are teleported. Negative values disable teleporting");
419
420 oc.doRegister("time-to-teleport.bidi", new Option_String("-1", "TIME"));
421 oc.addDescription("time-to-teleport.bidi", "Processing", "The waiting time after which vehicles on bidirectional edges are teleported");
422
423 oc.doRegister("waiting-time-memory", new Option_String("100", "TIME"));
424 oc.addDescription("waiting-time-memory", "Processing", "Length of time interval, over which accumulated waiting time is taken into account (default is 100s.)");
425
426 oc.doRegister("startup-wait-threshold", new Option_String("2", "TIME"));
427 oc.addDescription("startup-wait-threshold", "Processing", "Minimum consecutive waiting time before applying startupDelay");
428
429 oc.doRegister("max-depart-delay", new Option_String("-1", "TIME"));
430 oc.addDescription("max-depart-delay", "Processing", "How long vehicles wait for departure before being skipped, defaults to -1 which means vehicles are never skipped");
431
432 oc.doRegister("sloppy-insert", new Option_Bool(false));
433 oc.addDescription("sloppy-insert", "Processing", "Whether insertion on an edge shall not be repeated in same step once failed");
434
435 oc.doRegister("eager-insert", new Option_Bool(false));
436 oc.addDescription("eager-insert", "Processing", "Whether each vehicle is checked separately for insertion on an edge");
437
438 oc.doRegister("emergency-insert", new Option_Bool(false));
439 oc.addDescription("emergency-insert", "Processing", "Allow inserting a vehicle in a situation which requires emergency braking");
440
441 oc.doRegister("random-depart-offset", new Option_String("0", "TIME"));
442 oc.addDescription("random-depart-offset", "Processing", "Each vehicle receives a random offset to its depart value drawn uniformly from [0, TIME]");
443
444 oc.doRegister("lanechange.duration", new Option_String("0", "TIME"));
445 oc.addDescription("lanechange.duration", "Processing", "Duration of a lane change maneuver (default 0)");
446
447 oc.doRegister("lanechange.overtake-right", new Option_Bool(false));
448 oc.addDescription("lanechange.overtake-right", "Processing", "Whether overtaking on the right on motorways is permitted");
449
450 oc.doRegister("tls.all-off", new Option_Bool(false));
451 oc.addDescription("tls.all-off", "Processing", "Switches off all traffic lights.");
452
453 oc.doRegister("tls.actuated.show-detectors", new Option_Bool(false));
454 oc.addDescription("tls.actuated.show-detectors", "Processing", "Sets default visibility for actuation detectors");
455
456 oc.doRegister("tls.actuated.jam-threshold", new Option_Float(-1));
457 oc.addDescription("tls.actuated.jam-threshold", "Processing", "Sets default jam-treshold parameter for all actuation detectors");
458
459 oc.doRegister("tls.actuated.detector-length", new Option_Float(0));
460 oc.addDescription("tls.actuated.detector-length", "Processing", "Sets default detector length parameter for all actuation detectors");
461
462 oc.doRegister("tls.delay_based.detector-range", new Option_Float(100));
463 oc.addDescription("tls.delay_based.detector-range", "Processing", "Sets default range for detecting delayed vehicles");
464
465 oc.doRegister("tls.yellow.min-decel", new Option_Float(3.0));
466 oc.addDescription("tls.yellow.min-decel", "Processing", "Minimum deceleration when braking at yellow");
467
468 oc.doRegister("railsignal-moving-block", new Option_Bool(false));
469 oc.addDescription("railsignal-moving-block", "Processing", "Let railsignals operate in moving-block mode by default");
470
471 oc.doRegister("time-to-impatience", new Option_String("180", "TIME"));
472 oc.addDescription("time-to-impatience", "Processing", "Specify how long a vehicle may wait until impatience grows from 0 to 1, defaults to 300, non-positive values disable impatience growth");
473
474 oc.doRegister("default.action-step-length", new Option_Float(0.0));
475 oc.addDescription("default.action-step-length", "Processing", "Length of the default interval length between action points for the car-following and lane-change models (in seconds). If not specified, the simulation step-length is used per default. Vehicle- or VType-specific settings override the default. Must be a multiple of the simulation step-length.");
476
477 oc.doRegister("default.carfollowmodel", new Option_String("Krauss"));
478 oc.addDescription("default.carfollowmodel", "Processing", "Select default car following model (Krauss, IDM, ...)");
479 oc.addSynonyme("default.carfollowmodel", "carfollow.model");
480
481 oc.doRegister("default.speeddev", new Option_Float(-1));
482 oc.addDescription("default.speeddev", "Processing", "Select default speed deviation. A negative value implies vClass specific defaults (0.1 for the default passenger class");
483
484 oc.doRegister("default.emergencydecel", new Option_String("default"));
485 oc.addDescription("default.emergencydecel", "Processing", "Select default emergencyDecel value among ('decel', 'default', FLOAT) which sets the value either to the same as the deceleration value, a vClass-class specific default or the given FLOAT in m/s^2");
486
487 oc.doRegister("overhead-wire.solver", new Option_Bool(true));
488 oc.addDescription("overhead-wire.solver", "Processing", "Use Kirchhoff's laws for solving overhead wire circuit");
489
490 oc.doRegister("overhead-wire.recuperation", new Option_Bool(true));
491 oc.addDescription("overhead-wire.recuperation", "Processing", "Enable recuperation from the vehicle equipped with elecHybrid device into the ovrehead wire.");
492
493 oc.doRegister("overhead-wire.substation-current-limits", new Option_Bool(true));
494 oc.addDescription("overhead-wire.substation-current-limits", "Processing", "Enable current limits of traction substation during solving the overhead wire electrical circuit.");
495
496 oc.doRegister("emergencydecel.warning-threshold", new Option_Float(1));
497 oc.addDescription("emergencydecel.warning-threshold", "Processing", "Sets the fraction of emergency decel capability that must be used to trigger a warning.");
498
499 oc.doRegister("parking.maneuver", new Option_Bool(false));
500 oc.addDescription("parking.maneuver", "Processing", "Whether parking simulation includes manoeuvering time and associated lane blocking");
501
502 oc.doRegister("use-stop-ended", new Option_Bool(false));
503 oc.addDescription("use-stop-ended", "Processing", "Override stop until times with stop ended times when given");
504
505 // pedestrian model
506 oc.doRegister("pedestrian.model", new Option_String("striping"));
507 oc.addDescription("pedestrian.model", "Processing", "Select among pedestrian models ['nonInteracting', 'striping', 'remote']");
508
509 oc.doRegister("pedestrian.striping.stripe-width", new Option_Float(0.64));
510 oc.addDescription("pedestrian.striping.stripe-width", "Processing", "Width of parallel stripes for segmenting a sidewalk (meters) for use with model 'striping'");
511
512 oc.doRegister("pedestrian.striping.dawdling", new Option_Float(0.2));
513 oc.addDescription("pedestrian.striping.dawdling", "Processing", "Factor for random slow-downs [0,1] for use with model 'striping'");
514
515 oc.doRegister("pedestrian.striping.mingap-to-vehicle", new Option_Float(0.25));
516 oc.addDescription("pedestrian.striping.mingap-to-vehicle", "Processing", "Minimal gap / safety buffer (in meters) from a pedestrian to another vehicle for use with model 'striping'");
517
518 oc.doRegister("pedestrian.striping.jamtime", new Option_String("300", "TIME"));
519 oc.addDescription("pedestrian.striping.jamtime", "Processing", "Time in seconds after which pedestrians start squeezing through a jam when using model 'striping' (non-positive values disable squeezing)");
520 oc.doRegister("pedestrian.striping.jamtime.crossing", new Option_String("10", "TIME"));
521 oc.addDescription("pedestrian.striping.jamtime.crossing", "Processing", "Time in seconds after which pedestrians start squeezing through a jam while on a pedestrian crossing when using model 'striping' (non-positive values disable squeezing)");
522 oc.doRegister("pedestrian.striping.jamtime.narrow", new Option_String("1", "TIME"));
523 oc.addDescription("pedestrian.striping.jamtime.narrow", "Processing", "Time in seconds after which pedestrians start squeezing through a jam while on a narrow lane when using model 'striping'");
524
525 oc.doRegister("pedestrian.striping.reserve-oncoming", new Option_Float(0.0));
526 oc.addDescription("pedestrian.striping.reserve-oncoming", "Processing", "Fraction of stripes to reserve for oncoming pedestrians");
527
528 oc.doRegister("pedestrian.striping.reserve-oncoming.junctions", new Option_Float(0.34));
529 oc.addDescription("pedestrian.striping.reserve-oncoming.junctions", "Processing", "Fraction of stripes to reserve for oncoming pedestrians on crossings and walkingareas");
530
531 oc.doRegister("pedestrian.striping.legacy-departposlat", new Option_Bool(false));
532 oc.addDescription("pedestrian.striping.legacy-departposlat", "Processing", "Interpret departPosLat for walks in legacy style");
533
534 oc.doRegister("pedestrian.striping.walkingarea-detail", new Option_Integer(4));
535 oc.addDescription("pedestrian.striping.walkingarea-detail", "Processing", "Generate INT intermediate points to smooth out lanes within the walkingarea");
536
537 oc.doRegister("pedestrian.remote.address", new Option_String("localhost:9000"));
538 oc.addDescription("pedestrian.remote.address", "Processing", "The address (host:port) of the external simulation");
539
540 oc.doRegister("ride.stop-tolerance", new Option_Float(10.));
541 oc.addDescription("ride.stop-tolerance", "Processing", "Tolerance to apply when matching pedestrian and vehicle positions on boarding at individual stops");
542
543 // generic routing options
544 oc.doRegister("routing-algorithm", new Option_String("dijkstra"));
545 oc.addDescription("routing-algorithm", "Routing",
546 "Select among routing algorithms ['dijkstra', 'astar', 'CH', 'CHWrapper']");
547
548 oc.doRegister("weights.random-factor", new Option_Float(1.));
549 oc.addDescription("weights.random-factor", "Routing", "Edge weights for routing are dynamically disturbed by a random factor drawn uniformly from [1,FLOAT)");
550
551 oc.doRegister("weights.minor-penalty", new Option_Float(1.5));
552 oc.addDescription("weights.minor-penalty", "Routing", "Apply the given time penalty when computing minimum routing costs for minor-link internal lanes");
553
554 oc.doRegister("weights.tls-penalty", new Option_Float(0));
555 oc.addDescription("weights.tls-penalty", "Routing", "Apply scaled travel time penalties based on green split when computing minimum routing costs for internal lanes at traffic lights");
556
557 oc.doRegister("weights.priority-factor", new Option_Float(0));
558 oc.addDescription("weights.priority-factor", "Routing", "Consider edge priorities in addition to travel times, weighted by factor");
559
560 oc.doRegister("weights.separate-turns", new Option_Float(0));
561 oc.addDescription("weights.separate-turns", "Routing", "Distinguish travel time by turn direction and shift a fraction of the estimated time loss ahead of the intersection onto the internal edges");
562
563 oc.doRegister("astar.all-distances", new Option_FileName());
564 oc.addDescription("astar.all-distances", "Routing", "Initialize lookup table for astar from the given file (generated by marouter --all-pairs-output)");
565
566 oc.doRegister("astar.landmark-distances", new Option_FileName());
567 oc.addDescription("astar.landmark-distances", "Routing", "Initialize lookup table for astar ALT-variant from the given file");
568
569 oc.doRegister("persontrip.walkfactor", new Option_Float(double(0.75)));
570 oc.addDescription("persontrip.walkfactor", "Routing", "Use FLOAT as a factor on pedestrian maximum speed during intermodal routing");
571
572 oc.doRegister("persontrip.walk-opposite-factor", new Option_Float(1.0));
573 oc.addDescription("persontrip.walk-opposite-factor", "Processing", "Use FLOAT as a factor on walking speed against vehicle traffic direction");
574
575 oc.doRegister("persontrip.transfer.car-walk", new Option_StringVector(StringVector({ "parkingAreas" })));
576 oc.addDescription("persontrip.transfer.car-walk", "Routing",
577 "Where are mode changes from car to walking allowed (possible values: 'parkingAreas', 'ptStops', 'allJunctions' and combinations)");
578
579 oc.doRegister("persontrip.transfer.taxi-walk", new Option_StringVector());
580 oc.addDescription("persontrip.transfer.taxi-walk", "Routing", "Where taxis can drop off customers ('allJunctions, 'ptStops')");
581
582 oc.doRegister("persontrip.transfer.walk-taxi", new Option_StringVector());
583 oc.addDescription("persontrip.transfer.walk-taxi", "Routing", "Where taxis can pick up customers ('allJunctions, 'ptStops')");
584
585 oc.doRegister("persontrip.default.group", new Option_String());
586 oc.addDescription("persontrip.default.group", "Routing", "When set, trips between the same origin and destination will share a taxi by default");
587
588 oc.doRegister("persontrip.taxi.waiting-time", new Option_String("300", "TIME"));
589 oc.addDescription("persontrip.taxi.waiting-time", "Routing", "Estimated time for taxi pickup");
590
591 oc.doRegister("railway.max-train-length", new Option_Float(1000.0));
592 oc.addDescription("railway.max-train-length", "Routing", "Use FLOAT as a maximum train length when initializing the railway router");
593
594 oc.doRegister("replay-rerouting", new Option_Bool(false));
595 oc.addDescription("replay-rerouting", "Routing", "Replay exact rerouting sequence from vehroute-output");
596
597 // devices
598 oc.addOptionSubTopic("Emissions");
599 oc.doRegister("emissions.volumetric-fuel", new Option_Bool(false));
600 oc.addDescription("emissions.volumetric-fuel", "Emissions", "Return fuel consumption values in (legacy) unit l instead of mg");
601
602 oc.doRegister("phemlight-path", new Option_FileName(StringVector({ "./PHEMlight/" })));
603 oc.addDescription("phemlight-path", "Emissions", "Determines where to load PHEMlight definitions from");
604
605 oc.doRegister("phemlight-year", new Option_Integer(0));
606 oc.addDescription("phemlight-year", "Emissions", "Enable fleet age modelling with the given reference year in PHEMlight5");
607
608 oc.doRegister("phemlight-temperature", new Option_Float(INVALID_DOUBLE));
609 oc.addDescription("phemlight-temperature", "Emissions", "Set ambient temperature to correct NOx emissions in PHEMlight5");
610
611 oc.addOptionSubTopic("Communication");
612 oc.addOptionSubTopic("Battery");
614
615 // register report options
616 oc.doRegister("duration-log.disable", new Option_Bool(false));
617 oc.addSynonyme("duration-log.disable", "no-duration-log", false);
618 oc.addDescription("duration-log.disable", "Report", "Disable performance reports for individual simulation steps");
619
620 oc.doRegister("duration-log.statistics", 't', new Option_Bool(false));
621 oc.addDescription("duration-log.statistics", "Report", "Enable statistics on vehicle trips");
622
623 oc.doRegister("no-step-log", new Option_Bool(false));
624 oc.addDescription("no-step-log", "Report", "Disable console output of current simulation step");
625
626 oc.doRegister("step-log.period", new Option_Integer(100));
627 oc.addDescription("step-log.period", "Report", "Number of simulation steps between step-log outputs");
628
629 //remote port 0 if not used
630 oc.addOptionSubTopic("TraCI Server");
631 oc.doRegister("remote-port", new Option_Integer(0));
632 oc.addDescription("remote-port", "TraCI Server", "Enables TraCI Server if set");
633 oc.doRegister("num-clients", new Option_Integer(1));
634 oc.addDescription("num-clients", "TraCI Server", "Expected number of connecting clients");
635
636 oc.addOptionSubTopic("Mesoscopic");
637 oc.doRegister("mesosim", new Option_Bool(false));
638 oc.addDescription("mesosim", "Mesoscopic", "Enables mesoscopic simulation");
639 oc.doRegister("meso-edgelength", new Option_Float(98.0f));
640 oc.addDescription("meso-edgelength", "Mesoscopic", "Length of an edge segment in mesoscopic simulation");
641 oc.doRegister("meso-tauff", new Option_String("1.13", "TIME"));
642 oc.addDescription("meso-tauff", "Mesoscopic", "Factor for calculating the net free-free headway time");
643 oc.doRegister("meso-taufj", new Option_String("1.13", "TIME"));
644 oc.addDescription("meso-taufj", "Mesoscopic", "Factor for calculating the net free-jam headway time");
645 oc.doRegister("meso-taujf", new Option_String("1.73", "TIME"));
646 oc.addDescription("meso-taujf", "Mesoscopic", "Factor for calculating the jam-free headway time");
647 oc.doRegister("meso-taujj", new Option_String("1.4", "TIME"));
648 oc.addDescription("meso-taujj", "Mesoscopic", "Factor for calculating the jam-jam headway time");
649 oc.doRegister("meso-jam-threshold", new Option_Float(-1));
650 oc.addDescription("meso-jam-threshold", "Mesoscopic",
651 "Minimum percentage of occupied space to consider a segment jammed. A negative argument causes thresholds to be computed based on edge speed and tauff (default)");
652 oc.doRegister("meso-multi-queue", new Option_Bool(true));
653 oc.addDescription("meso-multi-queue", "Mesoscopic", "Enable multiple queues at edge ends");
654 oc.doRegister("meso-lane-queue", new Option_Bool(false));
655 oc.addDescription("meso-lane-queue", "Mesoscopic", "Enable separate queues for every lane");
656 oc.doRegister("meso-ignore-lanes-by-vclass", new Option_StringVector(StringVector({ "pedestrian", "bicycle" })));
657 oc.addDescription("meso-ignore-lanes-by-vclass", "Mesoscopic", "Do not build queues (or reduce capacity) for lanes allowing only the given vclasses");
658 oc.addSynonyme("meso-ignore-lanes-by-vclass", "meso.ignore-lanes.by-vclass");
659 oc.doRegister("meso-junction-control", new Option_Bool(false));
660 oc.addDescription("meso-junction-control", "Mesoscopic", "Enable mesoscopic traffic light and priority junction handling");
661 oc.doRegister("meso-junction-control.limited", new Option_Bool(false));
662 oc.addDescription("meso-junction-control.limited", "Mesoscopic",
663 "Enable mesoscopic traffic light and priority junction handling for saturated links. This prevents faulty traffic lights from hindering flow in low-traffic situations");
664 oc.doRegister("meso-tls-penalty", new Option_Float(0));
665 oc.addDescription("meso-tls-penalty", "Mesoscopic",
666 "Apply scaled travel time penalties when driving across tls controlled junctions based on green split instead of checking actual phases");
667 oc.doRegister("meso-tls-flow-penalty", new Option_Float(0));
668 oc.addDescription("meso-tls-flow-penalty", "Mesoscopic",
669 "Apply scaled headway penalties when driving across tls controlled junctions based on green split instead of checking actual phases");
670 oc.doRegister("meso-minor-penalty", new Option_String("0", "TIME"));
671 oc.addDescription("meso-minor-penalty", "Mesoscopic",
672 "Apply fixed time penalty when driving across a minor link. When using --meso-junction-control.limited, the penalty is not applied whenever limited control is active.");
673 oc.doRegister("meso-overtaking", new Option_Bool(false));
674 oc.addDescription("meso-overtaking", "Mesoscopic", "Enable mesoscopic overtaking");
675 oc.doRegister("meso-recheck", new Option_String("0", "TIME"));
676 oc.addDescription("meso-recheck", "Mesoscopic", "Time interval for rechecking insertion into the next segment after failure");
677
678 // add rand options
680 oc.doRegister("thread-rngs", new Option_Integer(64));
681 oc.addDescription("thread-rngs", "Random Number",
682 "Number of pre-allocated random number generators to ensure repeatable multi-threaded simulations (should be at least the number of threads for repeatable simulations).");
683
684 // add GUI options
685 // the reason that we include them in vanilla sumo as well is to make reusing config files easy
686 oc.addOptionSubTopic("GUI Only");
687 oc.doRegister("gui-settings-file", 'g', new Option_FileName());
688 oc.addDescription("gui-settings-file", "GUI Only", "Load visualisation settings from FILE");
689
690 oc.doRegister("quit-on-end", 'Q', new Option_Bool(false));
691 oc.addDescription("quit-on-end", "GUI Only", "Quits the GUI when the simulation stops");
692
693 oc.doRegister("game", 'G', new Option_Bool(false));
694 oc.addDescription("game", "GUI Only", "Start the GUI in gaming mode");
695
696 oc.doRegister("game.mode", new Option_String("tls"));
697 oc.addDescription("game.mode", "GUI Only", "Select the game type ('tls', 'drt')");
698
699 oc.doRegister("start", 'S', new Option_Bool(false));
700 oc.addDescription("start", "GUI Only", "Start the simulation after loading");
701
702 oc.doRegister("delay", 'd', new Option_Float(0.0));
703 oc.addDescription("delay", "GUI Only", "Use FLOAT in ms as delay between simulation steps");
704
705 oc.doRegister("breakpoints", 'B', new Option_StringVector());
706 oc.addDescription("breakpoints", "GUI Only", "Use TIME[] as times when the simulation should halt");
707
708 oc.doRegister("edgedata-files", new Option_FileName());
709 oc.addSynonyme("edgedata-files", "data-files");
710 oc.addDescription("edgedata-files", "GUI Only", "Load edge/lane weights for visualization from FILE");
711
712 oc.doRegister("demo", 'D', new Option_Bool(false));
713 oc.addDescription("demo", "GUI Only", "Restart the simulation after ending (demo mode)");
714
715 oc.doRegister("disable-textures", 'T', new Option_Bool(false));
716 oc.addDescription("disable-textures", "GUI Only", "Do not load background pictures");
717
718 oc.doRegister("registry-viewport", new Option_Bool(false));
719 oc.addDescription("registry-viewport", "GUI Only", "Load current viewport from registry");
720
721 oc.doRegister("window-size", new Option_StringVector());
722 oc.addDescription("window-size", "GUI Only", "Create initial window with the given x,y size");
723
724 oc.doRegister("window-pos", new Option_StringVector());
725 oc.addDescription("window-pos", "GUI Only", "Create initial window at the given x,y position");
726
727 oc.doRegister("tracker-interval", new Option_String("1", "TIME"));
728 oc.addDescription("tracker-interval", "GUI Only", "The aggregation period for value tracker windows");
729
730#ifdef HAVE_OSG
731 oc.doRegister("osg-view", new Option_Bool(false));
732 oc.addDescription("osg-view", "GUI Only", "Start with an OpenSceneGraph view instead of the regular 2D view");
733#endif
734
735 // gui testing
736 oc.doRegister("gui-testing", new Option_Bool(false));
737 oc.addDescription("gui-testing", "GUI Only", "Enable overlay for screen recognition");
738
739 // gui testing - debug
740 oc.doRegister("gui-testing-debug", new Option_Bool(false));
741 oc.addDescription("gui-testing-debug", "GUI Only", "Enable output messages during GUI-Testing");
742
743 // gui testing - settings output
744 oc.doRegister("gui-testing.setting-output", new Option_FileName());
745 oc.addDescription("gui-testing.setting-output", "GUI Only", "Save gui settings in the given settings output file");
746}
747
748
749void
751 // standard outputs
752 OutputDevice::createDeviceByOption("netstate-dump", "netstate", "netstate_file.xsd");
753 OutputDevice::createDeviceByOption("summary-output", "summary", "summary_file.xsd");
754 OutputDevice::createDeviceByOption("person-summary-output", "personSummary", "person_summary_file.xsd");
755 OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos", "tripinfo_file.xsd");
756
757 //extended
758 OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd");
759 OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd");
760 OutputDevice::createDeviceByOption("battery-output", "battery-export", "battery_file.xsd");
761 if (OptionsCont::getOptions().getBool("elechybrid-output.aggregated")) {
762 // RICE_TODO: Add path to elechybrid-output.aggregated xsd file
763 OutputDevice::createDeviceByOption("elechybrid-output", "elecHybrid-export-aggregated", "\" recuperationEnabled=\"" + toString(MSGlobals::gOverheadWireRecuperation));
764 }
765 //OutputDevice::createDeviceByOption("elecHybrid-output", "elecHybrid-export");
766 OutputDevice::createDeviceByOption("chargingstations-output", "chargingstations-export");
767 OutputDevice::createDeviceByOption("overheadwiresegments-output", "overheadWireSegments-export");
768 OutputDevice::createDeviceByOption("substations-output", "substations-export");
769 OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd");
770 OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd");
771 OutputDevice::createDeviceByOption("amitran-output", "trajectories", "amitran/trajectories.xsd\" timeStepSize=\"" + toString(STEPS2MS(DELTA_T)));
772
773 //OutputDevice::createDeviceByOption("vtk-output", "vtk-export");
774 OutputDevice::createDeviceByOption("link-output", "link-output");
775 OutputDevice::createDeviceByOption("railsignal-block-output", "railsignal-block-output");
776 OutputDevice::createDeviceByOption("bt-output", "bt-output");
777 OutputDevice::createDeviceByOption("lanechange-output", "lanechanges");
778 OutputDevice::createDeviceByOption("stop-output", "stops", "stopinfo_file.xsd");
779 OutputDevice::createDeviceByOption("collision-output", "collisions", "collision_file.xsd");
780 OutputDevice::createDeviceByOption("statistic-output", "statistics", "statistic_file.xsd");
781
782#ifdef _DEBUG
783 OutputDevice::createDeviceByOption("movereminder-output", "movereminder-output");
784#endif
785
788}
789
790
791bool
794 bool ok = true;
795 if (!oc.isSet("net-file") && oc.isDefault("remote-port")) {
796 WRITE_ERROR(TL("No network file (-n) specified."));
797 ok = false;
798 }
799 if (oc.getFloat("scale") < 0.) {
800 WRITE_ERROR(TL("Invalid scaling factor."));
801 ok = false;
802 }
803 if (oc.getBool("vehroute-output.exit-times") && !oc.isSet("vehroute-output")) {
804 WRITE_ERROR(TL("A vehroute-output file is needed for exit times."));
805 ok = false;
806 }
807 if (oc.isSet("gui-settings-file") &&
808 oc.getString("gui-settings-file") != "" &&
809 !oc.isUsableFileList("gui-settings-file")) {
810 ok = false;
811 }
812 if (oc.getBool("demo") && oc.isDefault("start")) {
813 oc.setDefault("start", "true");
814 }
815 if (oc.getBool("demo") && oc.getBool("quit-on-end")) {
816 WRITE_ERROR(TL("You can either restart or quit on end."));
817 ok = false;
818 }
819 if (oc.getBool("meso-junction-control.limited") && !oc.getBool("meso-junction-control")) {
820 if (!oc.isDefault("meso-junction-control")) {
821 WRITE_WARNING(TL("The option 'meso-junction-control.limited' implies 'meso-junction-control'."))
822 }
823 oc.setDefault("meso-junction-control", "true");
824 }
825 if (oc.getBool("mesosim")) {
826 if (oc.isDefault("pedestrian.model")) {
827 oc.setDefault("pedestrian.model", "nonInteracting");
828 }
829 }
830 if (string2time(oc.getString("device.fcd.begin")) < 0) {
831 oc.setDefault("device.fcd.begin", oc.getString("begin"));
832 }
833 if (string2time(oc.getString("device.emissions.begin")) < 0) {
834 oc.setDefault("device.emissions.begin", oc.getString("begin"));
835 }
836 const SUMOTime begin = string2time(oc.getString("begin"));
837 const SUMOTime end = string2time(oc.getString("end"));
838 if (begin < 0) {
839 WRITE_ERROR(TL("The begin time should not be negative."));
840 ok = false;
841 }
842 // DELTA_T not yet initialized
843 const SUMOTime deltaT = MAX2((SUMOTime)1, string2time(oc.getString("step-length")));
844 if (begin < TIME2STEPS(1)) {
845 checkStepLengthMultiple(begin, " for begin", deltaT);
846 }
847 if (end != string2time("-1")) {
848 if (end < begin) {
849 WRITE_ERROR(TL("The end time should be after the begin time."));
850 ok = false;
851 }
852 }
853 if (string2time(oc.getString("step-length")) <= 0) {
854 WRITE_ERROR(TL("the minimum step-length is 0.001"));
855 ok = false;
856 }
857 const SUMOTime period = string2time(oc.getString("device.fcd.period"));
858 if (period > 0) {
859 checkStepLengthMultiple(period, " for device.fcd.period", deltaT);
860 }
861 const SUMOTime statePeriod = string2time(oc.getString("save-state.period"));
862 if (statePeriod > 0) {
863 checkStepLengthMultiple(statePeriod, " for save-state.period", deltaT);
864 }
865 for (const std::string& timeStr : oc.getStringVector("save-state.times")) {
866 try {
867 const SUMOTime saveT = string2time(timeStr);
868 if (end > 0 && saveT >= end) {
869 WRITE_WARNING("The save-state time=" + timeStr + " will not be used before simulation end at " + time2string(end) + ".");
870 } else {
871 checkStepLengthMultiple(saveT, " for save-state.times", deltaT);
872 }
873 } catch (ProcessError& e) {
874 WRITE_ERROR("Invalid time '" + timeStr + "' for option 'save-state.times'. " + e.what());
875 ok = false;
876 }
877 }
878
879#ifdef _DEBUG
880 if (oc.isSet("movereminder-output.vehicles") && !oc.isSet("movereminder-output")) {
881 WRITE_ERROR(TL("option movereminder-output.vehicles requires option movereminder-output to be set"));
882 ok = false;
883 }
884#endif
885 if (oc.getBool("sloppy-insert")) {
886 WRITE_WARNING(TL("The option 'sloppy-insert' is deprecated, because it is now activated by default, see the new option 'eager-insert'."));
887 }
888 if (string2time(oc.getString("lanechange.duration")) > 0 && oc.getFloat("lateral-resolution") > 0) {
889 WRITE_ERROR(TL("Only one of the options 'lanechange.duration' or 'lateral-resolution' may be given."));
890 ok = false;
891 }
892 if (oc.getBool("mesosim") && (oc.getFloat("lateral-resolution") > 0 || string2time(oc.getString("lanechange.duration")) > 0)) {
893 WRITE_ERROR(TL("Sublane dynamics are not supported by mesoscopic simulation"));
894 ok = false;
895 }
896 if (oc.getBool("ignore-accidents")) {
897 WRITE_WARNING(TL("The option 'ignore-accidents' is deprecated. Use 'collision.action none' instead."));
898 }
899 if (oc.getBool("duration-log.statistics") && oc.isDefault("verbose")) {
900 oc.setDefault("verbose", "true");
901 }
902 if (oc.isDefault("precision") && string2time(oc.getString("step-length")) % 10 != 0) {
903 oc.setDefault("precision", "3");
904 }
905 if (oc.isDefault("tracker-interval") && !oc.isDefault("step-length")) {
906 oc.setDefault("tracker-interval", oc.getString("step-length"));
907 }
908 if (oc.getBool("tripinfo-output.write-undeparted")) {
909 if (!oc.isDefault("tripinfo-output.write-unfinished") && !oc.getBool("tripinfo-output.write-unfinished")) {
910 WRITE_WARNING(TL("The option tripinfo-output.write-undeparted implies tripinfo-output.write-unfinished."));
911 }
912 oc.setDefault("tripinfo-output.write-unfinished", "true");
913 }
914 if (oc.getInt("precision") > 2) {
915 if (oc.isDefault("netstate-dump.precision")) {
916 oc.setDefault("netstate-dump.precision", toString(oc.getInt("precision")));
917 }
918 if (oc.isDefault("emission-output.precision")) {
919 oc.setDefault("emission-output.precision", toString(oc.getInt("precision")));
920 }
921 if (oc.isDefault("battery-output.precision")) {
922 oc.setDefault("battery-output.precision", toString(oc.getInt("precision")));
923 }
924 if (oc.isDefault("elechybrid-output.precision")) {
925 oc.setDefault("elechybrid-output.precision", toString(oc.getInt("precision")));
926 }
927 if (oc.isDefault("substations-output.precision")) {
928 oc.setDefault("substations-output.precision", toString(oc.getInt("precision")));
929 }
930 }
931 if (!SUMOXMLDefinitions::CarFollowModels.hasString(oc.getString("carfollow.model"))) {
932 WRITE_ERROR("Unknown model '" + oc.getString("carfollow.model") + "' for option 'carfollow.model'.");
933 ok = false;
934 }
935 if (oc.isSet("default.emergencydecel")) {
936 const std::string val = oc.getString("default.emergencydecel");
937 if (val != "default" && val != "decel") {
938 try {
940 } catch (NumberFormatException&) {
941 WRITE_ERROR("Invalid value '" + val + "' for option 'default.emergencydecel'. Must be a FLOAT or 'default' or 'decel'");
942 ok = false;
943 }
944 }
945 }
946 if (oc.getFloat("delay") < 0.0) {
947 WRITE_ERROR(TL("You need a non-negative delay."));
948 ok = false;
949 }
950 for (const std::string& val : oc.getStringVector("breakpoints")) {
951 try {
952 string2time(val);
953 } catch (ProcessError& e) {
954 WRITE_ERROR("Invalid time '" + val + "' for option 'breakpoints'. " + e.what());
955 ok = false;
956 }
957 }
958#ifndef HAVE_FOX
959 if (oc.getInt("threads") > 1) {
960 WRITE_ERROR(TL("Parallel simulation is only possible when compiled with Fox."));
961 ok = false;
962 }
963#endif
964 if (oc.getInt("threads") < 1) {
965 WRITE_ERROR(TL("You need at least one thread."));
966 ok = false;
967 }
968 if (oc.getInt("threads") > oc.getInt("thread-rngs")) {
969 WRITE_WARNING(TL("Number of threads exceeds number of thread-rngs. Simulation runs with the same seed may produce different results"));
970 }
971 if (oc.getString("game.mode") != "tls" && oc.getString("game.mode") != "drt") {
972 WRITE_ERROR(TL("game.mode must be one of ['tls', 'drt']"));
973 ok = false;
974 }
975
976 if (oc.isSet("persontrip.transfer.car-walk")) {
977 for (const std::string& opt : OptionsCont::getOptions().getStringVector("persontrip.transfer.car-walk")) {
978 if (opt != "parkingAreas" && opt != "ptStops" && opt != "allJunctions") {
979 WRITE_ERROR("Invalid transfer option '" + opt + "'. Must be one of 'parkingAreas', 'ptStops' and 'allJunctions'");
980 ok = false;
981 }
982 }
983 }
984
985 ok &= MSDevice::checkOptions(oc);
987
988 return ok;
989}
990
991
992void
994 // pre-initialise the network
995 // set whether empty edges shall be printed on dump
996 MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges");
997 // set whether internal lanes shall be used
998 MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links");
999 MSGlobals::gIgnoreJunctionBlocker = string2time(oc.getString("ignore-junction-blocker")) < 0 ?
1000 std::numeric_limits<SUMOTime>::max() : string2time(oc.getString("ignore-junction-blocker"));
1001 // set the grid lock time
1002 MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport"));
1003 MSGlobals::gTimeToImpatience = string2time(oc.getString("time-to-impatience"));
1004 MSGlobals::gTimeToGridlockHighways = string2time(oc.getString("time-to-teleport.highways")) < 0 ? 0 : string2time(oc.getString("time-to-teleport.highways"));
1005 MSGlobals::gGridlockHighwaysSpeed = oc.getFloat("time-to-teleport.highways.min-speed");
1006 MSGlobals::gTimeToTeleportDisconnected = string2time(oc.getString("time-to-teleport.disconnected"));
1007 MSGlobals::gTimeToTeleportBidi = string2time(oc.getString("time-to-teleport.bidi"));
1008 MSGlobals::gRemoveGridlocked = oc.getBool("time-to-teleport.remove");
1009 MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents");
1010 MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors");
1011 MSGlobals::gEmergencyInsert = oc.getBool("emergency-insert");
1012 MSGlobals::gWeightsSeparateTurns = oc.getFloat("weights.separate-turns");
1013 MSGlobals::gStartupWaitThreshold = string2time(oc.getString("startup-wait-threshold"));
1014 MSGlobals::gLaneChangeDuration = string2time(oc.getString("lanechange.duration"));
1015 MSGlobals::gLateralResolution = oc.getFloat("lateral-resolution");
1017 MSGlobals::gStateLoaded = oc.isSet("load-state");
1018 MSGlobals::gUseMesoSim = oc.getBool("mesosim");
1019 MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited");
1022 }
1023 MSGlobals::gWaitingTimeMemory = string2time(oc.getString("waiting-time-memory"));
1025 MSGlobals::gOverheadWireSolver = oc.getBool("overhead-wire.solver");
1026 MSGlobals::gOverheadWireRecuperation = oc.getBool("overhead-wire.recuperation");
1027 MSGlobals::gOverheadWireCurrentLimits = oc.getBool("overhead-wire.substation-current-limits");
1028
1030
1031 DELTA_T = string2time(oc.getString("step-length"));
1032
1033 const bool integrationMethodSet = !oc.isDefault("step-method.ballistic");
1034 const bool actionStepLengthSet = !oc.isDefault("default.action-step-length");
1035 MSGlobals::gSemiImplicitEulerUpdate = !oc.getBool("step-method.ballistic");
1036 // Init default value for gActionStepLength
1037 if (MSGlobals::gSemiImplicitEulerUpdate && actionStepLengthSet && !integrationMethodSet) {
1038 WRITE_MESSAGE(TL("Integration method was set to 'ballistic', since a default action step length was specified."));
1040 }
1041 double givenDefaultActionStepLength = oc.getFloat("default.action-step-length");
1043
1044 const std::string defaultEmergencyDecelOption = OptionsCont::getOptions().getString("default.emergencydecel");
1045 if (defaultEmergencyDecelOption == "default") {
1047 } else if (defaultEmergencyDecelOption == "decel") {
1049 } else {
1050 // value already checked in checkOptions()
1051 MSGlobals::gDefaultEmergencyDecel = StringUtils::toDouble(defaultEmergencyDecelOption);
1052 }
1053 MSGlobals::gNumSimThreads = oc.getInt("threads");
1054 MSGlobals::gNumThreads = MAX2(MSGlobals::gNumSimThreads, oc.getInt("device.rerouting.threads"));
1055
1056 MSGlobals::gEmergencyDecelWarningThreshold = oc.getFloat("emergencydecel.warning-threshold");
1057 MSGlobals::gMinorPenalty = oc.getFloat("weights.minor-penalty");
1058 MSGlobals::gTLSPenalty = oc.getFloat("weights.tls-penalty");
1059
1060 MSGlobals::gModelParkingManoeuver = oc.getBool("parking.maneuver");
1061
1062 MSGlobals::gStopTolerance = oc.getFloat("ride.stop-tolerance");
1063 MSGlobals::gTLSYellowMinDecel = oc.getFloat("tls.yellow.min-decel");
1064 MSGlobals::gUseStopEnded = oc.getBool("use-stop-ended");
1065
1066#ifdef _DEBUG
1067 if (oc.isSet("movereminder-output")) {
1068 MSBaseVehicle::initMoveReminderOutput(oc);
1069 }
1070#endif
1071}
1072
1073
1074/****************************************************************************/
long long int SUMOTime
Definition: GUI.h:36
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:267
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:274
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
#define TL(string)
Definition: MsgHandler.h:282
std::vector< std::string > StringVector
Definition of a vector of strings.
Definition: Option.h:43
bool checkStepLengthMultiple(const SUMOTime t, const std::string &error, SUMOTime deltaT)
check if given SUMOTime is multiple of the step length
Definition: SUMOTime.cpp:123
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
#define STEPS2MS(x)
Definition: SUMOTime.h:58
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
const double INVALID_DOUBLE
Definition: StdDefs.h:60
T MAX2(T a, T b)
Definition: StdDefs.h:77
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
static void init()
Static intialization.
static void insertOptions(OptionsCont &oc)
Inserts options for building devices.
Definition: MSDevice.cpp:70
static bool checkOptions(OptionsCont &oc)
check device-specific options
Definition: MSDevice.cpp:97
static void buildStreams()
Builds the streams used possibly by the simulation.
Definition: MSFrame.cpp:750
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
Definition: MSFrame.cpp:993
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
Definition: MSFrame.cpp:60
static bool checkOptions()
Checks the set options.
Definition: MSFrame.cpp:792
static bool gOverheadWireCurrentLimits
Definition: MSGlobals.h:124
static double gStopTolerance
The tolerance to apply when matching waiting persons and vehicles.
Definition: MSGlobals.h:162
static SUMOTime gTimeToTeleportDisconnected
Definition: MSGlobals.h:66
static bool gModelParkingManoeuver
whether parking simulation includes manoeuver time and any associated lane blocking
Definition: MSGlobals.h:156
static bool gUseMesoSim
Definition: MSGlobals.h:103
static double gMinorPenalty
(minimum) time penalty for passing a minor link when routing
Definition: MSGlobals.h:151
static SUMOTime gTimeToGridlockHighways
Definition: MSGlobals.h:60
static bool gCheckRoutes
Definition: MSGlobals.h:88
static double gGridlockHighwaysSpeed
Definition: MSGlobals.h:63
static double gWeightsSeparateTurns
Whether turning specific weights are estimated (and how much)
Definition: MSGlobals.h:171
static double gTLSPenalty
scaled (minimum) time penalty for passing a tls link when routing
Definition: MSGlobals.h:153
static SUMOTime gStartupWaitThreshold
The minimum waiting time before applying startupDelay.
Definition: MSGlobals.h:174
static bool gOverheadWireRecuperation
Definition: MSGlobals.h:121
static bool gRemoveGridlocked
Definition: MSGlobals.h:72
static double gDefaultEmergencyDecel
encoding of the string-option default.emergencydecel
Definition: MSGlobals.h:127
static double gTLSYellowMinDecel
The minimum deceleration at a yellow traffic light (only overruled by emergencyDecel)
Definition: MSGlobals.h:165
static SUMOTime gTimeToTeleportBidi
Definition: MSGlobals.h:69
static bool gOverheadWireSolver
Definition: MSGlobals.h:118
static double gLateralResolution
Definition: MSGlobals.h:97
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:53
static SUMOTime gTimeToImpatience
Definition: MSGlobals.h:75
static bool gStateLoaded
Information whether a state has been loaded.
Definition: MSGlobals.h:100
static bool gCheck4Accidents
Definition: MSGlobals.h:85
static bool gEmergencyInsert
Definition: MSGlobals.h:91
static int gNumSimThreads
how many threads to use for simulation
Definition: MSGlobals.h:142
static bool gOmitEmptyEdgesOnDump
Information whether empty edges shall be written on dump.
Definition: MSGlobals.h:49
static SUMOTime gIgnoreJunctionBlocker
Definition: MSGlobals.h:82
static bool gSublane
whether sublane simulation is enabled (sublane model or continuous lanechanging)
Definition: MSGlobals.h:159
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:94
static bool gMesoLimitedJunctionControl
Definition: MSGlobals.h:106
static bool gUseStopEnded
whether the simulation should replay previous stop times
Definition: MSGlobals.h:130
static SUMOTime gActionStepLength
default value for the interval between two action points for MSVehicle (defaults to DELTA_T)
Definition: MSGlobals.h:115
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:112
static double gEmergencyDecelWarningThreshold
treshold for warning about strong deceleration
Definition: MSGlobals.h:148
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition: MSGlobals.h:78
static int gNumThreads
how many threads to use
Definition: MSGlobals.h:145
static SUMOTime gTimeToGridlock
Definition: MSGlobals.h:57
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:4116
static void init()
Static intialization.
Definition: MSStopOut.cpp:43
An integer-option.
Definition: Option.h:289
A storage for options typed value containers)
Definition: OptionsCont.h:89
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:76
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
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:97
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool setDefault(const std::string &name, const std::string &value)
Sets the given value for the named option as new default value.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
void addXMLDefault(const std::string &name, const std::string &xmlRoot="")
Adds an XML root element to handle by default. The special root "" denotes the default handler.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:59
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file)
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
static void insertRandOptions()
Initialises the given options container with random number options.
Definition: RandHelper.cpp:58
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
static StringBijection< SumoXMLTag > CarFollowModels
car following models
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:38
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:67
static bool checkOptions()
checks shared options and sets StdDefs