SUMO - Simulation of Urban MObility
MSFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
13 // Sets and checks options for microsim; inits global outputs and settings
14 /****************************************************************************/
15 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
16 // Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors
17 /****************************************************************************/
18 //
19 // This file is part of SUMO.
20 // SUMO is free software: you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation, either version 3 of the License, or
23 // (at your option) any later version.
24 //
25 /****************************************************************************/
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <iostream>
38 #include <iomanip>
39 #include <fstream>
40 #include <ctime>
42 #include <utils/options/Option.h>
45 #include <utils/common/ToString.h>
48 #include <microsim/MSBaseVehicle.h>
49 #include <microsim/MSJunction.h>
50 #include <microsim/MSRoute.h>
51 #include <microsim/MSNet.h>
52 #include <microsim/MSGlobals.h>
58 #include "MSFrame.h"
60 
61 #ifdef CHECK_MEMORY_LEAKS
62 #include <foreign/nvwa/debug_new.h>
63 #endif // CHECK_MEMORY_LEAKS
64 
65 
66 // ===========================================================================
67 // method definitions
68 // ===========================================================================
69 void
72  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");
73  oc.addCallExample("-c munich_config.cfg", "start with a configuration file");
74  oc.addCallExample("--help", "print help");
75 
76  // insert options sub-topics
77  SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
78  oc.addOptionSubTopic("Input");
79  oc.addOptionSubTopic("Output");
80  oc.addOptionSubTopic("Time");
81  oc.addOptionSubTopic("Processing");
82  oc.addOptionSubTopic("Routing");
83  SystemFrame::addReportOptions(oc); // fill this subtopic, too
84 
85 
86  // register configuration options
87  // register input options
88  oc.doRegister("net-file", 'n', new Option_FileName());
89  oc.addSynonyme("net-file", "net");
90  oc.addDescription("net-file", "Input", "Load road network description from FILE");
91  oc.addXMLDefault("net-file", "net");
92 
93  oc.doRegister("route-files", 'r', new Option_FileName());
94  oc.addSynonyme("route-files", "routes");
95  oc.addDescription("route-files", "Input", "Load routes descriptions from FILE(s)");
96 
97  oc.doRegister("additional-files", 'a', new Option_FileName());
98  oc.addSynonyme("additional-files", "additional");
99  oc.addDescription("additional-files", "Input", "Load further descriptions from FILE(s)");
100 
101  oc.doRegister("weight-files", 'w', new Option_FileName());
102  oc.addSynonyme("weight-files", "weights");
103  oc.addDescription("weight-files", "Input", "Load edge/lane weights for online rerouting from FILE");
104  oc.doRegister("weight-attribute", 'x', new Option_String("traveltime"));
105  oc.addSynonyme("weight-attribute", "measure", true);
106  oc.addDescription("weight-attribute", "Input", "Name of the xml attribute which gives the edge weight");
107 
108  oc.doRegister("load-state", new Option_FileName());
109  oc.addDescription("load-state", "Input", "Loads a network state from FILE");
110  oc.doRegister("load-state.offset", new Option_String("0", "TIME"));
111  oc.addDescription("load-state.offset", "Input", "Shifts all times loaded from a saved state by the given offset");
112  oc.doRegister("load-state.remove-vehicles", new Option_String(""));
113  oc.addDescription("load-state.remove-vehicles", "Input", "Removes vehicles with the given IDs from the loaded state");
114 
115  // register output options
116  oc.doRegister("netstate-dump", new Option_FileName());
117  oc.addSynonyme("netstate-dump", "ndump");
118  oc.addSynonyme("netstate-dump", "netstate");
119  oc.addSynonyme("netstate-dump", "netstate-output");
120  oc.addDescription("netstate-dump", "Output", "Save complete network states into FILE");
121  oc.doRegister("netstate-dump.empty-edges", new Option_Bool(false));
122  oc.addSynonyme("netstate-dump.empty-edges", "netstate.empty-edges");
123  oc.addSynonyme("netstate-dump.empty-edges", "netstate-output.empty-edges");
124  oc.addSynonyme("netstate-dump.empty-edges", "dump-empty-edges", true);
125  oc.addDescription("netstate-dump.empty-edges", "Output", "Write also empty edges completely when dumping");
126  oc.doRegister("netstate-dump.precision", new Option_Integer(2));
127  oc.addSynonyme("netstate-dump.precision", "netstate.precision");
128  oc.addSynonyme("netstate-dump.precision", "netstate-output.precision");
129  oc.addSynonyme("netstate-dump.precision", "dump-precision", true);
130  oc.addDescription("netstate-dump.precision", "Output", "Write positions and speeds with the given precision (default 2)");
131 
132 
133  oc.doRegister("emission-output", new Option_FileName());
134  oc.addDescription("emission-output", "Output", "Save the emission values of each vehicle");
135  oc.doRegister("emission-output.precision", new Option_Integer(2));
136  oc.addDescription("emission-output.precision", "Output", "Write emission values with the given precision (default 2)");
137 
138  oc.doRegister("battery-output", new Option_FileName());
139  oc.addDescription("battery-output", "Output", "Save the battery values of each vehicle");
140  oc.doRegister("battery-output.precision", new Option_Integer(2));
141  oc.addDescription("battery-output.precision", "Output", "Write battery values with the given precision (default 2)");
142 
143  oc.doRegister("fcd-output", new Option_FileName());
144  oc.addDescription("fcd-output", "Output", "Save the Floating Car Data");
145  oc.doRegister("fcd-output.geo", new Option_Bool(false));
146  oc.addDescription("fcd-output.geo", "Output", "Save the Floating Car Data using geo-coordinates (lon/lat)");
147  oc.doRegister("fcd-output.signals", new Option_Bool(false));
148  oc.addDescription("fcd-output.signals", "Output", "Add the vehicle signal state to the FCD output (brake lights etc.)");
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.intended-depart", new Option_Bool(false));
191  oc.addSynonyme("vehroute-output.intended-depart", "vehroutes.intended-depart");
192  oc.addDescription("vehroute-output.intended-depart", "Output", "Write the output with the intended instead of the real departure time");
193 
194  oc.doRegister("vehroute-output.route-length", new Option_Bool(false));
195  oc.addSynonyme("vehroute-output.route-length", "vehroutes.route-length");
196  oc.addDescription("vehroute-output.route-length", "Output", "Include total route length in the output");
197 
198  oc.doRegister("vehroute-output.write-unfinished", new Option_Bool(false));
199  oc.addDescription("vehroute-output.write-unfinished", "Output", "Write vehroute output for vehicles which have not arrived at simulation end");
200 
201  oc.doRegister("link-output", new Option_FileName());
202  oc.addDescription("link-output", "Output", "Save links states into FILE");
203 
204  oc.doRegister("bt-output", new Option_FileName());
205  oc.addDescription("bt-output", "Output", "Save bluetooth visibilities into FILE (in conjunction with device.btreceiver and device.btsender)");
206 
207  oc.doRegister("lanechange-output", new Option_FileName());
208  oc.addDescription("lanechange-output", "Output", "Record lane changes and their motivations for all vehicles into FILE");
209 
210  oc.doRegister("stop-output", new Option_FileName());
211  oc.addDescription("stop-output", "Output", "Record stops and loading/unloading of passenger and containers for all vehicles into FILE");
212 
213 #ifdef _DEBUG
214  oc.doRegister("movereminder-output", new Option_FileName());
215  oc.addDescription("movereminder-output", "Output", "Save movereminder states of selected vehicles into FILE");
216  oc.doRegister("movereminder-output.vehicles", new Option_String());
217  oc.addDescription("movereminder-output.vehicles", "Output", "List of vehicle ids which shall save their movereminder states");
218 #endif
219 
220  oc.doRegister("save-state.times", new Option_IntVector(IntVector()));
221  oc.addDescription("save-state.times", "Output", "Use INT[] as times at which a network state written");
222  oc.doRegister("save-state.period", new Option_String("-1", "TIME"));
223  oc.addDescription("save-state.period", "Output", "save state repeatedly after TIME period");
224  oc.doRegister("save-state.prefix", new Option_FileName("state"));
225  oc.addDescription("save-state.prefix", "Output", "Prefix for network states");
226  oc.doRegister("save-state.suffix", new Option_FileName(".sbx"));
227  oc.addDescription("save-state.suffix", "Output", "Suffix for network states (.sbx or .xml)");
228  oc.doRegister("save-state.files", new Option_FileName());//
229  oc.addDescription("save-state.files", "Output", "Files for network states");
230 
231  // register the simulation settings
232  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
233  oc.addDescription("begin", "Time", "Defines the begin time in seconds; The simulation starts at this time");
234 
235  oc.doRegister("end", 'e', new Option_String("-1", "TIME"));
236  oc.addDescription("end", "Time", "Defines the end time in seconds; The simulation ends at this time");
237 
238  oc.doRegister("step-length", new Option_String("1", "TIME"));
239  oc.addDescription("step-length", "Time", "Defines the step duration in seconds");
240 
241  oc.doRegister("step-method.ballistic", new Option_Bool(false));
242  oc.addDescription("step-method.ballistic", "Processing", "Whether to use ballistic method for the positional update of vehicles (default is a semi-implicit Euler method).");
243 
244  oc.doRegister("lateral-resolution", new Option_Float(-1));
245  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");
246 
247  // register the processing options
248  oc.doRegister("route-steps", 's', new Option_String("200", "TIME"));
249  oc.addDescription("route-steps", "Processing", "Load routes for the next number of seconds ahead");
250 
251 #ifdef HAVE_INTERNAL_LANES
252  oc.doRegister("no-internal-links", new Option_Bool(false));
253  oc.addDescription("no-internal-links", "Processing", "Disable (junction) internal links");
254 
255  oc.doRegister("ignore-junction-blocker", new Option_String("-1", "TIME"));
256  oc.addDescription("ignore-junction-blocker", "Processing", "Ignore vehicles which block the junction after they have been standing for SECONDS (-1 means never ignore)");
257 #endif
258 
259  oc.doRegister("ignore-route-errors", new Option_Bool(false));
260  oc.addDescription("ignore-route-errors", "Processing", "Do not check whether routes are connected");
261 
262  oc.doRegister("ignore-accidents", new Option_Bool(false));
263  oc.addDescription("ignore-accidents", "Processing", "Do not check whether accidents occur");
264 
265  oc.doRegister("collision.action", new Option_String("teleport"));
266  oc.addDescription("collision.action", "Processing", "How to deal with collisions: [none,warn,teleport,remove]");
267 
268  oc.doRegister("collision.check-junctions", new Option_Bool(false));
269  oc.addDescription("collision.check-junctions", "Processing", "Enables collisions checks on junctions");
270 
271  oc.doRegister("max-num-vehicles", new Option_Integer(-1));
272  oc.addDescription("max-num-vehicles", "Processing", "Delay vehicle insertion to stay within the given maximum number");
273 
274  oc.doRegister("scale", new Option_Float(1.));
275  oc.addDescription("scale", "Processing", "Scale demand by the given factor (by discarding or duplicating vehicles)");
276 
277  oc.doRegister("time-to-teleport", new Option_String("300", "TIME"));
278  oc.addDescription("time-to-teleport", "Processing", "Specify how long a vehicle may wait until being teleported, defaults to 300, non-positive values disable teleporting");
279 
280  oc.doRegister("time-to-teleport.highways", new Option_String("0", "TIME"));
281  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");
282 
283  oc.doRegister("waiting-time-memory", new Option_String("100", "TIME"));
284  oc.addDescription("waiting-time-memory", "Processing", "Length of time interval, over which accumulated waiting time is taken into account");
285 
286  oc.doRegister("max-depart-delay", new Option_String("-1", "TIME"));
287  oc.addDescription("max-depart-delay", "Processing", "How long vehicles wait for departure before being skipped, defaults to -1 which means vehicles are never skipped");
288 
289  oc.doRegister("sloppy-insert", new Option_Bool(false));
290  oc.addDescription("sloppy-insert", "Processing", "Whether insertion on an edge shall not be repeated in same step once failed");
291 
292  oc.doRegister("eager-insert", new Option_Bool(false));
293  oc.addDescription("eager-insert", "Processing", "Whether each vehicle is checked separately for insertion on an edge");
294 
295  oc.doRegister("random-depart-offset", new Option_String("0", "TIME"));
296  oc.addDescription("random-depart-offset", "Processing", "Each vehicle receives a random offset to its depart value drawn uniformly from [0, TIME]");
297 
298  oc.doRegister("lanechange.duration", new Option_String("0", "TIME"));
299  oc.addDescription("lanechange.duration", "Processing", "Duration of a lane change maneuver (default 0)");
300 
301  oc.doRegister("lanechange.overtake-right", new Option_Bool(false));
302  oc.addDescription("lanechange.overtake-right", "Processing", "Whether overtaking on the right on motorways is permitted");
303 
304  oc.doRegister("tls.all-off", new Option_Bool(false));
305  oc.addDescription("tls.all-off", "Processing", "Switches off all traffic lights.");
306 
307  // pedestrian model
308  oc.doRegister("pedestrian.model", new Option_String("striping"));
309  oc.addDescription("pedestrian.model", "Processing", "Select among pedestrian models ['nonInteracting', 'striping']");
310 
311  oc.doRegister("pedestrian.striping.stripe-width", new Option_Float(0.65));
312  oc.addDescription("pedestrian.striping.stripe-width", "Processing", "Width of parallel stripes for segmenting a sidewalk (meters) for use with model 'striping'");
313 
314  oc.doRegister("pedestrian.striping.dawdling", new Option_Float(0.2));
315  oc.addDescription("pedestrian.striping.dawdling", "Processing", "factor for random slow-downs [0,1] for use with model 'striping'");
316 
317  oc.doRegister("pedestrian.striping.jamtime", new Option_String("300", "TIME"));
318  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)");
319 
320  // generic routing options
321  oc.doRegister("routing-algorithm", new Option_String("dijkstra"));
322  oc.addDescription("routing-algorithm", "Routing",
323  "Select among routing algorithms ['dijkstra', 'astar', 'CH', 'CHWrapper']");
324  oc.doRegister("weights.random-factor", new Option_Float(1.));
325  oc.addDescription("weights.random-factor", "Routing", "Edge weights for routing are dynamically disturbed by a random factor drawn uniformly from [1,FLOAT)");
326 
327  // devices
328  oc.addOptionSubTopic("Emissions");
329  oc.doRegister("phemlight-path", new Option_FileName("./PHEMlight/"));
330  oc.addDescription("phemlight-path", "Emissions", "Determines where to load PHEMlight definitions from.");
331 
332  oc.addOptionSubTopic("Communication");
333  oc.addOptionSubTopic("Battery");
335 
336  // register report options
337  oc.doRegister("duration-log.disable", new Option_Bool(false));
338  oc.addSynonyme("duration-log.disable", "no-duration-log", false);
339  oc.addDescription("duration-log.disable", "Report", "Disable performance reports for individual simulation steps");
340 
341  oc.doRegister("duration-log.statistics", new Option_Bool(false));
342  oc.addDescription("duration-log.statistics", "Report", "Enable statistics on vehicle trips");
343 
344  oc.doRegister("no-step-log", new Option_Bool(false));
345  oc.addDescription("no-step-log", "Report", "Disable console output of current simulation step");
346 
347 
348 #ifndef NO_TRACI
349  //remote port 0 if not used
350  oc.addOptionSubTopic("TraCI Server");
351  oc.doRegister("remote-port", new Option_Integer(0));
352  oc.addDescription("remote-port", "TraCI Server", "Enables TraCI Server if set");
353 #ifdef HAVE_PYTHON
354  oc.doRegister("python-script", new Option_String());
355  oc.addDescription("python-script", "TraCI Server", "Runs TraCI script with embedded python");
356 #endif
357 #endif
358  //
359  oc.addOptionSubTopic("Mesoscopic");
360  oc.doRegister("mesosim", new Option_Bool(false));
361  oc.addDescription("mesosim", "Mesoscopic", "Enables mesoscopic simulation");
362  oc.doRegister("meso-edgelength", new Option_Float(98.0f));
363  oc.addDescription("meso-edgelength", "Mesoscopic", "Length of an edge segment in mesoscopic simulation");
364  oc.doRegister("meso-tauff", new Option_String("1.13", "TIME"));
365  oc.addDescription("meso-tauff", "Mesoscopic", "Factor for calculating the net free-free headway time");
366  oc.doRegister("meso-taufj", new Option_String("1.13", "TIME"));
367  oc.addDescription("meso-taufj", "Mesoscopic", "Factor for calculating the net free-jam headway time");
368  oc.doRegister("meso-taujf", new Option_String("1.73", "TIME"));
369  oc.addDescription("meso-taujf", "Mesoscopic", "Factor for calculating the jam-free headway time");
370  oc.doRegister("meso-taujj", new Option_String("1.4", "TIME"));
371  oc.addDescription("meso-taujj", "Mesoscopic", "Factor for calculating the jam-jam headway time");
372  oc.doRegister("meso-jam-threshold", new Option_Float(-1));
373  oc.addDescription("meso-jam-threshold", "Mesoscopic",
374  "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)");
375  oc.doRegister("meso-multi-queue", new Option_Bool(true));
376  oc.addDescription("meso-multi-queue", "Mesoscopic", "Enable multiple queues at edge ends");
377  oc.doRegister("meso-junction-control", new Option_Bool(false));
378  oc.addDescription("meso-junction-control", "Mesoscopic", "Enable mesoscopic traffic light and priority junction handling");
379  oc.doRegister("meso-junction-control.limited", new Option_Bool(false));
380  oc.addDescription("meso-junction-control.limited", "Mesoscopic",
381  "Enable mesoscopic traffic light and priority junction handling for saturated links. This prevents faulty traffic lights from hindering flow in low-traffic situations");
382  oc.doRegister("meso-tls-penalty", new Option_Float(0));
383  oc.addDescription("meso-tls-penalty", "Mesoscopic",
384  "Apply scaled time penalties when driving across tls controlled junctions based on green split instead of checking actual phases");
385  oc.doRegister("meso-minor-penalty", new Option_String("0", "TIME"));
386  oc.addDescription("meso-minor-penalty", "Mesoscopic",
387  "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.");
388  oc.doRegister("meso-overtaking", new Option_Bool(false));
389  oc.addDescription("meso-overtaking", "Mesoscopic", "Enable mesoscopic overtaking");
390  oc.doRegister("meso-recheck", new Option_String("0", "TIME"));
391  oc.addDescription("meso-recheck", "Mesoscopic", "Time interval for rechecking insertion into the next segment after failure");
392 
393  // add rand options
395 
396  // add GUI options
397  // the reason that we include them in vanilla sumo as well is to make reusing config files easy
398  oc.addOptionSubTopic("GUI Only");
399  oc.doRegister("gui-settings-file", new Option_FileName());
400  oc.addDescription("gui-settings-file", "GUI Only", "Load visualisation settings from FILE");
401 
402  oc.doRegister("quit-on-end", 'Q', new Option_Bool(false));
403  oc.addDescription("quit-on-end", "GUI Only", "Quits the GUI when the simulation stops");
404 
405  oc.doRegister("game", 'G', new Option_Bool(false));
406  oc.addDescription("game", "GUI Only", "Start the GUI in gaming mode");
407 
408  oc.doRegister("start", 'S', new Option_Bool(false));
409  oc.addDescription("start", "GUI Only", "Start the simulation after loading");
410 
411  oc.doRegister("demo", 'D', new Option_Bool(false));
412  oc.addDescription("demo", "GUI Only", "Restart the simulation after ending (demo mode)");
413 
414  oc.doRegister("disable-textures", 'T', new Option_Bool(false));
415  oc.addDescription("disable-textures", "GUI Only", "Do not load background pictures");
416 
417  oc.doRegister("window-size", new Option_String());
418  oc.addDescription("window-size", "GUI Only", "Create initial window with the given x,y size");
419 
420  oc.doRegister("window-pos", new Option_String());
421  oc.addDescription("window-pos", "GUI Only", "Create initial window at the given x,y position");
422 
423 #ifdef HAVE_OSG
424  oc.doRegister("osg-view", new Option_Bool(false));
425  oc.addDescription("osg-view", "GUI Only", "Start with an OpenSceneGraph view instead of the regular 2D view");
426 #endif
427 
428 }
429 
430 
431 void
433  // standard outputs
434  OutputDevice::createDeviceByOption("netstate-dump", "netstate", "netstate_file.xsd");
435  OutputDevice::createDeviceByOption("summary-output", "summary", "summary_file.xsd");
436  OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos", "tripinfo_file.xsd");
437 
438  //extended
439  OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd");
440  OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd");
441  OutputDevice::createDeviceByOption("battery-output", "battery-export");
442  OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd");
443  OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd");
444  OutputDevice::createDeviceByOption("amitran-output", "trajectories", "amitran/trajectories.xsd\" timeStepSize=\"" + toString(STEPS2MS(DELTA_T)));
445 
446  //OutputDevice::createDeviceByOption("vtk-output", "vtk-export");
447  OutputDevice::createDeviceByOption("link-output", "link-output");
448  OutputDevice::createDeviceByOption("bt-output", "bt-output");
449  OutputDevice::createDeviceByOption("lanechange-output", "lanechanges");
450  OutputDevice::createDeviceByOption("stop-output", "stops");
451 
452 #ifdef _DEBUG
453  OutputDevice::createDeviceByOption("movereminder-output", "movereminder-output");
454 #endif
455 
457  MSStopOut::init();
458 }
459 
460 
461 bool
464  bool ok = true;
465  if (!oc.isSet("net-file")) {
466  WRITE_ERROR("No network file (-n) specified.");
467  ok = false;
468  }
469  if (oc.getFloat("scale") < 0.) {
470  WRITE_ERROR("Invalid scaling factor.");
471  ok = false;
472  }
473  if (oc.getBool("vehroute-output.exit-times") && !oc.isSet("vehroute-output")) {
474  WRITE_ERROR("A vehroute-output file is needed for exit times.");
475  ok = false;
476  }
477  if (oc.isSet("gui-settings-file") &&
478  oc.getString("gui-settings-file") != "" &&
479  !oc.isUsableFileList("gui-settings-file")) {
480  ok = false;
481  }
482  if (oc.getBool("demo") && oc.isDefault("start")) {
483  oc.set("start", "true");
484  }
485  if (oc.getBool("demo") && oc.getBool("quit-on-end")) {
486  WRITE_ERROR("You can either restart or quit on end.");
487  ok = false;
488  }
489  if (oc.getBool("meso-junction-control.limited") && !oc.getBool("meso-junction-control")) {
490  oc.set("meso-junction-control", "true");
491  }
492  const SUMOTime begin = string2time(oc.getString("begin"));
493  const SUMOTime end = string2time(oc.getString("end"));
494  if (begin < 0) {
495  WRITE_ERROR("The begin time should not be negative.");
496  ok = false;
497  }
498  if (end != string2time("-1")) {
499  if (end < begin) {
500  WRITE_ERROR("The end time should be after the begin time.");
501  ok = false;
502  }
503  }
504  if (string2time(oc.getString("step-length")) <= 0) {
505  WRITE_ERROR("the minimum step-length is 0.001");
506  ok = false;
507  }
508 #ifdef _DEBUG
509  if (oc.isSet("movereminder-output.vehicles") && !oc.isSet("movereminder-output")) {
510  WRITE_ERROR("option movereminder-output.vehicles requires option movereminder-output to be set");
511  ok = false;
512  }
513 #endif
514  if (oc.getBool("sloppy-insert")) {
515  WRITE_WARNING("The option 'sloppy-insert' is deprecated, because it is now activated by default, see the new option 'eager-insert'.");
516  }
517  if (string2time(oc.getString("lanechange.duration")) > 0 && oc.getFloat("lateral-resolution") > 0) {
518  WRITE_ERROR("Only one of the options 'lanechange.duration' or 'lateral-resolution' may be given.");
519  }
520  if (oc.getBool("ignore-accidents")) {
521  WRITE_WARNING("The option 'ignore-accidents' is deprecated. Use 'collision.action none' instead.");
522  }
523  if (oc.getBool("duration-log.statistics") && oc.isDefault("verbose")) {
524  oc.set("verbose", "true");
525  }
526  if (oc.isDefault("precision") && string2time(oc.getString("step-length")) < 10) {
527  oc.set("precision", "3");
528  }
529  if (oc.getInt("precision") > 2) {
530  if (oc.isDefault("netstate-dump.precision")) {
531  oc.set("netstate-dump.precision", toString(oc.getInt("precision")));
532  }
533  if (oc.isDefault("emission-output.precision")) {
534  oc.set("emission-output.precision", toString(oc.getInt("precision")));
535  }
536  if (oc.isDefault("battery-output.precision")) {
537  oc.set("battery-output.precision", toString(oc.getInt("precision")));
538  }
539  }
540  ok &= MSDevice::checkOptions(oc);
542  return ok;
543 }
544 
545 
546 void
548  // pre-initialise the network
549  // set whether empty edges shall be printed on dump
550  MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges");
551 #ifdef HAVE_INTERNAL_LANES
552  // set whether internal lanes shall be used
553  MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links");
554  MSGlobals::gIgnoreJunctionBlocker = string2time(oc.getString("ignore-junction-blocker")) < 0 ?
555  std::numeric_limits<SUMOTime>::max() : string2time(oc.getString("ignore-junction-blocker"));
556 #else
559 #endif
560  // set the grid lock time
561  MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport"));
562  MSGlobals::gTimeToGridlockHighways = string2time(oc.getString("time-to-teleport.highways")) < 0 ? 0 : string2time(oc.getString("time-to-teleport.highways"));
563  MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents");
564  MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors");
565  MSGlobals::gLaneChangeDuration = string2time(oc.getString("lanechange.duration"));
566  MSGlobals::gLateralResolution = oc.getFloat("lateral-resolution");
567  MSGlobals::gStateLoaded = oc.isSet("load-state");
568  MSGlobals::gUseMesoSim = oc.getBool("mesosim");
569  MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited");
570  MSGlobals::gMesoOvertaking = oc.getBool("meso-overtaking");
571  MSGlobals::gMesoTLSPenalty = oc.getFloat("meso-tls-penalty");
572  MSGlobals::gMesoMinorPenalty = string2time(oc.getString("meso-minor-penalty"));
573  MSGlobals::gSemiImplicitEulerUpdate = !oc.getBool("step-method.ballistic");
575  MSGlobals::gUsingInternalLanes = false;
576  }
577  MSGlobals::gWaitingTimeMemory = string2time(oc.getString("waiting-time-memory"));
580 
581  DELTA_T = string2time(oc.getString("step-length"));
582 #ifdef _DEBUG
583  if (oc.isSet("movereminder-output")) {
584  MSBaseVehicle::initMoveReminderOutput(oc);
585  }
586 #endif
587 }
588 
589 
590 
591 /****************************************************************************/
592 
static bool gOmitEmptyEdgesOnDump
Information whether empty edges shall be written on dump.
Definition: MSGlobals.h:59
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:86
static void insertRandOptions()
Initialises the given options container with random number options.
Definition: RandHelper.cpp:53
long long int SUMOTime
Definition: SUMOTime.h:43
static void init()
Static intialization.
Definition: MSStopOut.cpp:47
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:76
static void buildStreams()
Builds the streams used possibly by the simulation.
Definition: MSFrame.cpp:432
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static bool gStateLoaded
Information whether a state has been loaded.
Definition: MSGlobals.h:92
SUMOTime DELTA_T
Definition: SUMOTime.cpp:40
static void initCollisionOptions(const OptionsCont &oc)
Definition: MSLane.cpp:2629
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static bool gMesoOvertaking
Definition: MSGlobals.h:101
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:51
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
static bool gCheck4Accidents
Definition: MSGlobals.h:80
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
Definition: MSFrame.cpp:70
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void init()
Static intialization.
#define max(a, b)
Definition: polyfonts.c:65
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
std::vector< int > IntVector
Definition of a vector of ints.
Definition: Option.h:48
static bool gCheckRoutes
Definition: MSGlobals.h:83
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:47
static SUMOTime gMesoMinorPenalty
Definition: MSGlobals.h:107
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:73
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
static bool checkOptions(OptionsCont &oc)
check device-specific options
Definition: MSDevice.cpp:73
static bool checkOptions()
Checks the set options.
Definition: MSFrame.cpp:462
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
static SUMOTime gTimeToGridlockHighways
Definition: MSGlobals.h:70
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
An integer-option.
Definition: Option.h:313
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:99
static SUMOReal gLateralResolution
Definition: MSGlobals.h:89
static SUMOTime gTimeToGridlock
Definition: MSGlobals.h:67
static void insertOptions(OptionsCont &oc)
Inserts options for building devices.
Definition: MSDevice.cpp:62
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:113
static SUMOTime gIgnoreJunctionBlocker
Definition: MSGlobals.h:77
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:63
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
Definition: MSFrame.cpp:547
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
static SUMOReal gMesoTLSPenalty
Definition: MSGlobals.h:104
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:86
static bool gUseMesoSim
Definition: MSGlobals.h:95
static bool gMesoLimitedJunctionControl
Definition: MSGlobals.h:98
#define STEPS2MS(x)
Definition: SUMOTime.h:68
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.