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-2020 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>
33 #include <utils/options/Option.h>
36 #include <utils/common/ToString.h>
41 #include <microsim/MSBaseVehicle.h>
42 #include <microsim/MSJunction.h>
43 #include <microsim/MSRoute.h>
44 #include <microsim/MSNet.h>
45 #include <microsim/MSGlobals.h>
51 #include "MSFrame.h"
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
58 void
61  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");
62  oc.addCallExample("-c munich_config.cfg", "start with a configuration file");
63  oc.addCallExample("--help", "print help");
64 
65  // insert options sub-topics
66  SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
67  oc.addOptionSubTopic("Input");
68  oc.addOptionSubTopic("Output");
69  oc.addOptionSubTopic("Time");
70  oc.addOptionSubTopic("Processing");
71  oc.addOptionSubTopic("Routing");
72 
73  // register configuration options
74  // register input options
75  oc.doRegister("net-file", 'n', new Option_FileName());
76  oc.addSynonyme("net-file", "net");
77  oc.addDescription("net-file", "Input", "Load road network description from FILE");
78  oc.addXMLDefault("net-file", "net");
79 
80  oc.doRegister("route-files", 'r', new Option_FileName());
81  oc.addSynonyme("route-files", "routes");
82  oc.addDescription("route-files", "Input", "Load routes descriptions from FILE(s)");
83 
84  oc.doRegister("additional-files", 'a', new Option_FileName());
85  oc.addSynonyme("additional-files", "additional");
86  oc.addDescription("additional-files", "Input", "Load further descriptions from FILE(s)");
87 
88  oc.doRegister("weight-files", 'w', new Option_FileName());
89  oc.addSynonyme("weight-files", "weights");
90  oc.addDescription("weight-files", "Input", "Load edge/lane weights for online rerouting from FILE");
91  oc.doRegister("weight-attribute", 'x', new Option_String("traveltime"));
92  oc.addSynonyme("weight-attribute", "measure", true);
93  oc.addDescription("weight-attribute", "Input", "Name of the xml attribute which gives the edge weight");
94 
95  oc.doRegister("load-state", new Option_FileName());
96  oc.addDescription("load-state", "Input", "Loads a network state from FILE");
97  oc.doRegister("load-state.offset", new Option_String("0", "TIME"));
98  oc.addDescription("load-state.offset", "Input", "Shifts all times loaded from a saved state by the given offset");
99  oc.doRegister("load-state.remove-vehicles", new Option_StringVector(StringVector({""})));
100  oc.addDescription("load-state.remove-vehicles", "Input", "Removes vehicles with the given IDs from the loaded state");
101 
102  oc.doRegister("junction-taz", new Option_Bool(false));
103  oc.addDescription("junction-taz", "Input", "Initialize a TAZ for every junction to use attributes toJunction and fromJunction");
104 
105  // need to do this here to be able to check for network and route input options
107 
108  // register output options
109  oc.doRegister("netstate-dump", new Option_FileName());
110  oc.addSynonyme("netstate-dump", "ndump");
111  oc.addSynonyme("netstate-dump", "netstate");
112  oc.addSynonyme("netstate-dump", "netstate-output");
113  oc.addDescription("netstate-dump", "Output", "Save complete network states into FILE");
114  oc.doRegister("netstate-dump.empty-edges", new Option_Bool(false));
115  oc.addSynonyme("netstate-dump.empty-edges", "netstate.empty-edges");
116  oc.addSynonyme("netstate-dump.empty-edges", "netstate-output.empty-edges");
117  oc.addSynonyme("netstate-dump.empty-edges", "dump-empty-edges", true);
118  oc.addDescription("netstate-dump.empty-edges", "Output", "Write also empty edges completely when dumping");
119  oc.doRegister("netstate-dump.precision", new Option_Integer(2));
120  oc.addSynonyme("netstate-dump.precision", "netstate.precision");
121  oc.addSynonyme("netstate-dump.precision", "netstate-output.precision");
122  oc.addSynonyme("netstate-dump.precision", "dump-precision", true);
123  oc.addDescription("netstate-dump.precision", "Output", "Write positions and speeds with the given precision (default 2)");
124 
125 
126  oc.doRegister("emission-output", new Option_FileName());
127  oc.addDescription("emission-output", "Output", "Save the emission values of each vehicle");
128  oc.doRegister("emission-output.precision", new Option_Integer(2));
129  oc.addDescription("emission-output.precision", "Output", "Write emission values with the given precision (default 2)");
130 
131  oc.doRegister("battery-output", new Option_FileName());
132  oc.addDescription("battery-output", "Output", "Save the battery values of each vehicle");
133  oc.doRegister("battery-output.precision", new Option_Integer(2));
134  oc.addDescription("battery-output.precision", "Output", "Write battery values with the given precision (default 2)");
135 
136  oc.doRegister("elechybrid-output", new Option_FileName());
137  oc.addDescription("elechybrid-output", "Output", "Save the elecHybrid values of each vehicle");
138  oc.doRegister("elechybrid-output.precision", new Option_Integer(2));
139  oc.addDescription("elechybrid-output.precision", "Output", "Write elecHybrid values with the given precision (default 2)");
140  oc.doRegister("elechybrid-output.aggregated", new Option_Bool(false));
141  oc.addDescription("elechybrid-output.aggregated", "Output", "Write elecHybrid values into one aggregated file");
142 
143  oc.doRegister("chargingstations-output", new Option_FileName());
144  oc.addDescription("chargingstations-output", "Output", "Write data of charging stations");
145 
146  oc.doRegister("overheadwiresegments-output", new Option_FileName());
147  oc.addDescription("overheadwiresegments-output", "Output", "Write data of overhead wire segments");
148 
149  oc.doRegister("substations-output", new Option_FileName());
150  oc.addDescription("substations-output", "Output", "Write data of electrical substation stations");
151 
152  oc.doRegister("fcd-output", new Option_FileName());
153  oc.addDescription("fcd-output", "Output", "Save the Floating Car Data");
154  oc.doRegister("fcd-output.geo", new Option_Bool(false));
155  oc.addDescription("fcd-output.geo", "Output", "Save the Floating Car Data using geo-coordinates (lon/lat)");
156  oc.doRegister("fcd-output.signals", new Option_Bool(false));
157  oc.addDescription("fcd-output.signals", "Output", "Add the vehicle signal state to the FCD output (brake lights etc.)");
158  oc.doRegister("fcd-output.distance", new Option_Bool(false));
159  oc.addDescription("fcd-output.distance", "Output", "Add kilometrage to the FCD output (linear referencing)");
160  oc.doRegister("fcd-output.acceleration", new Option_Bool(false));
161  oc.addDescription("fcd-output.acceleration", "Output", "Add acceleration to the FCD output");
162  oc.doRegister("fcd-output.max-leader-distance", new Option_Float(-1));
163  oc.addDescription("fcd-output.max-leader-distance", "Output", "Add leader vehicle information to the FCD output (within the given distance)");
164  oc.doRegister("fcd-output.params", new Option_StringVector());
165  oc.addDescription("fcd-output.params", "Output", "Add generic parameter values to the FCD output");
166  oc.doRegister("fcd-output.filter-edges.input-file", new Option_FileName());
167  oc.addDescription("fcd-output.filter-edges.input-file", "Output", "Restrict fcd output to the edge selection from the given input file");
168 
169 
170  oc.doRegister("full-output", new Option_FileName());
171  oc.addDescription("full-output", "Output", "Save a lot of information for each timestep (very redundant)");
172  oc.doRegister("queue-output", new Option_FileName());
173  oc.addDescription("queue-output", "Output", "Save the vehicle queues at the junctions (experimental)");
174  oc.doRegister("vtk-output", new Option_FileName());
175  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)");
176  oc.doRegister("amitran-output", new Option_FileName());
177  oc.addDescription("amitran-output", "Output", "Save the vehicle trajectories in the Amitran format");
178 
179 
180  oc.doRegister("summary-output", new Option_FileName());
181  oc.addSynonyme("summary-output", "summary");
182  oc.addDescription("summary-output", "Output", "Save aggregated vehicle departure info into FILE");
183 
184  oc.doRegister("person-summary-output", new Option_FileName());
185  oc.addDescription("person-summary-output", "Output", "Save aggregated person counts into FILE");
186 
187  oc.doRegister("tripinfo-output", new Option_FileName());
188  oc.addSynonyme("tripinfo-output", "tripinfo");
189  oc.addDescription("tripinfo-output", "Output", "Save single vehicle trip info into FILE");
190 
191  oc.doRegister("tripinfo-output.write-unfinished", new Option_Bool(false));
192  oc.addDescription("tripinfo-output.write-unfinished", "Output", "Write tripinfo output for vehicles which have not arrived at simulation end");
193 
194  oc.doRegister("vehroute-output", new Option_FileName());
195  oc.addSynonyme("vehroute-output", "vehroutes");
196  oc.addDescription("vehroute-output", "Output", "Save single vehicle route info into FILE");
197 
198  oc.doRegister("vehroute-output.exit-times", new Option_Bool(false));
199  oc.addSynonyme("vehroute-output.exit-times", "vehroutes.exit-times");
200  oc.addDescription("vehroute-output.exit-times", "Output", "Write the exit times for all edges");
201 
202  oc.doRegister("vehroute-output.last-route", new Option_Bool(false));
203  oc.addSynonyme("vehroute-output.last-route", "vehroutes.last-route");
204  oc.addDescription("vehroute-output.last-route", "Output", "Write the last route only");
205 
206  oc.doRegister("vehroute-output.sorted", new Option_Bool(false));
207  oc.addSynonyme("vehroute-output.sorted", "vehroutes.sorted");
208  oc.addDescription("vehroute-output.sorted", "Output", "Sorts the output by departure time");
209 
210  oc.doRegister("vehroute-output.dua", new Option_Bool(false));
211  oc.addSynonyme("vehroute-output.dua", "vehroutes.dua");
212  oc.addDescription("vehroute-output.dua", "Output", "Write the output in the duarouter alternatives style");
213 
214  oc.doRegister("vehroute-output.cost", new Option_Bool(false));
215  oc.addDescription("vehroute-output.cost", "Output", "Write costs for all routes");
216 
217  oc.doRegister("vehroute-output.intended-depart", new Option_Bool(false));
218  oc.addSynonyme("vehroute-output.intended-depart", "vehroutes.intended-depart");
219  oc.addDescription("vehroute-output.intended-depart", "Output", "Write the output with the intended instead of the real departure time");
220 
221  oc.doRegister("vehroute-output.route-length", new Option_Bool(false));
222  oc.addSynonyme("vehroute-output.route-length", "vehroutes.route-length");
223  oc.addDescription("vehroute-output.route-length", "Output", "Include total route length in the output");
224 
225  oc.doRegister("vehroute-output.write-unfinished", new Option_Bool(false));
226  oc.addDescription("vehroute-output.write-unfinished", "Output", "Write vehroute output for vehicles which have not arrived at simulation end");
227 
228  oc.doRegister("vehroute-output.skip-ptlines", new Option_Bool(false));
229  oc.addDescription("vehroute-output.skip-ptlines", "Output", "Skip vehroute output for public transport vehicles");
230 
231  oc.doRegister("vehroute-output.incomplete", new Option_Bool(false));
232  oc.addDescription("vehroute-output.incomplete", "Output", "Include invalid routes and route stubs in vehroute output");
233 
234  oc.doRegister("vehroute-output.stop-edges", new Option_Bool(false));
235  oc.addDescription("vehroute-output.stop-edges", "Output", "Include information about edges between stops");
236 
237  oc.doRegister("link-output", new Option_FileName());
238  oc.addDescription("link-output", "Output", "Save links states into FILE");
239 
240  oc.doRegister("railsignal-block-output", new Option_FileName());
241  oc.addDescription("railsignal-block-output", "Output", "Save railsignal-blocks into FILE");
242 
243  oc.doRegister("bt-output", new Option_FileName());
244  oc.addDescription("bt-output", "Output", "Save bluetooth visibilities into FILE (in conjunction with device.btreceiver and device.btsender)");
245 
246  oc.doRegister("lanechange-output", new Option_FileName());
247  oc.addDescription("lanechange-output", "Output", "Record lane changes and their motivations for all vehicles into FILE");
248 
249  oc.doRegister("lanechange-output.started", new Option_Bool(false));
250  oc.addDescription("lanechange-output.started", "Output", "Record start of lane change manoeuvres");
251 
252  oc.doRegister("lanechange-output.ended", new Option_Bool(false));
253  oc.addDescription("lanechange-output.ended", "Output", "Record end of lane change manoeuvres");
254 
255  oc.doRegister("lanechange-output.xy", new Option_Bool(false));
256  oc.addDescription("lanechange-output.xy", "Output", "Record coordinates of lane change manoeuvres");
257 
258  oc.doRegister("stop-output", new Option_FileName());
259  oc.addDescription("stop-output", "Output", "Record stops and loading/unloading of passenger and containers for all vehicles into FILE");
260 
261  oc.doRegister("statistic-output", new Option_FileName());
262  oc.addSynonyme("statistic-output", "statistics-output");
263  oc.addDescription("statistic-output", "Output", "Write overall statistics into FILE");
264 
265 #ifdef _DEBUG
266  oc.doRegister("movereminder-output", new Option_FileName());
267  oc.addDescription("movereminder-output", "Output", "Save movereminder states of selected vehicles into FILE");
268  oc.doRegister("movereminder-output.vehicles", new Option_StringVector());
269  oc.addDescription("movereminder-output.vehicles", "Output", "List of vehicle ids which shall save their movereminder states");
270 #endif
271 
272  oc.doRegister("save-state.times", new Option_StringVector());
273  oc.addDescription("save-state.times", "Output", "Use TIME[] as times at which a network state written");
274  oc.doRegister("save-state.period", new Option_String("-1", "TIME"));
275  oc.addDescription("save-state.period", "Output", "save state repeatedly after TIME period");
276  oc.doRegister("save-state.prefix", new Option_FileName(StringVector({ "state" })));
277  oc.addDescription("save-state.prefix", "Output", "Prefix for network states");
278  oc.doRegister("save-state.suffix", new Option_String(".xml.gz"));
279  oc.addDescription("save-state.suffix", "Output", "Suffix for network states (.xml.gz or .xml)");
280  oc.doRegister("save-state.files", new Option_FileName());//
281  oc.addDescription("save-state.files", "Output", "Files for network states");
282  oc.doRegister("save-state.rng", new Option_Bool(false));
283  oc.addDescription("save-state.rng", "Output", "Save random number generator states");
284  oc.doRegister("save-state.transportables", new Option_Bool(false));
285  oc.addDescription("save-state.transportables", "Output", "Save person and container states (experimental)");
286 
287  // register the simulation settings
288  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
289  oc.addDescription("begin", "Time", "Defines the begin time in seconds; The simulation starts at this time");
290 
291  oc.doRegister("end", 'e', new Option_String("-1", "TIME"));
292  oc.addDescription("end", "Time", "Defines the end time in seconds; The simulation ends at this time");
293 
294  oc.doRegister("step-length", new Option_String("1", "TIME"));
295  oc.addDescription("step-length", "Time", "Defines the step duration in seconds");
296 
297  oc.doRegister("step-method.ballistic", new Option_Bool(false));
298  oc.addDescription("step-method.ballistic", "Processing", "Whether to use ballistic method for the positional update of vehicles (default is a semi-implicit Euler method).");
299 
300  oc.doRegister("extrapolate-departpos", new Option_Bool(false));
301  oc.addDescription("extrapolate-departpos", "Processing", "Whether vehicles that depart between simulation steps should extrapolate the depart position");
302 
303  oc.doRegister("threads", new Option_Integer(1));
304  oc.addDescription("threads", "Processing", "Defines the number of threads for parallel simulation");
305 
306  oc.doRegister("lateral-resolution", new Option_Float(-1));
307  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");
308 
309  // register the processing options
310  oc.doRegister("route-steps", 's', new Option_String("200", "TIME"));
311  oc.addDescription("route-steps", "Processing", "Load routes for the next number of seconds ahead");
312 
313  oc.doRegister("no-internal-links", new Option_Bool(false));
314  oc.addDescription("no-internal-links", "Processing", "Disable (junction) internal links");
315 
316  oc.doRegister("ignore-junction-blocker", new Option_String("-1", "TIME"));
317  oc.addDescription("ignore-junction-blocker", "Processing", "Ignore vehicles which block the junction after they have been standing for SECONDS (-1 means never ignore)");
318 
319  oc.doRegister("ignore-route-errors", new Option_Bool(false));
320  oc.addDescription("ignore-route-errors", "Processing", "(1) Do not check whether routes are connected. (2) Allow inserting a vehicle in a situation which requires emergency braking.");
321 
322  oc.doRegister("ignore-accidents", new Option_Bool(false));
323  oc.addDescription("ignore-accidents", "Processing", "Do not check whether accidents occur");
324 
325  oc.doRegister("collision.action", new Option_String("teleport"));
326  oc.addDescription("collision.action", "Processing", "How to deal with collisions: [none,warn,teleport,remove]");
327 
328  oc.doRegister("collision.stoptime", new Option_String("0", "TIME"));
329  oc.addDescription("collision.stoptime", "Processing", "Let vehicle stop for TIME before performing collision.action (except for action 'none')");
330 
331  oc.doRegister("collision.check-junctions", new Option_Bool(false));
332  oc.addDescription("collision.check-junctions", "Processing", "Enables collisions checks on junctions");
333 
334  oc.doRegister("collision.mingap-factor", new Option_Float(-1));
335  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");
336 
337  oc.doRegister("max-num-vehicles", new Option_Integer(-1));
338  oc.addDescription("max-num-vehicles", "Processing", "Delay vehicle insertion to stay within the given maximum number");
339 
340  oc.doRegister("max-num-teleports", new Option_Integer(-1));
341  oc.addDescription("max-num-teleports", "Processing", "Abort the simulation if the given maximum number of teleports is exceeded");
342 
343  oc.doRegister("scale", new Option_Float(1.));
344  oc.addDescription("scale", "Processing", "Scale demand by the given factor (by discarding or duplicating vehicles)");
345 
346  oc.doRegister("time-to-teleport", new Option_String("300", "TIME"));
347  oc.addDescription("time-to-teleport", "Processing", "Specify how long a vehicle may wait until being teleported, defaults to 300, non-positive values disable teleporting");
348 
349  oc.doRegister("time-to-teleport.highways", new Option_String("0", "TIME"));
350  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");
351 
352  oc.doRegister("waiting-time-memory", new Option_String("100", "TIME"));
353  oc.addDescription("waiting-time-memory", "Processing", "Length of time interval, over which accumulated waiting time is taken into account (default is 100s.)");
354 
355  oc.doRegister("max-depart-delay", new Option_String("-1", "TIME"));
356  oc.addDescription("max-depart-delay", "Processing", "How long vehicles wait for departure before being skipped, defaults to -1 which means vehicles are never skipped");
357 
358  oc.doRegister("sloppy-insert", new Option_Bool(false));
359  oc.addDescription("sloppy-insert", "Processing", "Whether insertion on an edge shall not be repeated in same step once failed");
360 
361  oc.doRegister("eager-insert", new Option_Bool(false));
362  oc.addDescription("eager-insert", "Processing", "Whether each vehicle is checked separately for insertion on an edge");
363 
364  oc.doRegister("random-depart-offset", new Option_String("0", "TIME"));
365  oc.addDescription("random-depart-offset", "Processing", "Each vehicle receives a random offset to its depart value drawn uniformly from [0, TIME]");
366 
367  oc.doRegister("lanechange.duration", new Option_String("0", "TIME"));
368  oc.addDescription("lanechange.duration", "Processing", "Duration of a lane change maneuver (default 0)");
369 
370  oc.doRegister("lanechange.overtake-right", new Option_Bool(false));
371  oc.addDescription("lanechange.overtake-right", "Processing", "Whether overtaking on the right on motorways is permitted");
372 
373  oc.doRegister("tls.all-off", new Option_Bool(false));
374  oc.addDescription("tls.all-off", "Processing", "Switches off all traffic lights.");
375 
376  oc.doRegister("tls.actuated.show-detectors", new Option_Bool(false));
377  oc.addDescription("tls.actuated.show-detectors", "Processing", "Sets default visibility for actuation detectors");
378 
379  oc.doRegister("tls.delay_based.detector-range", new Option_Float(100));
380  oc.addDescription("tls.delay_based.detector-range", "Processing", "Sets default range for detecting delayed vehicles");
381 
382  oc.doRegister("time-to-impatience", new Option_String("300", "TIME"));
383  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");
384 
385  oc.doRegister("default.action-step-length", new Option_Float(0.0));
386  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.");
387 
388  oc.doRegister("default.carfollowmodel", new Option_String("Krauss"));
389  oc.addDescription("default.carfollowmodel", "Processing", "Select default car following model (Krauss, IDM, ...)");
390  oc.addSynonyme("default.carfollowmodel", "carfollow.model", false);
391 
392  oc.doRegister("default.speeddev", new Option_Float(-1));
393  oc.addDescription("default.speeddev", "Processing", "Select default speed deviation. A negative value implies vClass specific defaults (0.1 for the default passenger class");
394 
395  oc.doRegister("default.emergencydecel", new Option_String("default"));
396  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");
397 
398  oc.doRegister("overhead-wire-solver", new Option_Bool(true));
399  oc.addDescription("overhead-wire-solver", "Processing", "Use Kirchhoff's laws for solving overhead wire circuit");
400 
401  oc.doRegister("emergencydecel.warning-threshold", new Option_Float(1));
402  oc.addDescription("emergencydecel.warning-threshold", "Processing", "Sets the fraction of emergency decel capability that must be used to trigger a warning.");
403 
404  oc.doRegister("parking.maneuver", new Option_Bool(false));
405  oc.addDescription("parking.maneuver", "Processing", "Whether parking simulation includes manoeuvering time and associated lane blocking");
406 
407  // pedestrian model
408  oc.doRegister("pedestrian.model", new Option_String("striping"));
409  oc.addDescription("pedestrian.model", "Processing", "Select among pedestrian models ['nonInteracting', 'striping', 'remote']");
410 
411  oc.doRegister("pedestrian.striping.stripe-width", new Option_Float(0.64));
412  oc.addDescription("pedestrian.striping.stripe-width", "Processing", "Width of parallel stripes for segmenting a sidewalk (meters) for use with model 'striping'");
413 
414  oc.doRegister("pedestrian.striping.dawdling", new Option_Float(0.2));
415  oc.addDescription("pedestrian.striping.dawdling", "Processing", "Factor for random slow-downs [0,1] for use with model 'striping'");
416 
417  oc.doRegister("pedestrian.striping.jamtime", new Option_String("300", "TIME"));
418  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)");
419  oc.doRegister("pedestrian.striping.jamtime.crossing", new Option_String("10", "TIME"));
420  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)");
421  oc.doRegister("pedestrian.striping.jamtime.narrow", new Option_String("1", "TIME"));
422  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'");
423 
424  oc.doRegister("pedestrian.striping.reserve-oncoming", new Option_Float(0.0));
425  oc.addDescription("pedestrian.striping.reserve-oncoming", "Processing", "Fraction of stripes to reserve for oncoming pedestrians");
426 
427  oc.doRegister("pedestrian.striping.reserve-oncoming.junctions", new Option_Float(0.34));
428  oc.addDescription("pedestrian.striping.reserve-oncoming.junctions", "Processing", "Fraction of stripes to reserve for oncoming pedestrians on crossings and walkingareas");
429 
430  oc.doRegister("pedestrian.remote.address", new Option_String("localhost:9000"));
431  oc.addDescription("pedestrian.remote.address", "Processing", "The address (host:port) of the external simulation");
432 
433  oc.doRegister("ride.stop-tolerance", new Option_Float(10.));
434  oc.addDescription("ride.stop-tolerance", "Processing", "Tolerance to apply when matching pedestrian and vehicle positions on boarding at individual stops");
435 
436  // generic routing options
437  oc.doRegister("routing-algorithm", new Option_String("dijkstra"));
438  oc.addDescription("routing-algorithm", "Routing",
439  "Select among routing algorithms ['dijkstra', 'astar', 'CH', 'CHWrapper']");
440 
441  oc.doRegister("weights.random-factor", new Option_Float(1.));
442  oc.addDescription("weights.random-factor", "Routing", "Edge weights for routing are dynamically disturbed by a random factor drawn uniformly from [1,FLOAT)");
443 
444  oc.doRegister("weights.minor-penalty", new Option_Float(1.5));
445  oc.addDescription("weights.minor-penalty", "Routing", "Apply the given time penalty when computing minimum routing costs for minor-link internal lanes");
446 
447  oc.doRegister("weights.priority-factor", new Option_Float(0));
448  oc.addDescription("weights.priority-factor", "Routing", "Consider edge priorities in addition to travel times, weighted by factor");
449 
450  oc.doRegister("astar.all-distances", new Option_FileName());
451  oc.addDescription("astar.all-distances", "Routing", "Initialize lookup table for astar from the given file (generated by marouter --all-pairs-output)");
452 
453  oc.doRegister("astar.landmark-distances", new Option_FileName());
454  oc.addDescription("astar.landmark-distances", "Routing", "Initialize lookup table for astar ALT-variant from the given file");
455 
456  oc.doRegister("persontrip.walkfactor", new Option_Float(double(0.75)));
457  oc.addDescription("persontrip.walkfactor", "Routing", "Use FLOAT as a factor on pedestrian maximum speed during intermodal routing");
458 
459  oc.doRegister("persontrip.transfer.car-walk", new Option_StringVector(StringVector({ "parkingAreas" })));
460  oc.addDescription("persontrip.transfer.car-walk", "Routing",
461  "Where are mode changes from car to walking allowed (possible values: 'parkingAreas', 'ptStops', 'allJunctions' and combinations)");
462 
463  oc.doRegister("persontrip.transfer.taxi-walk", new Option_StringVector());
464  oc.addDescription("persontrip.transfer.taxi-walk", "Routing", "Where taxis can drop off customers ('allJunctions, 'ptStops')");
465 
466  oc.doRegister("persontrip.transfer.walk-taxi", new Option_StringVector());
467  oc.addDescription("persontrip.transfer.walk-taxi", "Routing", "Where taxis can pick up customers ('allJunctions, 'ptStops')");
468 
469  oc.doRegister("persontrip.default.group", new Option_String());
470  oc.addDescription("persontrip.default.group", "Routing", "When set, trips between the same origin and destination will share a taxi by default");
471 
472  oc.doRegister("persontrip.taxi.waiting-time", new Option_String("300", "TIME"));
473  oc.addDescription("persontrip.taxi.waiting-time", "Routing", "Estimated time for taxi pickup");
474 
475  oc.doRegister("railway.max-train-length", new Option_Float(5000.0));
476  oc.addDescription("railway.max-train-length", "Routing", "Use FLOAT as a maximum train length when initializing the railway router");
477 
478  // devices
479  oc.addOptionSubTopic("Emissions");
480  oc.doRegister("phemlight-path", new Option_FileName(StringVector({ "./PHEMlight/" })));
481  oc.addDescription("phemlight-path", "Emissions", "Determines where to load PHEMlight definitions from.");
482 
483  oc.addOptionSubTopic("Communication");
484  oc.addOptionSubTopic("Battery");
486 
487  // register report options
488  oc.doRegister("duration-log.disable", new Option_Bool(false));
489  oc.addSynonyme("duration-log.disable", "no-duration-log", false);
490  oc.addDescription("duration-log.disable", "Report", "Disable performance reports for individual simulation steps");
491 
492  oc.doRegister("duration-log.statistics", 't', new Option_Bool(false));
493  oc.addDescription("duration-log.statistics", "Report", "Enable statistics on vehicle trips");
494 
495  oc.doRegister("no-step-log", new Option_Bool(false));
496  oc.addDescription("no-step-log", "Report", "Disable console output of current simulation step");
497 
498  oc.doRegister("step-log.period", new Option_Integer(100));
499  oc.addDescription("step-log.period", "Report", "Number of simulation steps between step-log outputs");
500 
501  //remote port 0 if not used
502  oc.addOptionSubTopic("TraCI Server");
503  oc.doRegister("remote-port", new Option_Integer(0));
504  oc.addDescription("remote-port", "TraCI Server", "Enables TraCI Server if set");
505  oc.doRegister("num-clients", new Option_Integer(1));
506  oc.addDescription("num-clients", "TraCI Server", "Expected number of connecting clients");
507 
508  oc.addOptionSubTopic("Mesoscopic");
509  oc.doRegister("mesosim", new Option_Bool(false));
510  oc.addDescription("mesosim", "Mesoscopic", "Enables mesoscopic simulation");
511  oc.doRegister("meso-edgelength", new Option_Float(98.0f));
512  oc.addDescription("meso-edgelength", "Mesoscopic", "Length of an edge segment in mesoscopic simulation");
513  oc.doRegister("meso-tauff", new Option_String("1.13", "TIME"));
514  oc.addDescription("meso-tauff", "Mesoscopic", "Factor for calculating the net free-free headway time");
515  oc.doRegister("meso-taufj", new Option_String("1.13", "TIME"));
516  oc.addDescription("meso-taufj", "Mesoscopic", "Factor for calculating the net free-jam headway time");
517  oc.doRegister("meso-taujf", new Option_String("1.73", "TIME"));
518  oc.addDescription("meso-taujf", "Mesoscopic", "Factor for calculating the jam-free headway time");
519  oc.doRegister("meso-taujj", new Option_String("1.4", "TIME"));
520  oc.addDescription("meso-taujj", "Mesoscopic", "Factor for calculating the jam-jam headway time");
521  oc.doRegister("meso-jam-threshold", new Option_Float(-1));
522  oc.addDescription("meso-jam-threshold", "Mesoscopic",
523  "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)");
524  oc.doRegister("meso-multi-queue", new Option_Bool(true));
525  oc.addDescription("meso-multi-queue", "Mesoscopic", "Enable multiple queues at edge ends");
526  oc.doRegister("meso-lane-queue", new Option_Bool(false));
527  oc.addDescription("meso-lane-queue", "Mesoscopic", "Enable separate queues for every lane");
528  oc.doRegister("meso-junction-control", new Option_Bool(false));
529  oc.addDescription("meso-junction-control", "Mesoscopic", "Enable mesoscopic traffic light and priority junction handling");
530  oc.doRegister("meso-junction-control.limited", new Option_Bool(false));
531  oc.addDescription("meso-junction-control.limited", "Mesoscopic",
532  "Enable mesoscopic traffic light and priority junction handling for saturated links. This prevents faulty traffic lights from hindering flow in low-traffic situations");
533  oc.doRegister("meso-tls-penalty", new Option_Float(0));
534  oc.addDescription("meso-tls-penalty", "Mesoscopic",
535  "Apply scaled travel time penalties when driving across tls controlled junctions based on green split instead of checking actual phases");
536  oc.doRegister("meso-tls-flow-penalty", new Option_Float(0));
537  oc.addDescription("meso-tls-flow-penalty", "Mesoscopic",
538  "Apply scaled headway penalties when driving across tls controlled junctions based on green split instead of checking actual phases");
539  oc.doRegister("meso-minor-penalty", new Option_String("0", "TIME"));
540  oc.addDescription("meso-minor-penalty", "Mesoscopic",
541  "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.");
542  oc.doRegister("meso-overtaking", new Option_Bool(false));
543  oc.addDescription("meso-overtaking", "Mesoscopic", "Enable mesoscopic overtaking");
544  oc.doRegister("meso-recheck", new Option_String("0", "TIME"));
545  oc.addDescription("meso-recheck", "Mesoscopic", "Time interval for rechecking insertion into the next segment after failure");
546 
547  // add rand options
549  oc.doRegister("thread-rngs", new Option_Integer(64));
550  oc.addDescription("thread-rngs", "Random Number",
551  "Number of pre-allocated random number generators to ensure repeatable multi-threaded simulations (should be at least the number of threads for repeatable simulations).");
552 
553  // add GUI options
554  // the reason that we include them in vanilla sumo as well is to make reusing config files easy
555  oc.addOptionSubTopic("GUI Only");
556  oc.doRegister("gui-settings-file", 'g', new Option_FileName());
557  oc.addDescription("gui-settings-file", "GUI Only", "Load visualisation settings from FILE");
558 
559  oc.doRegister("quit-on-end", 'Q', new Option_Bool(false));
560  oc.addDescription("quit-on-end", "GUI Only", "Quits the GUI when the simulation stops");
561 
562  oc.doRegister("game", 'G', new Option_Bool(false));
563  oc.addDescription("game", "GUI Only", "Start the GUI in gaming mode");
564 
565  oc.doRegister("game.mode", new Option_String("tls"));
566  oc.addDescription("game.mode", "GUI Only", "Select the game type ('tls', 'drt')");
567 
568  oc.doRegister("start", 'S', new Option_Bool(false));
569  oc.addDescription("start", "GUI Only", "Start the simulation after loading");
570 
571  oc.doRegister("delay", 'd', new Option_Float(0.0));
572  oc.addDescription("delay", "GUI Only", "Use FLOAT in ms as delay between simulation steps");
573 
574  oc.doRegister("breakpoints", 'B', new Option_StringVector());
575  oc.addDescription("breakpoints", "GUI Only", "Use TIME[] as times when the simulation should halt");
576 
577  oc.doRegister("edgedata-files", new Option_FileName());
578  oc.addDescription("edgedata-files", "GUI Only", "Load edge/lane weights for visualization from FILE");
579 
580  oc.doRegister("demo", 'D', new Option_Bool(false));
581  oc.addDescription("demo", "GUI Only", "Restart the simulation after ending (demo mode)");
582 
583  oc.doRegister("disable-textures", 'T', new Option_Bool(false));
584  oc.addDescription("disable-textures", "GUI Only", "Do not load background pictures");
585 
586  oc.doRegister("registry-viewport", new Option_Bool(false));
587  oc.addDescription("registry-viewport", "GUI Only", "Load current viewport from registry");
588 
589  oc.doRegister("window-size", new Option_StringVector());
590  oc.addDescription("window-size", "GUI Only", "Create initial window with the given x,y size");
591 
592  oc.doRegister("window-pos", new Option_StringVector());
593  oc.addDescription("window-pos", "GUI Only", "Create initial window at the given x,y position");
594 
595  oc.doRegister("tracker-interval", new Option_Float(1.0));
596  oc.addDescription("tracker-interval", "GUI Only", "The aggregation period for value tracker windows");
597 
598 #ifdef HAVE_OSG
599  oc.doRegister("osg-view", new Option_Bool(false));
600  oc.addDescription("osg-view", "GUI Only", "Start with an OpenSceneGraph view instead of the regular 2D view");
601 #endif
602 
603  // gui testing
604  oc.doRegister("gui-testing", new Option_Bool(false));
605  oc.addDescription("gui-testing", "GUI Only", "Enable overlay for screen recognition");
606 
607  // gui testing - debug
608  oc.doRegister("gui-testing-debug", new Option_Bool(false));
609  oc.addDescription("gui-testing-debug", "GUI Only", "Enable output messages during GUI-Testing");
610 
611  // gui testing - settings output
612  oc.doRegister("gui-testing.setting-output", new Option_FileName());
613  oc.addDescription("gui-testing.setting-output", "GUI Only", "Save gui settings in the given settings output file");
614 }
615 
616 
617 void
619  // standard outputs
620  OutputDevice::createDeviceByOption("netstate-dump", "netstate", "netstate_file.xsd");
621  OutputDevice::createDeviceByOption("summary-output", "summary", "summary_file.xsd");
622  OutputDevice::createDeviceByOption("person-summary-output", "personSummary", "person_summary_file.xsd");
623  OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos", "tripinfo_file.xsd");
624 
625  //extended
626  OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd");
627  OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd");
628  OutputDevice::createDeviceByOption("battery-output", "battery-export");
629  if (OptionsCont::getOptions().getBool("elechybrid-output.aggregated")) {
630  OutputDevice::createDeviceByOption("elechybrid-output", "elecHybrid-export-aggregated");
631  }
632  //OutputDevice::createDeviceByOption("elecHybrid-output", "elecHybrid-export");
633  OutputDevice::createDeviceByOption("chargingstations-output", "chargingstations-export");
634  OutputDevice::createDeviceByOption("overheadwiresegments-output", "overheadWireSegments-export");
635  OutputDevice::createDeviceByOption("substations-output", "substations-export");
636  OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd");
637  OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd");
638  OutputDevice::createDeviceByOption("amitran-output", "trajectories", "amitran/trajectories.xsd\" timeStepSize=\"" + toString(STEPS2MS(DELTA_T)));
639 
640  //OutputDevice::createDeviceByOption("vtk-output", "vtk-export");
641  OutputDevice::createDeviceByOption("link-output", "link-output");
642  OutputDevice::createDeviceByOption("railsignal-block-output", "railsignal-block-output");
643  OutputDevice::createDeviceByOption("bt-output", "bt-output");
644  OutputDevice::createDeviceByOption("lanechange-output", "lanechanges");
645  OutputDevice::createDeviceByOption("stop-output", "stops", "stopinfo_file.xsd");
646  OutputDevice::createDeviceByOption("statistic-output", "statistics", "statistic_file.xsd");
647 
648 #ifdef _DEBUG
649  OutputDevice::createDeviceByOption("movereminder-output", "movereminder-output");
650 #endif
651 
653  MSStopOut::init();
654 }
655 
656 
657 bool
660  bool ok = true;
661  if (!oc.isSet("net-file")) {
662  WRITE_ERROR("No network file (-n) specified.");
663  ok = false;
664  }
665  if (oc.getFloat("scale") < 0.) {
666  WRITE_ERROR("Invalid scaling factor.");
667  ok = false;
668  }
669  if (oc.getBool("vehroute-output.exit-times") && !oc.isSet("vehroute-output")) {
670  WRITE_ERROR("A vehroute-output file is needed for exit times.");
671  ok = false;
672  }
673  if (oc.isSet("gui-settings-file") &&
674  oc.getString("gui-settings-file") != "" &&
675  !oc.isUsableFileList("gui-settings-file")) {
676  ok = false;
677  }
678  if (oc.getBool("demo") && oc.isDefault("start")) {
679  oc.set("start", "true");
680  }
681  if (oc.getBool("demo") && oc.getBool("quit-on-end")) {
682  WRITE_ERROR("You can either restart or quit on end.");
683  ok = false;
684  }
685  if (oc.getBool("meso-junction-control.limited") && !oc.getBool("meso-junction-control")) {
686  oc.set("meso-junction-control", "true");
687  }
688  if (oc.getBool("mesosim")) {
689  if (oc.isDefault("pedestrian.model")) {
690  oc.set("pedestrian.model", "nonInteracting");
691  }
692  }
693  const SUMOTime begin = string2time(oc.getString("begin"));
694  const SUMOTime end = string2time(oc.getString("end"));
695  if (begin < 0) {
696  WRITE_ERROR("The begin time should not be negative.");
697  ok = false;
698  }
699  // DELTA_T not yet initialized
700  const SUMOTime deltaT = MAX2((SUMOTime)1, string2time(oc.getString("step-length")));
701  if (begin < TIME2STEPS(1)) {
702  checkStepLengthMultiple(begin, " for begin", deltaT);
703  }
704  if (end != string2time("-1")) {
705  if (end < begin) {
706  WRITE_ERROR("The end time should be after the begin time.");
707  ok = false;
708  }
709  }
710  if (string2time(oc.getString("step-length")) <= 0) {
711  WRITE_ERROR("the minimum step-length is 0.001");
712  ok = false;
713  }
714  const SUMOTime period = string2time(oc.getString("device.fcd.period"));
715  if (period > 0) {
716  checkStepLengthMultiple(period, " for device.fcd.period", deltaT);
717  }
718  const SUMOTime statePeriod = string2time(oc.getString("save-state.period"));
719  if (statePeriod > 0) {
720  checkStepLengthMultiple(statePeriod, " for save-state.period", deltaT);
721  }
722  for (const std::string& timeStr : oc.getStringVector("save-state.times")) {
723  try {
724  const SUMOTime saveT = string2time(timeStr);
725  if (end > 0 && saveT >= end) {
726  WRITE_WARNING("The save-state.time " + timeStr + " will not be used before simulation end at " + time2string(end));
727  } else {
728  checkStepLengthMultiple(saveT, " for save-state.times", deltaT);
729  }
730  } catch (ProcessError& e) {
731  WRITE_ERROR("Invalid time '" + timeStr + "' for option 'save-state.times'. " + e.what());
732  ok = false;
733  }
734  }
735 
736 #ifdef _DEBUG
737  if (oc.isSet("movereminder-output.vehicles") && !oc.isSet("movereminder-output")) {
738  WRITE_ERROR("option movereminder-output.vehicles requires option movereminder-output to be set");
739  ok = false;
740  }
741 #endif
742  if (oc.getBool("sloppy-insert")) {
743  WRITE_WARNING("The option 'sloppy-insert' is deprecated, because it is now activated by default, see the new option 'eager-insert'.");
744  }
745  if (string2time(oc.getString("lanechange.duration")) > 0 && oc.getFloat("lateral-resolution") > 0) {
746  WRITE_ERROR("Only one of the options 'lanechange.duration' or 'lateral-resolution' may be given.");
747  ok = false;
748  }
749  if (oc.getBool("mesosim") && (oc.getFloat("lateral-resolution") > 0 || string2time(oc.getString("lanechange.duration")) > 0)) {
750  WRITE_ERROR("Sublane dynamics are not supported by mesoscopic simulation");
751  ok = false;
752  }
753  if (oc.getBool("ignore-accidents")) {
754  WRITE_WARNING("The option 'ignore-accidents' is deprecated. Use 'collision.action none' instead.");
755  }
756  if (oc.getBool("duration-log.statistics") && oc.isDefault("verbose")) {
757  oc.set("verbose", "true");
758  }
759  if (oc.isDefault("precision") && string2time(oc.getString("step-length")) < 10) {
760  oc.set("precision", "3");
761  }
762  if (oc.isDefault("tracker-interval") && !oc.isDefault("step-length")) {
763  oc.set("tracker-interval", oc.getString("step-length"));
764  }
765  if (oc.getInt("precision") > 2) {
766  if (oc.isDefault("netstate-dump.precision")) {
767  oc.set("netstate-dump.precision", toString(oc.getInt("precision")));
768  }
769  if (oc.isDefault("emission-output.precision")) {
770  oc.set("emission-output.precision", toString(oc.getInt("precision")));
771  }
772  if (oc.isDefault("battery-output.precision")) {
773  oc.set("battery-output.precision", toString(oc.getInt("precision")));
774  }
775  if (oc.isDefault("elechybrid-output.precision")) {
776  oc.set("elechybrid-output.precision", toString(oc.getInt("precision")));
777  }
778  }
779  if (!SUMOXMLDefinitions::CarFollowModels.hasString(oc.getString("carfollow.model"))) {
780  WRITE_ERROR("Unknown model '" + oc.getString("carfollow.model") + "' for option 'carfollow.model'.");
781  ok = false;
782  }
783  if (oc.isSet("default.emergencydecel")) {
784  const std::string val = oc.getString("default.emergencydecel");
785  if (val != "default" && val != "decel") {
786  try {
788  } catch (NumberFormatException&) {
789  WRITE_ERROR("Invalid value '" + val + "' for option 'default.emergencydecel'. Must be a FLOAT or 'default' or 'decel'");
790  ok = false;
791  }
792  }
793  }
794  if (oc.getFloat("delay") < 0.0) {
795  WRITE_ERROR("You need a non-negative delay.");
796  ok = false;
797  }
798  for (const std::string& val : oc.getStringVector("breakpoints")) {
799  try {
800  string2time(val);
801  } catch (ProcessError& e) {
802  WRITE_ERROR("Invalid time '" + val + "' for option 'breakpoints'. " + e.what());
803  ok = false;
804  }
805  }
806 #ifndef HAVE_FOX
807  if (oc.getInt("threads") > 1) {
808  WRITE_ERROR("Parallel simulation is only possible when compiled with Fox.");
809  ok = false;
810  }
811 #endif
812  if (oc.getInt("threads") < 1) {
813  WRITE_ERROR("You need at least one thread.");
814  ok = false;
815  }
816  if (oc.getInt("threads") > oc.getInt("thread-rngs")) {
817  WRITE_WARNING("Number of threads exceeds number of thread-rngs. Simulation runs with the same seed may produce different results");
818  }
819  if (oc.getString("game.mode") != "tls" && oc.getString("game.mode") != "drt") {
820  WRITE_ERROR("game.mode must be one of ['tls', 'drt']");
821  ok = false;
822  }
823 
824  if (oc.isSet("persontrip.transfer.car-walk")) {
825  for (const std::string& opt : OptionsCont::getOptions().getStringVector("persontrip.transfer.car-walk")) {
826  if (opt != "parkingAreas" && opt != "ptStops" && opt != "allJunctions") {
827  WRITE_ERROR("Invalid transfer option '" + opt + "'. Must be one of 'parkingAreas', 'ptStops' and 'allJunctions'");
828  ok = false;
829  }
830  }
831  }
832 
833  ok &= MSDevice::checkOptions(oc);
835 
836  return ok;
837 }
838 
839 
840 void
842  // pre-initialise the network
843  // set whether empty edges shall be printed on dump
844  MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges");
845  // set whether internal lanes shall be used
846  MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links");
847  MSGlobals::gIgnoreJunctionBlocker = string2time(oc.getString("ignore-junction-blocker")) < 0 ?
848  std::numeric_limits<SUMOTime>::max() : string2time(oc.getString("ignore-junction-blocker"));
849  // set the grid lock time
850  MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport"));
851  MSGlobals::gTimeToImpatience = string2time(oc.getString("time-to-impatience"));
852  MSGlobals::gTimeToGridlockHighways = string2time(oc.getString("time-to-teleport.highways")) < 0 ? 0 : string2time(oc.getString("time-to-teleport.highways"));
853  MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents");
854  MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors");
855  MSGlobals::gLaneChangeDuration = string2time(oc.getString("lanechange.duration"));
856  MSGlobals::gLateralResolution = oc.getFloat("lateral-resolution");
858  MSGlobals::gStateLoaded = oc.isSet("load-state");
859  MSGlobals::gUseMesoSim = oc.getBool("mesosim");
860  MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited");
863  }
864  MSGlobals::gWaitingTimeMemory = string2time(oc.getString("waiting-time-memory"));
866  MSGlobals::gOverheadWireSolver = oc.getBool("overhead-wire-solver");
867 
869 
870  DELTA_T = string2time(oc.getString("step-length"));
871 
872 
873  bool integrationMethodSet = !oc.isDefault("step-method.ballistic");
874  bool actionStepLengthSet = !oc.isDefault("default.action-step-length");
875  MSGlobals::gSemiImplicitEulerUpdate = !oc.getBool("step-method.ballistic");
876  // Init default value for gActionStepLength
877  if (MSGlobals::gSemiImplicitEulerUpdate && actionStepLengthSet && !integrationMethodSet) {
878  WRITE_MESSAGE("Integration method was set to 'ballistic', since a default action step length was specified.");
880  }
881  double givenDefaultActionStepLength = oc.getFloat("default.action-step-length");
883 
884  const std::string defaultEmergencyDecelOption = OptionsCont::getOptions().getString("default.emergencydecel");
885  if (defaultEmergencyDecelOption == "default") {
887  } else if (defaultEmergencyDecelOption == "decel") {
889  } else {
890  // value already checked in checkOptions()
891  MSGlobals::gDefaultEmergencyDecel = StringUtils::toDouble(defaultEmergencyDecelOption);
892  }
893  MSGlobals::gNumSimThreads = oc.getInt("threads");
894  MSGlobals::gNumThreads = MAX2(MSGlobals::gNumSimThreads, oc.getInt("device.rerouting.threads"));
895 
896  MSGlobals::gEmergencyDecelWarningThreshold = oc.getFloat("emergencydecel.warning-threshold");
897  MSGlobals::gMinorPenalty = oc.getFloat("weights.minor-penalty");
898 
899  MSGlobals::gModelParkingManoeuver = oc.getBool("parking.maneuver");
900 
901  MSGlobals::gStopTolerance = oc.getFloat("ride.stop-tolerance");
902 
903 #ifdef _DEBUG
904  if (oc.isSet("movereminder-output")) {
905  MSBaseVehicle::initMoveReminderOutput(oc);
906  }
907 #endif
908 }
909 
910 
911 /****************************************************************************/
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:278
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:284
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
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:122
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:55
#define STEPS2MS(x)
Definition: SUMOTime.h:57
long long int SUMOTime
Definition: SUMOTime.h:31
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
T MAX2(T a, T b)
Definition: StdDefs.h:79
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
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:68
static bool checkOptions(OptionsCont &oc)
check device-specific options
Definition: MSDevice.cpp:91
static void buildStreams()
Builds the streams used possibly by the simulation.
Definition: MSFrame.cpp:618
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
Definition: MSFrame.cpp:841
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
Definition: MSFrame.cpp:59
static bool checkOptions()
Checks the set options.
Definition: MSFrame.cpp:658
static double gStopTolerance
The tolerance to apply when matching waiting persons and vehicles.
Definition: MSGlobals.h:133
static bool gModelParkingManoeuver
whether parking simulation includes manoeuver time and any associated lane blocking
Definition: MSGlobals.h:127
static bool gUseMesoSim
Definition: MSGlobals.h:88
static double gMinorPenalty
time penalty for passing a minor link when routing
Definition: MSGlobals.h:124
static SUMOTime gTimeToGridlockHighways
Definition: MSGlobals.h:60
static bool gCheckRoutes
Definition: MSGlobals.h:76
static double gDefaultEmergencyDecel
encoding of the string-option default.emergencydecel
Definition: MSGlobals.h:106
static bool gOverheadWireSolver
Definition: MSGlobals.h:103
static double gLateralResolution
Definition: MSGlobals.h:82
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:53
static SUMOTime gTimeToImpatience
Definition: MSGlobals.h:63
static bool gStateLoaded
Information whether a state has been loaded.
Definition: MSGlobals.h:85
static bool gCheck4Accidents
Definition: MSGlobals.h:73
static int gNumSimThreads
how many threads to use for simulation
Definition: MSGlobals.h:115
static bool gOmitEmptyEdgesOnDump
Information whether empty edges shall be written on dump.
Definition: MSGlobals.h:49
static SUMOTime gIgnoreJunctionBlocker
Definition: MSGlobals.h:70
static bool gSublane
whether sublane simulation is enabled (sublane model or continuous lanechanging)
Definition: MSGlobals.h:130
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:79
static bool gMesoLimitedJunctionControl
Definition: MSGlobals.h:91
static SUMOTime gActionStepLength
default value for the interval between two action points for MSVehicle (defaults to DELTA_T)
Definition: MSGlobals.h:100
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:97
static double gEmergencyDecelWarningThreshold
treshold for warning about strong deceleration
Definition: MSGlobals.h:121
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition: MSGlobals.h:66
static int gNumThreads
how many threads to use
Definition: MSGlobals.h:118
static SUMOTime gTimeToGridlock
Definition: MSGlobals.h:57
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:3707
static void init()
Static intialization.
Definition: MSStopOut.cpp:42
An integer-option.
Definition: Option.h:329
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:75
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)
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
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:96
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the 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:58
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:44
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:63
static bool checkOptions()
checks shared options and sets StdDefs