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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
21 // Sets and checks options for microsim; inits global outputs and settings
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <iostream>
31 #include <iomanip>
32 #include <fstream>
33 #include <ctime>
35 #include <utils/options/Option.h>
38 #include <utils/common/ToString.h>
43 #include <microsim/MSBaseVehicle.h>
44 #include <microsim/MSJunction.h>
45 #include <microsim/MSRoute.h>
46 #include <microsim/MSNet.h>
47 #include <microsim/MSGlobals.h>
53 #include "MSFrame.h"
55 
56 
57 // ===========================================================================
58 // method definitions
59 // ===========================================================================
60 void
63  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");
64  oc.addCallExample("-c munich_config.cfg", "start with a configuration file");
65  oc.addCallExample("--help", "print help");
66 
67  // insert options sub-topics
68  SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
69  oc.addOptionSubTopic("Input");
70  oc.addOptionSubTopic("Output");
71  oc.addOptionSubTopic("Time");
72  oc.addOptionSubTopic("Processing");
73  oc.addOptionSubTopic("Routing");
74  SystemFrame::addReportOptions(oc); // fill this subtopic, too
75 
76 
77  // register configuration options
78  // register input options
79  oc.doRegister("net-file", 'n', new Option_FileName());
80  oc.addSynonyme("net-file", "net");
81  oc.addDescription("net-file", "Input", "Load road network description from FILE");
82  oc.addXMLDefault("net-file", "net");
83 
84  oc.doRegister("route-files", 'r', new Option_FileName());
85  oc.addSynonyme("route-files", "routes");
86  oc.addDescription("route-files", "Input", "Load routes descriptions from FILE(s)");
87 
88  oc.doRegister("additional-files", 'a', new Option_FileName());
89  oc.addSynonyme("additional-files", "additional");
90  oc.addDescription("additional-files", "Input", "Load further descriptions from FILE(s)");
91 
92  oc.doRegister("weight-files", 'w', new Option_FileName());
93  oc.addSynonyme("weight-files", "weights");
94  oc.addDescription("weight-files", "Input", "Load edge/lane weights for online rerouting from FILE");
95  oc.doRegister("weight-attribute", 'x', new Option_String("traveltime"));
96  oc.addSynonyme("weight-attribute", "measure", true);
97  oc.addDescription("weight-attribute", "Input", "Name of the xml attribute which gives the edge weight");
98 
99  oc.doRegister("load-state", new Option_FileName());
100  oc.addDescription("load-state", "Input", "Loads a network state from FILE");
101  oc.doRegister("load-state.offset", new Option_String("0", "TIME"));
102  oc.addDescription("load-state.offset", "Input", "Shifts all times loaded from a saved state by the given offset");
103  oc.doRegister("load-state.remove-vehicles", new Option_String(""));
104  oc.addDescription("load-state.remove-vehicles", "Input", "Removes vehicles with the given IDs from the loaded state");
105 
106  // register output options
107  oc.doRegister("netstate-dump", new Option_FileName());
108  oc.addSynonyme("netstate-dump", "ndump");
109  oc.addSynonyme("netstate-dump", "netstate");
110  oc.addSynonyme("netstate-dump", "netstate-output");
111  oc.addDescription("netstate-dump", "Output", "Save complete network states into FILE");
112  oc.doRegister("netstate-dump.empty-edges", new Option_Bool(false));
113  oc.addSynonyme("netstate-dump.empty-edges", "netstate.empty-edges");
114  oc.addSynonyme("netstate-dump.empty-edges", "netstate-output.empty-edges");
115  oc.addSynonyme("netstate-dump.empty-edges", "dump-empty-edges", true);
116  oc.addDescription("netstate-dump.empty-edges", "Output", "Write also empty edges completely when dumping");
117  oc.doRegister("netstate-dump.precision", new Option_Integer(2));
118  oc.addSynonyme("netstate-dump.precision", "netstate.precision");
119  oc.addSynonyme("netstate-dump.precision", "netstate-output.precision");
120  oc.addSynonyme("netstate-dump.precision", "dump-precision", true);
121  oc.addDescription("netstate-dump.precision", "Output", "Write positions and speeds with the given precision (default 2)");
122 
123 
124  oc.doRegister("emission-output", new Option_FileName());
125  oc.addDescription("emission-output", "Output", "Save the emission values of each vehicle");
126  oc.doRegister("emission-output.precision", new Option_Integer(2));
127  oc.addDescription("emission-output.precision", "Output", "Write emission values with the given precision (default 2)");
128 
129  oc.doRegister("battery-output", new Option_FileName());
130  oc.addDescription("battery-output", "Output", "Save the battery values of each vehicle");
131  oc.doRegister("battery-output.precision", new Option_Integer(2));
132  oc.addDescription("battery-output.precision", "Output", "Write battery values with the given precision (default 2)");
133 
134  oc.doRegister("chargingstations-output", new Option_FileName());
135  oc.addDescription("chargingstations-output", "Output", "Write data of charging stations");
136 
137  oc.doRegister("fcd-output", new Option_FileName());
138  oc.addDescription("fcd-output", "Output", "Save the Floating Car Data");
139  oc.doRegister("fcd-output.geo", new Option_Bool(false));
140  oc.addDescription("fcd-output.geo", "Output", "Save the Floating Car Data using geo-coordinates (lon/lat)");
141  oc.doRegister("fcd-output.signals", new Option_Bool(false));
142  oc.addDescription("fcd-output.signals", "Output", "Add the vehicle signal state to the FCD output (brake lights etc.)");
143  oc.doRegister("fcd-output.distance", new Option_Bool(false));
144  oc.addDescription("fcd-output.distance", "Output", "Add kilometrage to the FCD output (linear referencing)");
145  oc.doRegister("fcd-output.filter-edges.input-file", new Option_FileName());
146  oc.addDescription("fcd-output.filter-edges.input-file", "Output", "Restrict fcd output to the edge selection from the given input file");
147 
148 
149  oc.doRegister("full-output", new Option_FileName());
150  oc.addDescription("full-output", "Output", "Save a lot of information for each timestep (very redundant)");
151  oc.doRegister("queue-output", new Option_FileName());
152  oc.addDescription("queue-output", "Output", "Save the vehicle queues at the junctions (experimental)");
153  oc.doRegister("vtk-output", new Option_FileName());
154  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)");
155  oc.doRegister("amitran-output", new Option_FileName());
156  oc.addDescription("amitran-output", "Output", "Save the vehicle trajectories in the Amitran format");
157 
158 
159  oc.doRegister("summary-output", new Option_FileName());
160  oc.addSynonyme("summary-output", "summary");
161  oc.addDescription("summary-output", "Output", "Save aggregated vehicle departure info into FILE");
162 
163  oc.doRegister("tripinfo-output", new Option_FileName());
164  oc.addSynonyme("tripinfo-output", "tripinfo");
165  oc.addDescription("tripinfo-output", "Output", "Save single vehicle trip info into FILE");
166 
167  oc.doRegister("tripinfo-output.write-unfinished", new Option_Bool(false));
168  oc.addDescription("tripinfo-output.write-unfinished", "Output", "Write tripinfo output for vehicles which have not arrived at simulation end");
169 
170  oc.doRegister("vehroute-output", new Option_FileName());
171  oc.addSynonyme("vehroute-output", "vehroutes");
172  oc.addDescription("vehroute-output", "Output", "Save single vehicle route info into FILE");
173 
174  oc.doRegister("vehroute-output.exit-times", new Option_Bool(false));
175  oc.addSynonyme("vehroute-output.exit-times", "vehroutes.exit-times");
176  oc.addDescription("vehroute-output.exit-times", "Output", "Write the exit times for all edges");
177 
178  oc.doRegister("vehroute-output.last-route", new Option_Bool(false));
179  oc.addSynonyme("vehroute-output.last-route", "vehroutes.last-route");
180  oc.addDescription("vehroute-output.last-route", "Output", "Write the last route only");
181 
182  oc.doRegister("vehroute-output.sorted", new Option_Bool(false));
183  oc.addSynonyme("vehroute-output.sorted", "vehroutes.sorted");
184  oc.addDescription("vehroute-output.sorted", "Output", "Sorts the output by departure time");
185 
186  oc.doRegister("vehroute-output.dua", new Option_Bool(false));
187  oc.addSynonyme("vehroute-output.dua", "vehroutes.dua");
188  oc.addDescription("vehroute-output.dua", "Output", "Write the output in the duarouter alternatives style");
189 
190  oc.doRegister("vehroute-output.cost", new Option_Bool(false));
191  oc.addDescription("vehroute-output.cost", "Output", "Write costs for all routes");
192 
193  oc.doRegister("vehroute-output.intended-depart", new Option_Bool(false));
194  oc.addSynonyme("vehroute-output.intended-depart", "vehroutes.intended-depart");
195  oc.addDescription("vehroute-output.intended-depart", "Output", "Write the output with the intended instead of the real departure time");
196 
197  oc.doRegister("vehroute-output.route-length", new Option_Bool(false));
198  oc.addSynonyme("vehroute-output.route-length", "vehroutes.route-length");
199  oc.addDescription("vehroute-output.route-length", "Output", "Include total route length in the output");
200 
201  oc.doRegister("vehroute-output.write-unfinished", new Option_Bool(false));
202  oc.addDescription("vehroute-output.write-unfinished", "Output", "Write vehroute output for vehicles which have not arrived at simulation end");
203 
204  oc.doRegister("vehroute-output.skip-ptlines", new Option_Bool(false));
205  oc.addDescription("vehroute-output.skip-ptlines", "Output", "Skip vehroute output for public transport vehicles");
206 
207  oc.doRegister("vehroute-output.incomplete", new Option_Bool(false));
208  oc.addDescription("vehroute-output.incomplete", "Output", "Include invalid routes and route stubs in vehroute output");
209 
210  oc.doRegister("link-output", new Option_FileName());
211  oc.addDescription("link-output", "Output", "Save links states into FILE");
212 
213  oc.doRegister("railsignal-block-output", new Option_FileName());
214  oc.addDescription("railsignal-block-output", "Output", "Save railsignal-blocks into FILE");
215 
216  oc.doRegister("bt-output", new Option_FileName());
217  oc.addDescription("bt-output", "Output", "Save bluetooth visibilities into FILE (in conjunction with device.btreceiver and device.btsender)");
218 
219  oc.doRegister("lanechange-output", new Option_FileName());
220  oc.addDescription("lanechange-output", "Output", "Record lane changes and their motivations for all vehicles into FILE");
221 
222  oc.doRegister("lanechange-output.started", new Option_Bool(false));
223  oc.addDescription("lanechange-output.started", "Output", "Record start of lane change manoeuvres");
224 
225  oc.doRegister("lanechange-output.ended", new Option_Bool(false));
226  oc.addDescription("lanechange-output.ended", "Output", "Record end of lane change manoeuvres");
227 
228  oc.doRegister("stop-output", new Option_FileName());
229  oc.addDescription("stop-output", "Output", "Record stops and loading/unloading of passenger and containers for all vehicles into FILE");
230 
231 #ifdef _DEBUG
232  oc.doRegister("movereminder-output", new Option_FileName());
233  oc.addDescription("movereminder-output", "Output", "Save movereminder states of selected vehicles into FILE");
234  oc.doRegister("movereminder-output.vehicles", new Option_String());
235  oc.addDescription("movereminder-output.vehicles", "Output", "List of vehicle ids which shall save their movereminder states");
236 #endif
237 
238  oc.doRegister("save-state.times", new Option_IntVector(IntVector()));
239  oc.addDescription("save-state.times", "Output", "Use INT[] as times at which a network state written");
240  oc.doRegister("save-state.period", new Option_String("-1", "TIME"));
241  oc.addDescription("save-state.period", "Output", "save state repeatedly after TIME period");
242  oc.doRegister("save-state.prefix", new Option_FileName("state"));
243  oc.addDescription("save-state.prefix", "Output", "Prefix for network states");
244  oc.doRegister("save-state.suffix", new Option_String(".sbx"));
245  oc.addDescription("save-state.suffix", "Output", "Suffix for network states (.sbx or .xml)");
246  oc.doRegister("save-state.files", new Option_FileName());//
247  oc.addDescription("save-state.files", "Output", "Files for network states");
248 
249  // register the simulation settings
250  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
251  oc.addDescription("begin", "Time", "Defines the begin time in seconds; The simulation starts at this time");
252 
253  oc.doRegister("end", 'e', new Option_String("-1", "TIME"));
254  oc.addDescription("end", "Time", "Defines the end time in seconds; The simulation ends at this time");
255 
256  oc.doRegister("step-length", new Option_String("1", "TIME"));
257  oc.addDescription("step-length", "Time", "Defines the step duration in seconds");
258 
259  oc.doRegister("step-method.ballistic", new Option_Bool(false));
260  oc.addDescription("step-method.ballistic", "Processing", "Whether to use ballistic method for the positional update of vehicles (default is a semi-implicit Euler method).");
261 
262  oc.doRegister("threads", new Option_Integer(1));
263  oc.addDescription("threads", "Processing", "Defines the number of threads for parallel simulation");
264 
265  oc.doRegister("lateral-resolution", new Option_Float(-1));
266  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");
267 
268  // register the processing options
269  oc.doRegister("route-steps", 's', new Option_String("200", "TIME"));
270  oc.addDescription("route-steps", "Processing", "Load routes for the next number of seconds ahead");
271 
272  oc.doRegister("no-internal-links", new Option_Bool(false));
273  oc.addDescription("no-internal-links", "Processing", "Disable (junction) internal links");
274 
275  oc.doRegister("ignore-junction-blocker", new Option_String("-1", "TIME"));
276  oc.addDescription("ignore-junction-blocker", "Processing", "Ignore vehicles which block the junction after they have been standing for SECONDS (-1 means never ignore)");
277 
278  oc.doRegister("ignore-route-errors", new Option_Bool(false));
279  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.");
280 
281  oc.doRegister("ignore-accidents", new Option_Bool(false));
282  oc.addDescription("ignore-accidents", "Processing", "Do not check whether accidents occur");
283 
284  oc.doRegister("collision.action", new Option_String("teleport"));
285  oc.addDescription("collision.action", "Processing", "How to deal with collisions: [none,warn,teleport,remove]");
286 
287  oc.doRegister("collision.stoptime", new Option_String("0", "TIME"));
288  oc.addDescription("collision.stoptime", "Processing", "Let vehicle stop for TIME before performing collision.action (except for action 'none')");
289 
290  oc.doRegister("collision.check-junctions", new Option_Bool(false));
291  oc.addDescription("collision.check-junctions", "Processing", "Enables collisions checks on junctions");
292 
293  oc.doRegister("collision.mingap-factor", new Option_Float(-1));
294  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");
295 
296  oc.doRegister("max-num-vehicles", new Option_Integer(-1));
297  oc.addDescription("max-num-vehicles", "Processing", "Delay vehicle insertion to stay within the given maximum number");
298 
299  oc.doRegister("max-num-teleports", new Option_Integer(-1));
300  oc.addDescription("max-num-teleports", "Processing", "Abort the simulation if the given maximum number of teleports is exceeded");
301 
302  oc.doRegister("scale", new Option_Float(1.));
303  oc.addDescription("scale", "Processing", "Scale demand by the given factor (by discarding or duplicating vehicles)");
304 
305  oc.doRegister("time-to-teleport", new Option_String("300", "TIME"));
306  oc.addDescription("time-to-teleport", "Processing", "Specify how long a vehicle may wait until being teleported, defaults to 300, non-positive values disable teleporting");
307 
308  oc.doRegister("time-to-teleport.highways", new Option_String("0", "TIME"));
309  oc.addDescription("time-to-teleport.highways", "Processing", "The waiting time after which vehicles on a fast road (speed > 69m/s) are teleported if they are on a non-continuing lane");
310 
311  oc.doRegister("waiting-time-memory", new Option_String("100", "TIME"));
312  oc.addDescription("waiting-time-memory", "Processing", "Length of time interval, over which accumulated waiting time is taken into account (default is 100s.)");
313 
314  oc.doRegister("max-depart-delay", new Option_String("-1", "TIME"));
315  oc.addDescription("max-depart-delay", "Processing", "How long vehicles wait for departure before being skipped, defaults to -1 which means vehicles are never skipped");
316 
317  oc.doRegister("sloppy-insert", new Option_Bool(false));
318  oc.addDescription("sloppy-insert", "Processing", "Whether insertion on an edge shall not be repeated in same step once failed");
319 
320  oc.doRegister("eager-insert", new Option_Bool(false));
321  oc.addDescription("eager-insert", "Processing", "Whether each vehicle is checked separately for insertion on an edge");
322 
323  oc.doRegister("random-depart-offset", new Option_String("0", "TIME"));
324  oc.addDescription("random-depart-offset", "Processing", "Each vehicle receives a random offset to its depart value drawn uniformly from [0, TIME]");
325 
326  oc.doRegister("lanechange.duration", new Option_String("0", "TIME"));
327  oc.addDescription("lanechange.duration", "Processing", "Duration of a lane change maneuver (default 0)");
328 
329  oc.doRegister("lanechange.overtake-right", new Option_Bool(false));
330  oc.addDescription("lanechange.overtake-right", "Processing", "Whether overtaking on the right on motorways is permitted");
331 
332  oc.doRegister("tls.all-off", new Option_Bool(false));
333  oc.addDescription("tls.all-off", "Processing", "Switches off all traffic lights.");
334 
335  oc.doRegister("tls.actuated.show-detectors", new Option_Bool(false));
336  oc.addDescription("tls.actuated.show-detectors", "Processing", "Sets default visibility for actuation detectors");
337 
338  oc.doRegister("tls.delay_based.detector-range", new Option_Float(100));
339  oc.addDescription("tls.delay_based.detector-range", "Processing", "Sets default range for detecting delayed vehicles");
340 
341  oc.doRegister("time-to-impatience", new Option_String("300", "TIME"));
342  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");
343 
344  oc.doRegister("default.action-step-length", new Option_Float(0.0));
345  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.");
346 
347  oc.doRegister("default.carfollowmodel", new Option_String("Krauss"));
348  oc.addDescription("default.carfollowmodel", "Processing", "Select default car following model (Krauss, IDM, ...)");
349  oc.addSynonyme("default.carfollowmodel", "carfollow.model", false);
350 
351  oc.doRegister("default.speeddev", new Option_Float(-1));
352  oc.addDescription("default.speeddev", "Processing", "Select default speed deviation. A negative value implies vClass specific defaults (0.1 for the default passenger class");
353 
354  oc.doRegister("default.emergencydecel", new Option_String("default"));
355  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");
356 
357  oc.doRegister("emergencydecel.warning-threshold", new Option_Float(1));
358  oc.addDescription("emergencydecel.warning-threshold", "Processing", "Sets the fraction of emergency decel capability that must be used to trigger a warning.");
359 
360  // pedestrian model
361  oc.doRegister("pedestrian.model", new Option_String("striping"));
362  oc.addDescription("pedestrian.model", "Processing", "Select among pedestrian models ['nonInteracting', 'striping', 'remote']");
363 
364  oc.doRegister("pedestrian.striping.stripe-width", new Option_Float(0.64));
365  oc.addDescription("pedestrian.striping.stripe-width", "Processing", "Width of parallel stripes for segmenting a sidewalk (meters) for use with model 'striping'");
366 
367  oc.doRegister("pedestrian.striping.dawdling", new Option_Float(0.2));
368  oc.addDescription("pedestrian.striping.dawdling", "Processing", "Factor for random slow-downs [0,1] for use with model 'striping'");
369 
370  oc.doRegister("pedestrian.striping.jamtime", new Option_String("300", "TIME"));
371  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)");
372  oc.doRegister("pedestrian.striping.jamtime.crossing", new Option_String("10", "TIME"));
373  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)");
374 
375  oc.doRegister("pedestrian.remote.address", new Option_String("localhost:9000"));
376  oc.addDescription("pedestrian.remote.address", "Processing", "The address (host:port) of the external simulation");
377 
378  oc.doRegister("ride.stop-tolerance", new Option_Float(10.));
379  oc.addDescription("ride.stop-tolerance", "Processing", "Tolerance to apply when matching pedestrian and vehicle positions on boarding at individual stops");
380 
381  // generic routing options
382  oc.doRegister("routing-algorithm", new Option_String("dijkstra"));
383  oc.addDescription("routing-algorithm", "Routing",
384  "Select among routing algorithms ['dijkstra', 'astar', 'CH', 'CHWrapper']");
385  oc.doRegister("weights.random-factor", new Option_Float(1.));
386  oc.addDescription("weights.random-factor", "Routing", "Edge weights for routing are dynamically disturbed by a random factor drawn uniformly from [1,FLOAT)");
387  oc.doRegister("weights.minor-penalty", new Option_Float(1.5));
388  oc.addDescription("weights.minor-penalty", "Routing", "Apply the given time penalty when computing minimum routing costs for minor-link internal lanes");
389 
390  oc.doRegister("astar.all-distances", new Option_FileName());
391  oc.addDescription("astar.all-distances", "Routing", "Initialize lookup table for astar from the given file (generated by marouter --all-pairs-output)");
392 
393  oc.doRegister("astar.landmark-distances", new Option_FileName());
394  oc.addDescription("astar.landmark-distances", "Routing", "Initialize lookup table for astar ALT-variant from the given file");
395 
396  oc.doRegister("persontrip.walkfactor", new Option_Float(double(0.75)));
397  oc.addDescription("persontrip.walkfactor", "Routing", "Use FLOAT as a factor on pedestrian maximum speed during intermodal routing");
398 
399  oc.doRegister("persontrip.transfer.car-walk", new Option_String("parkingAreas"));
400  oc.addDescription("persontrip.transfer.car-walk", "Routing", "Where are mode changes from car to walking allowed (possible values: 'parkingAreas', 'ptStops', 'allJunctions' and combinations)");
401 
402  // devices
403  oc.addOptionSubTopic("Emissions");
404  oc.doRegister("phemlight-path", new Option_FileName("./PHEMlight/"));
405  oc.addDescription("phemlight-path", "Emissions", "Determines where to load PHEMlight definitions from.");
406 
407  oc.addOptionSubTopic("Communication");
408  oc.addOptionSubTopic("Battery");
410 
411  // register report options
412  oc.doRegister("duration-log.disable", new Option_Bool(false));
413  oc.addSynonyme("duration-log.disable", "no-duration-log", false);
414  oc.addDescription("duration-log.disable", "Report", "Disable performance reports for individual simulation steps");
415 
416  oc.doRegister("duration-log.statistics", new Option_Bool(false));
417  oc.addDescription("duration-log.statistics", "Report", "Enable statistics on vehicle trips");
418 
419  oc.doRegister("no-step-log", new Option_Bool(false));
420  oc.addDescription("no-step-log", "Report", "Disable console output of current simulation step");
421 
422  //remote port 0 if not used
423  oc.addOptionSubTopic("TraCI Server");
424  oc.doRegister("remote-port", new Option_Integer(0));
425  oc.addDescription("remote-port", "TraCI Server", "Enables TraCI Server if set");
426  oc.doRegister("num-clients", new Option_Integer(1));
427  oc.addDescription("num-clients", "TraCI Server", "Expected number of connecting clients");
428 
429  oc.addOptionSubTopic("Mesoscopic");
430  oc.doRegister("mesosim", new Option_Bool(false));
431  oc.addDescription("mesosim", "Mesoscopic", "Enables mesoscopic simulation");
432  oc.doRegister("meso-edgelength", new Option_Float(98.0f));
433  oc.addDescription("meso-edgelength", "Mesoscopic", "Length of an edge segment in mesoscopic simulation");
434  oc.doRegister("meso-tauff", new Option_String("1.13", "TIME"));
435  oc.addDescription("meso-tauff", "Mesoscopic", "Factor for calculating the net free-free headway time");
436  oc.doRegister("meso-taufj", new Option_String("1.13", "TIME"));
437  oc.addDescription("meso-taufj", "Mesoscopic", "Factor for calculating the net free-jam headway time");
438  oc.doRegister("meso-taujf", new Option_String("1.73", "TIME"));
439  oc.addDescription("meso-taujf", "Mesoscopic", "Factor for calculating the jam-free headway time");
440  oc.doRegister("meso-taujj", new Option_String("1.4", "TIME"));
441  oc.addDescription("meso-taujj", "Mesoscopic", "Factor for calculating the jam-jam headway time");
442  oc.doRegister("meso-jam-threshold", new Option_Float(-1));
443  oc.addDescription("meso-jam-threshold", "Mesoscopic",
444  "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)");
445  oc.doRegister("meso-multi-queue", new Option_Bool(true));
446  oc.addDescription("meso-multi-queue", "Mesoscopic", "Enable multiple queues at edge ends");
447  oc.doRegister("meso-junction-control", new Option_Bool(false));
448  oc.addDescription("meso-junction-control", "Mesoscopic", "Enable mesoscopic traffic light and priority junction handling");
449  oc.doRegister("meso-junction-control.limited", new Option_Bool(false));
450  oc.addDescription("meso-junction-control.limited", "Mesoscopic",
451  "Enable mesoscopic traffic light and priority junction handling for saturated links. This prevents faulty traffic lights from hindering flow in low-traffic situations");
452  oc.doRegister("meso-tls-penalty", new Option_Float(0));
453  oc.addDescription("meso-tls-penalty", "Mesoscopic",
454  "Apply scaled time penalties when driving across tls controlled junctions based on green split instead of checking actual phases");
455  oc.doRegister("meso-minor-penalty", new Option_String("0", "TIME"));
456  oc.addDescription("meso-minor-penalty", "Mesoscopic",
457  "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.");
458  oc.doRegister("meso-overtaking", new Option_Bool(false));
459  oc.addDescription("meso-overtaking", "Mesoscopic", "Enable mesoscopic overtaking");
460  oc.doRegister("meso-recheck", new Option_String("0", "TIME"));
461  oc.addDescription("meso-recheck", "Mesoscopic", "Time interval for rechecking insertion into the next segment after failure");
462 
463  // add rand options
465  oc.doRegister("thread-rngs", new Option_Integer(64));
466  oc.addDescription("thread-rngs", "Random Number",
467  "Number of pre-allocated random number generators to ensure repeatable multi-threaded simulations (should be at least the number of threads for repeatable simulations).");
468 
469  // add GUI options
470  // the reason that we include them in vanilla sumo as well is to make reusing config files easy
471  oc.addOptionSubTopic("GUI Only");
472  oc.doRegister("gui-settings-file", 'g', new Option_FileName());
473  oc.addDescription("gui-settings-file", "GUI Only", "Load visualisation settings from FILE");
474 
475  oc.doRegister("quit-on-end", 'Q', new Option_Bool(false));
476  oc.addDescription("quit-on-end", "GUI Only", "Quits the GUI when the simulation stops");
477 
478  oc.doRegister("game", 'G', new Option_Bool(false));
479  oc.addDescription("game", "GUI Only", "Start the GUI in gaming mode");
480 
481  oc.doRegister("game.mode", new Option_String("tls"));
482  oc.addDescription("game.mode", "GUI Only", "Select the game type ('tls', 'drt')");
483 
484  oc.doRegister("start", 'S', new Option_Bool(false));
485  oc.addDescription("start", "GUI Only", "Start the simulation after loading");
486 
487  oc.doRegister("breakpoints", 'B', new Option_String());
488  oc.addDescription("breakpoints", "GUI Only", "Use TIME[] as times when the simulation should halt");
489 
490  oc.doRegister("edgedata-files", new Option_FileName());
491  oc.addDescription("edgedata-files", "GUI Only", "Load edge/lane weights for visualization from FILE");
492 
493  oc.doRegister("demo", 'D', new Option_Bool(false));
494  oc.addDescription("demo", "GUI Only", "Restart the simulation after ending (demo mode)");
495 
496  oc.doRegister("disable-textures", 'T', new Option_Bool(false));
497  oc.addDescription("disable-textures", "GUI Only", "Do not load background pictures");
498 
499  oc.doRegister("registry-viewport", new Option_Bool(false));
500  oc.addDescription("registry-viewport", "GUI Only", "Load current viewport from registry");
501 
502  oc.doRegister("window-size", new Option_String());
503  oc.addDescription("window-size", "GUI Only", "Create initial window with the given x,y size");
504 
505  oc.doRegister("window-pos", new Option_String());
506  oc.addDescription("window-pos", "GUI Only", "Create initial window at the given x,y position");
507 
508  oc.doRegister("tracker-interval", new Option_Float(1.0));
509  oc.addDescription("tracker-interval", "GUI Only", "The aggregation period for value tracker windows");
510 
511 #ifdef HAVE_OSG
512  oc.doRegister("osg-view", new Option_Bool(false));
513  oc.addDescription("osg-view", "GUI Only", "Start with an OpenSceneGraph view instead of the regular 2D view");
514 #endif
515 
516  // gui testing
517  oc.doRegister("gui-testing", new Option_Bool(false));
518  oc.addDescription("gui-testing", "GUI Only", "Enable ovelay for screen recognition");
519 
520  // gui testing - debug
521  oc.doRegister("gui-testing-debug", new Option_Bool(false));
522  oc.addDescription("gui-testing-debug", "GUI Only", "Enable output messages during GUI-Testing");
523 }
524 
525 
526 void
528  // standard outputs
529  OutputDevice::createDeviceByOption("netstate-dump", "netstate", "netstate_file.xsd");
530  OutputDevice::createDeviceByOption("summary-output", "summary", "summary_file.xsd");
531  OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos", "tripinfo_file.xsd");
532 
533  //extended
534  OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd");
535  OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd");
536  OutputDevice::createDeviceByOption("battery-output", "battery-export");
537  OutputDevice::createDeviceByOption("chargingstations-output", "chargingstations-export");
538  OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd");
539  OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd");
540  OutputDevice::createDeviceByOption("amitran-output", "trajectories", "amitran/trajectories.xsd\" timeStepSize=\"" + toString(STEPS2MS(DELTA_T)));
541 
542  //OutputDevice::createDeviceByOption("vtk-output", "vtk-export");
543  OutputDevice::createDeviceByOption("link-output", "link-output");
544  OutputDevice::createDeviceByOption("railsignal-block-output", "railsignal-block-output");
545  OutputDevice::createDeviceByOption("bt-output", "bt-output");
546  OutputDevice::createDeviceByOption("lanechange-output", "lanechanges");
547  OutputDevice::createDeviceByOption("stop-output", "stops", "stopinfo_file.xsd");
548 
549 #ifdef _DEBUG
550  OutputDevice::createDeviceByOption("movereminder-output", "movereminder-output");
551 #endif
552 
554  MSStopOut::init();
555 }
556 
557 
558 bool
561  bool ok = true;
562  if (!oc.isSet("net-file")) {
563  WRITE_ERROR("No network file (-n) specified.");
564  ok = false;
565  }
566  if (oc.getFloat("scale") < 0.) {
567  WRITE_ERROR("Invalid scaling factor.");
568  ok = false;
569  }
570  if (oc.getBool("vehroute-output.exit-times") && !oc.isSet("vehroute-output")) {
571  WRITE_ERROR("A vehroute-output file is needed for exit times.");
572  ok = false;
573  }
574  if (oc.isSet("gui-settings-file") &&
575  oc.getString("gui-settings-file") != "" &&
576  !oc.isUsableFileList("gui-settings-file")) {
577  ok = false;
578  }
579  if (oc.getBool("demo") && oc.isDefault("start")) {
580  oc.set("start", "true");
581  }
582  if (oc.getBool("demo") && oc.getBool("quit-on-end")) {
583  WRITE_ERROR("You can either restart or quit on end.");
584  ok = false;
585  }
586  if (oc.getBool("meso-junction-control.limited") && !oc.getBool("meso-junction-control")) {
587  oc.set("meso-junction-control", "true");
588  }
589  if (oc.getBool("mesosim")) {
590  if (oc.isDefault("pedestrian.model")) {
591  oc.set("pedestrian.model", "nonInteracting");
592  }
593  }
594  const SUMOTime begin = string2time(oc.getString("begin"));
595  const SUMOTime end = string2time(oc.getString("end"));
596  if (begin < 0) {
597  WRITE_ERROR("The begin time should not be negative.");
598  ok = false;
599  }
600  if (end != string2time("-1")) {
601  if (end < begin) {
602  WRITE_ERROR("The end time should be after the begin time.");
603  ok = false;
604  }
605  }
606  if (string2time(oc.getString("step-length")) <= 0) {
607  WRITE_ERROR("the minimum step-length is 0.001");
608  ok = false;
609  }
610 #ifdef _DEBUG
611  if (oc.isSet("movereminder-output.vehicles") && !oc.isSet("movereminder-output")) {
612  WRITE_ERROR("option movereminder-output.vehicles requires option movereminder-output to be set");
613  ok = false;
614  }
615 #endif
616  if (oc.getBool("sloppy-insert")) {
617  WRITE_WARNING("The option 'sloppy-insert' is deprecated, because it is now activated by default, see the new option 'eager-insert'.");
618  }
619  if (string2time(oc.getString("lanechange.duration")) > 0 && oc.getFloat("lateral-resolution") > 0) {
620  WRITE_ERROR("Only one of the options 'lanechange.duration' or 'lateral-resolution' may be given.");
621  }
622  if (oc.getBool("ignore-accidents")) {
623  WRITE_WARNING("The option 'ignore-accidents' is deprecated. Use 'collision.action none' instead.");
624  }
625  if (oc.getBool("duration-log.statistics") && oc.isDefault("verbose")) {
626  oc.set("verbose", "true");
627  }
628  if (oc.isDefault("precision") && string2time(oc.getString("step-length")) < 10) {
629  oc.set("precision", "3");
630  }
631  if (oc.isDefault("tracker-interval") && !oc.isDefault("step-length")) {
632  oc.set("tracker-interval", oc.getString("step-length"));
633  }
634  if (oc.getInt("precision") > 2) {
635  if (oc.isDefault("netstate-dump.precision")) {
636  oc.set("netstate-dump.precision", toString(oc.getInt("precision")));
637  }
638  if (oc.isDefault("emission-output.precision")) {
639  oc.set("emission-output.precision", toString(oc.getInt("precision")));
640  }
641  if (oc.isDefault("battery-output.precision")) {
642  oc.set("battery-output.precision", toString(oc.getInt("precision")));
643  }
644  }
645  if (!SUMOXMLDefinitions::CarFollowModels.hasString(oc.getString("carfollow.model"))) {
646  WRITE_ERROR("Unknown model '" + oc.getString("carfollow.model") + "' for option 'carfollow.model'.");
647  ok = false;
648  }
649  if (oc.isSet("default.emergencydecel")) {
650  const std::string val = oc.getString("default.emergencydecel");
651  if (val != "default" && val != "decel") {
652  try {
654  } catch (NumberFormatException&) {
655  WRITE_ERROR("Invalid value '" + val + "' for option 'default.emergencydecel'. Must be a FLOAT or 'default' or 'decel'");
656  ok = false;
657  }
658  }
659  }
660  for (const std::string& val : oc.getStringVector("breakpoints")) {
661  try {
662  string2time(val);
663  } catch (ProcessError& e) {
664  WRITE_ERROR("Invalid time '" + val + "' for option 'breakpoints'." + e.what());
665  ok = false;
666  }
667  };
668  if (oc.getInt("threads") > oc.getInt("thread-rngs")) {
669  WRITE_WARNING("Number of threads exceeds number of thread-rngs. Simulation runs with the same seed may produce different results");
670  }
671  if (oc.getString("game.mode") != "tls" && oc.getString("game.mode") != "drt") {
672  WRITE_ERROR("game.mode must be one of ['tls', 'drt']");
673  }
674 
675  ok &= MSDevice::checkOptions(oc);
677 
678  return ok;
679 }
680 
681 
682 void
684  // pre-initialise the network
685  // set whether empty edges shall be printed on dump
686  MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges");
687  // set whether internal lanes shall be used
688  MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links");
689  MSGlobals::gIgnoreJunctionBlocker = string2time(oc.getString("ignore-junction-blocker")) < 0 ?
690  std::numeric_limits<SUMOTime>::max() : string2time(oc.getString("ignore-junction-blocker"));
691  // set the grid lock time
692  MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport"));
693  MSGlobals::gTimeToImpatience = string2time(oc.getString("time-to-impatience"));
694  MSGlobals::gTimeToGridlockHighways = string2time(oc.getString("time-to-teleport.highways")) < 0 ? 0 : string2time(oc.getString("time-to-teleport.highways"));
695  MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents");
696  MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors");
697  MSGlobals::gLaneChangeDuration = string2time(oc.getString("lanechange.duration"));
698  MSGlobals::gLateralResolution = oc.getFloat("lateral-resolution");
699  MSGlobals::gStateLoaded = oc.isSet("load-state");
700  MSGlobals::gUseMesoSim = oc.getBool("mesosim");
701  MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited");
702  MSGlobals::gMesoOvertaking = oc.getBool("meso-overtaking");
703  MSGlobals::gMesoTLSPenalty = oc.getFloat("meso-tls-penalty");
704  MSGlobals::gMesoMinorPenalty = string2time(oc.getString("meso-minor-penalty"));
707  }
708  MSGlobals::gWaitingTimeMemory = string2time(oc.getString("waiting-time-memory"));
711 
712  DELTA_T = string2time(oc.getString("step-length"));
713 
714 
715  bool integrationMethodSet = !oc.isDefault("step-method.ballistic");
716  bool actionStepLengthSet = !oc.isDefault("default.action-step-length");
717  MSGlobals::gSemiImplicitEulerUpdate = !oc.getBool("step-method.ballistic");
718  // Init default value for gActionStepLength
719  if (MSGlobals::gSemiImplicitEulerUpdate && actionStepLengthSet && !integrationMethodSet) {
720  WRITE_MESSAGE("Integration method was set to 'ballistic', since a default action step length was specified.");
722  }
723  double givenDefaultActionStepLength = oc.getFloat("default.action-step-length");
725 
726  const std::string defaultEmergencyDecelOption = OptionsCont::getOptions().getString("default.emergencydecel");
727  if (defaultEmergencyDecelOption == "default") {
729  } else if (defaultEmergencyDecelOption == "decel") {
731  } else {
732  // value already checked in checkOptions()
733  MSGlobals::gDefaultEmergencyDecel = StringUtils::toDouble(defaultEmergencyDecelOption);
734  }
736 
737  MSGlobals::gEmergencyDecelWarningThreshold = oc.getFloat("emergencydecel.warning-threshold");
738  MSGlobals::gMinorPenalty = oc.getFloat("weights.minor-penalty");
739 
740 #ifdef _DEBUG
741  if (oc.isSet("movereminder-output")) {
742  MSBaseVehicle::initMoveReminderOutput(oc);
743  }
744 #endif
745 }
746 
747 
748 /****************************************************************************/
static bool gOmitEmptyEdgesOnDump
Information whether empty edges shall be written on dump.
Definition: MSGlobals.h:52
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:75
static double gLateralResolution
Definition: MSGlobals.h:85
static StringBijection< SumoXMLTag > CarFollowModels
car following models
static void insertRandOptions()
Initialises the given options container with random number options.
Definition: RandHelper.cpp:43
long long int SUMOTime
Definition: SUMOTime.h:35
static void init()
Static intialization.
Definition: MSStopOut.cpp:41
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:65
static double gMesoTLSPenalty
Definition: MSGlobals.h:100
static void buildStreams()
Builds the streams used possibly by the simulation.
Definition: MSFrame.cpp:527
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
static bool gStateLoaded
Information whether a state has been loaded.
Definition: MSGlobals.h:88
static double gEmergencyDecelWarningThreshold
treshold for warning about strong deceleration
Definition: MSGlobals.h:127
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:3591
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
static bool gMesoOvertaking
Definition: MSGlobals.h:97
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:40
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
static bool gCheck4Accidents
Definition: MSGlobals.h:76
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
Definition: MSFrame.cpp:61
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
static void init()
Static intialization.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static SUMOTime gTimeToImpatience
Definition: MSGlobals.h:66
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
std::vector< int > IntVector
Definition of a vector of ints.
Definition: Option.h:41
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
static bool gCheckRoutes
Definition: MSGlobals.h:79
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
static int gNumSimThreads
how many threads to use for simulation
Definition: MSGlobals.h:124
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static double gDefaultEmergencyDecel
encoding of the string-option default.emergencydecel
Definition: MSGlobals.h:115
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:42
static SUMOTime gMesoMinorPenalty
Definition: MSGlobals.h:103
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static bool checkOptions()
checks shared options and sets StdDefs
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition: MSGlobals.h:69
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static bool checkOptions(OptionsCont &oc)
check device-specific options
Definition: MSDevice.cpp:86
static bool checkOptions()
Checks the set options.
Definition: MSFrame.cpp:559
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
static SUMOTime gActionStepLength
default value for the interval between two action points for MSVehicle (defaults to DELTA_T) ...
Definition: MSGlobals.h:112
static SUMOTime gTimeToGridlockHighways
Definition: MSGlobals.h:63
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
An integer-option.
Definition: Option.h:333
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...
A storage for options typed value containers)
Definition: OptionsCont.h:90
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
static SUMOTime gTimeToGridlock
Definition: MSGlobals.h:60
static void insertOptions(OptionsCont &oc)
Inserts options for building devices.
Definition: MSDevice.cpp:67
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:109
static SUMOTime gIgnoreJunctionBlocker
Definition: MSGlobals.h:73
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 bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:56
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
Definition: MSFrame.cpp:683
static double gMinorPenalty
time penalty for passing a minor link when routing
Definition: MSGlobals.h:130
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:240
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:82
static bool gUseMesoSim
Definition: MSGlobals.h:91
static bool gMesoLimitedJunctionControl
Definition: MSGlobals.h:94
#define STEPS2MS(x)
Definition: SUMOTime.h:61