#include <MSFrame.h>
In addition to setting and checking options, this frame also sets global values via "setMSGlobals". They are stored in MSGlobals.
Also, global output streams are initialised within "buildStreams".
Definition at line 55 of file MSFrame.h.
Static Public Member Functions | |
| static void | buildStreams () throw (IOError) |
| Builds the streams used possibly by the simulation. | |
| static bool | checkOptions () |
| Checks the set options. | |
| static void | fillOptions () |
| Inserts options used by the simulation into the OptionsCont-singleton. | |
| static void | setMSGlobals (OptionsCont &oc) |
| Sets the global microsim-options. | |
| void MSFrame::buildStreams | ( | ) | throw (IOError) [static] |
Builds the streams used possibly by the simulation.
Definition at line 270 of file MSFrame.cpp.
References OutputDevice::createDeviceByOption().
Referenced by NLBuilder::buildNet().
00270 { 00271 // standard outputs 00272 OutputDevice::createDeviceByOption("netstate-dump", "sumo-netstate"); 00273 OutputDevice::createDeviceByOption("emissions-output", "emissions"); 00274 OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos"); 00275 OutputDevice::createDeviceByOption("vehroute-output", "routes"); 00276 }
| bool MSFrame::checkOptions | ( | ) | [static] |
Checks the set options.
The following constraints must be valid:
Definition at line 280 of file MSFrame.cpp.
References OptionsCont::getBool(), MsgHandler::getErrorInstance(), OptionsCont::getInt(), OptionsCont::getOptions(), MsgHandler::inform(), and OptionsCont::isSet().
Referenced by main(), and GUILoadThread::run().
00280 { 00281 OptionsCont &oc = OptionsCont::getOptions(); 00282 bool ok = true; 00283 // check the existance of a name for simulation file 00284 if (!oc.isSet("n")) { 00285 MsgHandler::getErrorInstance()->inform("No network file (-n) specified."); 00286 ok = false; 00287 } 00288 // check if the begin and the end of the simulation are supplied 00289 if (!oc.isSet("b")) { 00290 MsgHandler::getErrorInstance()->inform("The begin of the simulation (-b) is not specified."); 00291 ok = false; 00292 } 00293 if (!oc.isSet("e")) { 00294 MsgHandler::getErrorInstance()->inform("The end of the simulation (-e) is not specified."); 00295 ok = false; 00296 } 00297 if (oc.isSet("incremental-dua-step") && oc.isSet("incremental-dua-base")) { 00298 if (oc.getInt("incremental-dua-step") > oc.getInt("incremental-dua-base")) { 00299 MsgHandler::getErrorInstance()->inform("Invalid dua step"); 00300 ok = false; 00301 } 00302 } 00303 if (oc.getBool("vehroutes.exit-times") && !oc.isSet("vehroutes")) { 00304 MsgHandler::getErrorInstance()->inform("A vehroute-output file is needed for exit times."); 00305 ok = false; 00306 } 00307 return ok; 00308 }
| void MSFrame::fillOptions | ( | ) | [static] |
Inserts options used by the simulation into the OptionsCont-singleton.
Device-options are inserted by calling the device's "insertOptions" -methods.
!! check, describe
!! check, describe
!! check, describe
!! recheck
!! recheck
!! recheck
!! recheck
!! recheck
!! recheck
!! recheck
!! recheck
!! recheck
Definition at line 58 of file MSFrame.cpp.
References OptionsCont::addCallExample(), SystemFrame::addConfigurationOptions(), OptionsCont::addDescription(), OptionsCont::addOptionSubTopic(), SystemFrame::addReportOptions(), OptionsCont::addSynonyme(), OptionsCont::doRegister(), OptionsCont::getOptions(), MSDevice_HBEFA::insertOptions(), MSDevice_Routing::insertOptions(), RandHelper::insertRandOptions(), and SUMOReal.
Referenced by GUILoadThread::initOptions(), and main().
00058 { 00059 OptionsCont &oc = OptionsCont::getOptions(); 00060 oc.addCallExample("-b 0 -e 1000 -n net.xml -r routes.xml"); 00061 oc.addCallExample("-c munich_config.cfg"); 00062 oc.addCallExample("--help"); 00063 00064 // insert options sub-topics 00065 SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too 00066 oc.addOptionSubTopic("Input"); 00067 oc.addOptionSubTopic("Output"); 00068 oc.addOptionSubTopic("Time"); 00069 oc.addOptionSubTopic("Processing"); 00070 oc.addOptionSubTopic("TLS Defaults"); 00071 SystemFrame::addReportOptions(oc); // fill this subtopic, too 00072 00073 00074 // register configuration options 00075 // register input options 00076 oc.doRegister("net-file", 'n', new Option_FileName()); 00077 oc.addSynonyme("net-file", "net"); 00078 oc.addDescription("net-file", "Input", "Load road network description from FILE"); 00079 00080 oc.doRegister("route-files", 'r', new Option_FileName()); 00081 oc.addSynonyme("route-files", "routes"); 00082 oc.addDescription("route-files", "Input", "Load routes descriptions from FILE(s)"); 00083 00084 oc.doRegister("additional-files", 'a', new Option_FileName()); 00085 oc.addSynonyme("additional-files", "additional"); 00086 oc.addDescription("additional-files", "Input", "Load further descriptions from FILE(s)"); 00087 00088 oc.doRegister("weight-files", 'w', new Option_FileName()); // !!! describe 00089 oc.addSynonyme("weight-files", "weights"); 00090 oc.addDescription("weight-files", "Input", "Load weights from FILE"); 00091 oc.doRegister("measure", 'm', new Option_String()); // !!! describe 00092 oc.addDescription("measure", "Input", "Load <measure> from weights"); 00093 00094 #ifdef HAVE_MESOSIM 00095 oc.doRegister("load-state", new Option_FileName()); 00096 oc.addDescription("load-state", "Input", "Loads a network state from FILE"); 00097 oc.doRegister("load-state.offset", new Option_String("0", "TIME")); 00098 oc.addDescription("load-state.offset", "Input", "Sets the time offset for vehicle segment exit times."); 00099 #endif 00100 00101 // register output options 00102 oc.doRegister("netstate-dump", new Option_FileName()); 00103 oc.addSynonyme("netstate-dump", "ndump"); 00104 oc.addSynonyme("netstate-dump", "netstate"); 00105 oc.addDescription("netstate-dump", "Output", "Save complete network states into FILE"); 00106 oc.doRegister("dump-empty-edges", new Option_Bool(false)); 00107 oc.addDescription("dump-empty-edges", "Output", "Write also empty edges completely when dumping"); 00108 00109 oc.doRegister("emissions-output", new Option_FileName()); 00110 oc.addSynonyme("emissions-output", "emissions"); 00111 oc.addDescription("emissions-output", "Output", "Save aggregated vehicle emission inf. into FILE"); 00112 00113 oc.doRegister("tripinfo-output", new Option_FileName()); 00114 oc.addSynonyme("tripinfo-output", "tripinfo"); 00115 oc.addDescription("tripinfo-output", "Output", "Save single vehicle trip inf. into FILE"); 00116 00117 oc.doRegister("vehroute-output", new Option_FileName()); 00118 oc.addSynonyme("vehroute-output", "vehroutes"); 00119 oc.addDescription("vehroute-output", "Output", "Save single vehicle route inf. into FILE"); 00120 00121 oc.doRegister("vehroute-output.exit-times", new Option_Bool(false)); 00122 oc.addSynonyme("vehroute-output.exit-times", "vehroutes.exit-times"); 00123 oc.addDescription("vehroute-output.exit-times", "Output", "Write the exit times for all edges"); 00124 00125 oc.doRegister("vehroute-output.last-route", new Option_Bool(false)); 00126 oc.addSynonyme("vehroute-output.last-route", "vehroutes.last-route"); 00127 oc.addDescription("vehroute-output.last-route", "Output", "Write the last route only"); 00128 00129 #ifdef HAVE_MESOSIM 00130 oc.doRegister("save-state.times", new Option_IntVector(IntVector())); 00131 oc.addDescription("save-state.times", "Output", "Use INT[] as times at which a network state written"); 00132 oc.doRegister("save-state.prefix", new Option_FileName()); 00133 oc.addDescription("save-state.prefix", "Output", "Prefix for network states"); 00134 oc.doRegister("save-state.files", new Option_FileName()); 00135 oc.addDescription("save-state.files", "Output", "Files for network states"); 00136 #endif 00137 00138 // register the simulation settings 00139 oc.doRegister("begin", 'b', new Option_String("0", "TIME")); 00140 oc.addDescription("begin", "Time", "Defines the begin time; The simulation starts at this time"); 00141 00142 oc.doRegister("end", 'e', new Option_String("-1", "TIME")); 00143 oc.addDescription("end", "Time", "Defines the end time; The simulation ends at this time"); 00144 00145 #ifdef HAVE_SUBSECOND_TIMESTEPS 00146 oc.doRegister("step-length", new Option_String("1", "TIME")); 00147 oc.addDescription("step-length", "Time", "Defines the step duration"); 00148 #endif 00149 00150 00151 // register the processing options 00152 oc.doRegister("route-steps", 's', new Option_Integer(200)); 00153 oc.addDescription("route-steps", "Processing", "Load routes for the next INT steps ahead"); 00154 00155 #ifdef HAVE_INTERNAL_LANES 00156 oc.doRegister("no-internal-links", new Option_Bool(false)); 00157 oc.addDescription("no-internal-links", "Processing", "Disable (junction) internal links"); 00158 #endif 00159 00160 oc.doRegister("ignore-accidents", new Option_Bool(false)); 00161 oc.addDescription("ignore-accidents", "Processing", "Do not check whether accidents occure more deeply"); 00162 00163 oc.doRegister("too-many-vehicles", new Option_Integer(-1)); 00164 oc.addDescription("too-many-vehicles", "Processing", "Quit simulation if this number of vehicles is exceeded"); 00165 00166 oc.doRegister("incremental-dua-step", new Option_Integer(-1)); 00167 oc.addDescription("incremental-dua-step", "Processing", "Perform the simulation as a step in incremental DUA"); 00168 oc.doRegister("incremental-dua-base", new Option_Integer(10)); 00169 oc.addDescription("incremental-dua-base", "Processing", "Base value for incremental DUA"); 00170 00171 oc.doRegister("time-to-teleport", new Option_String("300", "TIME")); 00172 oc.addDescription("time-to-teleport", "Processing", "Specify how long a vehicle may wait until being teleported"); 00173 00174 oc.doRegister("max-depart-delay", new Option_Integer(-1)); 00175 oc.addDescription("max-depart-delay", "Processing", "How long vehicles wait for departure before being skipped"); 00176 00177 oc.doRegister("sloppy-emit", new Option_Bool(false)); 00178 oc.addDescription("sloppy-emit", "Processing", "Whether emission on an edge shall not be repeated in same step once failed."); 00179 00180 // devices 00181 MSDevice_Routing::insertOptions(); 00182 MSDevice_HBEFA::insertOptions(); 00183 00184 00185 // tls 00186 oc.doRegister("agent-tl.detector-len", new Option_Float(75)); 00187 oc.addDescription("agent-tl.detector-len", "TLS Defaults", ""); 00188 00189 oc.doRegister("agent-tl.learn-horizon", new Option_Integer(3)); 00190 oc.addDescription("agent-tl.learn-horizon", "TLS Defaults", ""); 00191 00192 oc.doRegister("agent-tl.decision-horizon", new Option_Integer(1)); 00193 oc.addDescription("agent-tl.decision-horizon", "TLS Defaults", ""); 00194 00195 oc.doRegister("agent-tl.min-diff", new Option_Float((SUMOReal) .1)); 00196 oc.addDescription("agent-tl.min-diff", "TLS Defaults", ""); 00197 00198 oc.doRegister("agent-tl.tcycle", new Option_Integer(90)); 00199 oc.addDescription("agent-tl.tcycle", "TLS Defaults", ""); 00200 00201 oc.doRegister("actuated-tl.detector-pos", new Option_Float(100)); 00202 oc.addDescription("actuated-tl.detector-pos", "TLS Defaults", ""); 00203 00204 oc.doRegister("actuated-tl.max-gap", new Option_Float(3.1f)); 00205 oc.addDescription("actuated-tl.max-gap", "TLS Defaults", ""); 00206 00207 oc.doRegister("actuated-tl.detector-gap", new Option_Float(3.0f)); 00208 oc.addDescription("actuated-tl.detector-gap", "TLS Defaults", ""); 00209 00210 oc.doRegister("actuated-tl.passing-time", new Option_Float(1.9f)); 00211 oc.addDescription("actuated-tl.passing-time", "TLS Defaults", ""); 00212 00213 00214 // register report options 00215 oc.doRegister("no-duration-log", new Option_Bool(false)); 00216 oc.addDescription("no-duration-log", "Report", "Disable performance reports for individual simulation steps"); 00217 00218 oc.doRegister("no-step-log", new Option_Bool(false)); 00219 oc.addDescription("no-step-log", "Report", "Disable console output of current simulation step"); 00220 00221 oc.doRegister("message-log", new Option_FileName()); 00222 oc.addDescription("message-log", "Report", "Writes all non-error messages to FILE"); 00223 00224 oc.doRegister("error-log", new Option_FileName()); 00225 oc.addDescription("error-log", "Report", "Writes all warnings and errors to FILE"); 00226 00227 00228 #ifndef NO_TRACI 00229 //remote port 0 if not used 00230 oc.addOptionSubTopic("TraCI Server"); 00231 oc.doRegister("remote-port", new Option_Integer(0)); 00232 oc.addDescription("remote-port", "TraCI Server", "Enables TraCI Server if set"); 00233 oc.doRegister("penetration", new Option_Float(1.0f)); 00234 oc.addDescription("penetration", "TraCI Server", "Value in 0..1 [default: 1]"); 00235 #endif 00236 // 00237 #ifdef HAVE_MESOSIM 00238 oc.addOptionSubTopic("Mesoscopic"); 00239 oc.doRegister("mesosim", new Option_Bool(false)); 00240 oc.addDescription("mesosim", "Mesoscopic", "Enables mesoscopic simulation"); 00241 oc.doRegister("meso-edgelength", new Option_Float(98.0f)); 00242 oc.addDescription("meso-edgelength", "Mesoscopic", "Length of an edge segment in mesoscopic simulation"); 00243 oc.doRegister("meso-tauff", new Option_String("1.4", "TIME")); 00244 oc.addDescription("meso-tauff", "Mesoscopic", "Factor for calculating the free-free headway time"); 00245 oc.doRegister("meso-taufj", new Option_String("1.4", "TIME")); 00246 oc.addDescription("meso-taufj", "Mesoscopic", "Factor for calculating the free-jam headway time"); 00247 oc.doRegister("meso-taujf", new Option_String("2", "TIME")); 00248 oc.addDescription("meso-taujf", "Mesoscopic", "Factor for calculating the jam-free headway time"); 00249 oc.doRegister("meso-taujj", new Option_String("2", "TIME")); 00250 oc.addDescription("meso-taujj", "Mesoscopic", "Factor for calculating the jam-jam headway time"); 00251 oc.doRegister("meso-jam-threshold", new Option_Float(0.29f)); 00252 oc.addDescription("meso-jam-threshold", "Mesoscopic", "Minimum percentage of occupied space to consider a segment jammed"); 00253 oc.doRegister("meso-multi-queue", new Option_Bool(false)); 00254 oc.addDescription("meso-multi-queue", "Mesoscopic", "Enable multiple queues at edge ends"); 00255 oc.doRegister("meso-junction-control", new Option_Bool(false)); 00256 oc.addDescription("meso-junction-control", "Mesoscopic", "Enable mesoscopic traffic light and priority junction handling"); 00257 #endif 00258 00259 // add rand options 00260 RandHelper::insertRandOptions(); 00261 00262 oc.addOptionSubTopic("GUI Only"); 00263 oc.doRegister("gui-settings-file", new Option_FileName("")); 00264 oc.addDescription("gui-settings-file", "GUI Only", "Load visualisation settings from FILE"); 00265 00266 }
| void MSFrame::setMSGlobals | ( | OptionsCont & | oc | ) | [static] |
Sets the global microsim-options.
| [in] | oc | The options container to get the values from |
Definition at line 312 of file MSFrame.cpp.
References DELTA_T, MSGlobals::gCheck4Accidents, OptionsCont::getBool(), OptionsCont::getString(), MSGlobals::gOmitEmptyEdgesOnDump, MSGlobals::gTimeToGridlock, MSGlobals::gUsingInternalLanes, OptionsCont::isSet(), and string2time().
Referenced by load(), and GUILoadThread::run().
00312 { 00313 // pre-initialise the network 00314 // set whether empty edges shall be printed on dump 00315 MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("dump-empty-edges"); 00316 #ifdef HAVE_INTERNAL_LANES 00317 // set whether internal lanes shall be used 00318 MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links"); 00319 #else 00320 MSGlobals::gUsingInternalLanes = false; 00321 #endif 00322 // set the grid lock time 00323 MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport"))<0 ? 0 : string2time(oc.getString("time-to-teleport")); 00324 // 00325 MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents"); 00326 #ifdef HAVE_MESOSIM 00327 MSGlobals::gStateLoaded = oc.isSet("load-state"); 00328 #endif 00329 // 00330 #ifdef HAVE_SUBSECOND_TIMESTEPS 00331 DELTA_T = string2time(oc.getString("step-length")); 00332 #endif 00333 // 00334 #ifdef HAVE_MESOSIM 00335 MSGlobals::gUseMesoSim = oc.getBool("mesosim"); 00336 #endif 00337 }
1.5.6