Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NLBuilder.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// The main interface for loading a microsim
21/****************************************************************************/
22#include <config.h>
23
24#include <iostream>
25#include <vector>
26#include <string>
27#include <map>
28
41#include <utils/xml/XMLSubSys.h>
42#ifdef HAVE_FOX
44#endif
45#include <libsumo/Helper.h>
49#include <microsim/MSNet.h>
55#include <microsim/MSGlobals.h>
57#include <microsim/MSFrame.h>
63
64#include "NLHandler.h"
65#include "NLNetShapeHandler.h"
68#include "NLDetectorBuilder.h"
69#include "NLTriggerBuilder.h"
70#include "NLBuilder.h"
71
72
73// ===========================================================================
74// method definitions
75// ===========================================================================
76// ---------------------------------------------------------------------------
77// NLBuilder::EdgeFloatTimeLineRetriever_EdgeWeight - methods
78// ---------------------------------------------------------------------------
79void
81 double value, double begTime, double endTime) const {
82 MSEdge* edge = MSEdge::dictionary(id);
83 if (edge != nullptr) {
84 myNet.getWeightsStorage().addEffort(edge, begTime, endTime, value);
85 } else {
86 WRITE_ERRORF(TL("Trying to set the effort for the unknown edge '%'."), id);
87 }
88}
89
90
91// ---------------------------------------------------------------------------
92// NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime - methods
93// ---------------------------------------------------------------------------
94void
96 double value, double begTime, double endTime) const {
97 MSEdge* edge = MSEdge::dictionary(id);
98 if (edge != nullptr) {
99 myNet.getWeightsStorage().addTravelTime(edge, begTime, endTime, value);
100 } else {
101 WRITE_ERRORF(TL("Trying to set the travel time for the unknown edge '%'."), id);
102 }
103}
104
105
106// ---------------------------------------------------------------------------
107// NLBuilder - methods
108// ---------------------------------------------------------------------------
110 MSNet& net,
114 NLHandler& xmlHandler)
117 myNet(net), myXMLHandler(xmlHandler) {}
118
119
121
122
123bool
125 // try to build the net
126 if (!load("net-file", true)) {
127 return false;
128 }
129 if (myXMLHandler.networkVersion() == MMVersion(0, 0)) {
130 throw ProcessError(TL("Invalid network, no network version declared."));
131 }
132 // check whether the loaded net agrees with the simulation options
133 if ((myOptions.getBool("no-internal-links") || myOptions.getBool("mesosim")) && myXMLHandler.haveSeenInternalEdge() && myXMLHandler.haveSeenDefaultLength()) {
134 WRITE_WARNING(TL("Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times."));
135 }
136 buildNet();
137 if (myOptions.isSet("alternative-net-file")) {
138 for (std::string fname : myOptions.getStringVector("alternative-net-file")) {
139 const long before = PROGRESS_BEGIN_TIME_MESSAGE("Loading alternative net from '" + fname + "'");
140 NLNetShapeHandler nsh(fname, myNet);
141 if (!XMLSubSys::runParser(nsh, fname, true)) {
142 WRITE_MESSAGE("Loading of alternative net failed.");
143 return false;
144 }
145 nsh.sortInternalShapes();
146 PROGRESS_TIME_MESSAGE(before);
147 }
148 }
149 // @note on loading order constraints:
150 // - additional-files before route-files and state-files due to referencing
151 // - additional-files before weight-files since the latter might contain intermodal edge data and the intermodal net depends on the stops and public transport from the additionals
152
153 bool stateBeginMismatch = false;
154 if (myOptions.isSet("load-state")) {
155 // first, load only the time
157 if (myOptions.isDefault("begin")) {
158 myOptions.set("begin", time2string(stateTime));
159 if (TraCIServer::getInstance() != nullptr) {
161 }
162 } else {
163 if (stateTime != string2time(myOptions.getString("begin"))) {
164 WRITE_WARNINGF(TL("State was written at a different time=% than the begin time %!"), time2string(stateTime), myOptions.getString("begin"));
165 stateBeginMismatch = true;
166 }
167 }
168 }
169
170 if (myOptions.getBool("junction-taz")) {
171 // create a TAZ for every junction
172 const MSJunctionControl& junctions = myNet.getJunctionControl();
173 for (auto it = junctions.begin(); it != junctions.end(); it++) {
174 const std::string sinkID = it->first + "-sink";
175 const std::string sourceID = it->first + "-source";
176 if (MSEdge::dictionary(sinkID) == nullptr && MSEdge::dictionary(sourceID) == nullptr) {
177 // sink must be built and added before source
178 MSEdge* sink = myEdgeBuilder.buildEdge(sinkID, SumoXMLEdgeFunc::CONNECTOR, "", "", -1, 0);
179 MSEdge* source = myEdgeBuilder.buildEdge(sourceID, SumoXMLEdgeFunc::CONNECTOR, "", "", -1, 0);
180 sink->setOtherTazConnector(source);
181 source->setOtherTazConnector(sink);
182 MSEdge::dictionary(sinkID, sink);
183 MSEdge::dictionary(sourceID, source);
184 sink->initialize(new std::vector<MSLane*>());
185 source->initialize(new std::vector<MSLane*>());
186 const MSJunction* junction = it->second;
187 for (const MSEdge* edge : junction->getIncoming()) {
188 if (!edge->isInternal()) {
189 const_cast<MSEdge*>(edge)->addSuccessor(sink);
190 }
191 }
192 for (const MSEdge* edge : junction->getOutgoing()) {
193 if (!edge->isInternal()) {
194 source->addSuccessor(const_cast<MSEdge*>(edge));
195 }
196 }
197 } else {
198 WRITE_WARNINGF(TL("A TAZ with id '%' already exists. Not building junction TAZ."), it->first)
199 }
200 }
201 }
202
203 // load additional net elements (sources, detectors, ...)
204 if (myOptions.isSet("additional-files")) {
205 if (!load("additional-files")) {
206 return false;
207 }
208 // load shapes with separate handler
210 if (!ShapeHandler::loadFiles(myOptions.getStringVector("additional-files"), sh)) {
211 return false;
212 }
215 }
219 tll->initMesoTLSPenalties();
220 }
221 }
223 }
224 // init tls after all detectors have been loaded
226 // declare meandata set by options
227 buildDefaultMeanData("edgedata-output", "DEFAULT_EDGEDATA", false);
228 buildDefaultMeanData("lanedata-output", "DEFAULT_LANEDATA", true);
229
230 if (stateBeginMismatch && myNet.getVehicleControl().getLoadedVehicleNo() > 0) {
231 throw ProcessError(TL("Loading vehicles ahead of a state file is not supported. Correct --begin option or load vehicles with option --route-files"));
232 }
233
234 // load weights if wished
235 if (myOptions.isSet("weight-files")) {
236 if (!myOptions.isUsableFileList("weight-files")) {
237 return false;
238 }
239 // build and prepare the weights handler
240 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
241 // travel time, first (always used)
243 retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition("traveltime", true, ttRetriever));
244 // the measure to use, then
246 std::string measure = myOptions.getString("weight-attribute");
247 if (!myOptions.isDefault("weight-attribute")) {
248 if (measure == "CO" || measure == "CO2" || measure == "HC" || measure == "PMx" || measure == "NOx" || measure == "fuel" || measure == "electricity") {
249 measure += "_perVeh";
250 }
251 retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition(measure, true, eRetriever));
252 }
253 // set up handler
254 SAXWeightsHandler handler(retrieverDefs, "");
255 // start parsing; for each file in the list
256 std::vector<std::string> files = myOptions.getStringVector("weight-files");
257 for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
258 // report about loading when wished
259 WRITE_MESSAGEF(TL("Loading weights from '%'..."), *i);
260 // parse the file
261 if (!XMLSubSys::runParser(handler, *i)) {
262 return false;
263 }
264 }
265 }
266 // load the previous state if wished
267 if (myOptions.isSet("load-state")) {
269 const std::string& f = myOptions.getString("load-state");
270 long before = PROGRESS_BEGIN_TIME_MESSAGE(TLF("Loading state from '%'", f));
271 MSStateHandler h(f, string2time(myOptions.getString("load-state.offset")));
273 if (MsgHandler::getErrorInstance()->wasInformed()) {
274 return false;
275 }
276 PROGRESS_TIME_MESSAGE(before);
277 }
278 // routes from FCD files
280 // load routes
281 if (myOptions.isSet("route-files") && string2time(myOptions.getString("route-steps")) <= 0) {
282 if (!load("route-files")) {
283 return false;
284 }
285 }
286 // optionally switch off traffic lights
287 if (myOptions.getBool("tls.all-off")) {
289 }
290 WRITE_MESSAGE(TL("Loading done."));
291 return true;
292}
293
294
295MSNet*
296NLBuilder::init(const bool isLibsumo) {
298 oc.clear();
303 return nullptr;
304 }
306 std::string validation = oc.getString("xml-validation");
307 std::string routeValidation = oc.getString("xml-validation.routes");
308 if (isLibsumo) {
309 if (oc.isDefault("xml-validation")) {
310 validation = "never";
311 }
312 if (oc.isDefault("xml-validation.routes")) {
313 routeValidation = "never";
314 }
315 }
316 XMLSubSys::setValidation(validation, oc.getString("xml-validation.net"), routeValidation);
317 if (!MSFrame::checkOptions()) {
318 throw ProcessError();
319 }
320#ifdef HAVE_FOX
321 if (oc.getInt("threads") > 1) {
322 // make the output aware of threading
324 }
325#endif
329 MSVehicleControl* vc = nullptr;
331 vc = new MEVehicleControl();
332 } else {
333 vc = new MSVehicleControl();
334 }
335 MSNet* net = new MSNet(vc, new MSEventControl(), new MSEventControl(), new MSEventControl());
336 // need to init TraCI-Server before loading routes to catch VehicleState::BUILT
337 TraCIServer::openSocket(std::map<int, TraCIServer::CmdExecutor>());
338 if (isLibsumo) {
340 }
341
343 NLDetectorBuilder db(*net);
344 NLJunctionControlBuilder jb(*net, db);
346 NLHandler handler("", *net, db, tb, eb, jb);
347 tb.setHandler(&handler);
348 NLBuilder builder(oc, *net, eb, jb, db, handler);
352 if (builder.build()) {
353 // preload the routes especially for TraCI
354 net->loadRoutes();
355 return net;
356 }
357 delete net;
358 throw ProcessError();
359}
360
361
362void
372
373
374void
376 MSEdgeControl* edges = nullptr;
377 MSJunctionControl* junctions = nullptr;
378 SUMORouteLoaderControl* routeLoaders = nullptr;
379 MSTLLogicControl* tlc = nullptr;
380 std::vector<SUMOTime> stateDumpTimes;
381 std::vector<std::string> stateDumpFiles;
382 try {
383 MSFrame::buildStreams(); // ensure streams are ready for output during building
385 junctions = myJunctionBuilder.build();
386 junctions->postloadInitContainer();
387 routeLoaders = buildRouteLoaderControl(myOptions);
389 for (std::string timeStr : myOptions.getStringVector("save-state.times")) {
390 stateDumpTimes.push_back(string2time(timeStr));
391 }
392 if (myOptions.isSet("save-state.files")) {
393 stateDumpFiles = myOptions.getStringVector("save-state.files");
394 if (stateDumpFiles.size() != stateDumpTimes.size()) {
395 throw ProcessError(TL("Wrong number of state file names!"));
396 }
397 } else {
398 const std::string prefix = myOptions.getString("save-state.prefix");
399 const std::string suffix = myOptions.getString("save-state.suffix");
400 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
401 std::string timeStamp = time2string(*i);
402 std::replace(timeStamp.begin(), timeStamp.end(), ':', '-');
403 stateDumpFiles.push_back(prefix + "_" + timeStamp + suffix);
404 }
405 }
406 } catch (ProcessError&) {
409 delete edges;
410 delete junctions;
411 delete routeLoaders;
412 delete tlc;
413 throw;
414 }
415 // if anthing goes wrong after this point, the net is responsible for cleaning up
416 myNet.closeBuilding(myOptions, edges, junctions, routeLoaders, tlc, stateDumpTimes, stateDumpFiles,
420}
421
422
423bool
424NLBuilder::load(const std::string& mmlWhat, const bool isNet) {
425 if (!myOptions.isUsableFileList(mmlWhat)) {
426 return false;
427 }
428 std::vector<std::string> files = myOptions.getStringVector(mmlWhat);
429 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
430 const long before = PROGRESS_BEGIN_TIME_MESSAGE(TLF("Loading % from '%'", mmlWhat, *fileIt));
431 if (!XMLSubSys::runParser(myXMLHandler, *fileIt, isNet)) {
432 WRITE_MESSAGEF(TL("Loading of % failed."), mmlWhat);
433 return false;
434 }
435 PROGRESS_TIME_MESSAGE(before);
436 }
437 return true;
438}
439
440
443 // build the loaders
444 SUMORouteLoaderControl* loaders = new SUMORouteLoaderControl(string2time(oc.getString("route-steps")));
445 // check whether a list is existing
446 if (oc.isSet("route-files") && string2time(oc.getString("route-steps")) > 0) {
447 std::vector<std::string> files = oc.getStringVector("route-files");
448 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
449 if (!FileHelpers::isReadable(*fileIt)) {
450 throw ProcessError(TLF("The route file '%' is not accessible.", *fileIt));
451 }
452 }
453 // open files for reading
454 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
455 loaders->add(new SUMORouteLoader(new MSRouteHandler(*fileIt, false)));
456 }
457 }
458 return loaders;
459}
460
461
462void
463NLBuilder::buildDefaultMeanData(const std::string& optionName, const std::string& id, bool useLanes) {
464 if (OptionsCont::getOptions().isSet(optionName)) {
465 if (useLanes && MSGlobals::gUseMesoSim && !OptionsCont::getOptions().getBool("meso-lane-queue")) {
466 WRITE_WARNING(TL("LaneData requested for mesoscopic simulation but --meso-lane-queue is not active. Falling back to edgeData."));
467 useLanes = false;
468 }
469 try {
470 myDetectorBuilder.createEdgeLaneMeanData(id, -1, 0, -1, "traffic", useLanes, false, false,
471 false, false, false, 100000, 0, SUMO_const_haltingSpeed, "", "", std::vector<MSEdge*>(), false,
472 OptionsCont::getOptions().getString(optionName));
473 } catch (InvalidArgument& e) {
474 WRITE_ERROR(e.what());
475 } catch (IOError& e) {
476 WRITE_ERROR(e.what());
477 }
478 }
479}
480
481/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:298
#define WRITE_ERRORF(...)
Definition MsgHandler.h:305
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:297
#define WRITE_ERROR(msg)
Definition MsgHandler.h:304
#define WRITE_WARNING(msg)
Definition MsgHandler.h:295
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition MsgHandler.h:301
#define TL(string)
Definition MsgHandler.h:315
#define PROGRESS_TIME_MESSAGE(before)
Definition MsgHandler.h:302
#define TLF(string,...)
Definition MsgHandler.h:317
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Definition StdDefs.h:67
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition StdDefs.h:58
static bool isReadable(std::string path)
Checks whether the given file is readable.
The class responsible for building and deletion of vehicles (gui-version)
static SumoRNG * getRecognitionRNG()
static void init()
Static intialization.
static SumoRNG * getResponseTimeRNG()
static SumoRNG * getEquipmentRNG()
Definition MSDevice.h:89
Stores edges and lanes, performs moving of vehicle.
void setMesoTypes()
update meso edge type parameters
void setAdditionalRestrictions()
apply additional restrictions
A road/street connecting two junctions.
Definition MSEdge.h:77
void setOtherTazConnector(const MSEdge *edge)
Definition MSEdge.h:295
static void clear()
Clears the dictionary.
Definition MSEdge.cpp:1092
void addSuccessor(MSEdge *edge, const MSEdge *via=nullptr)
Adds an edge to the list of edges which may be reached from this edge and to the incoming of the othe...
Definition MSEdge.cpp:1243
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition MSEdge.cpp:102
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition MSEdge.cpp:1047
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
Stores time-dependant events and executes them at the proper time.
static void buildStreams()
Builds the streams used possibly by the simulation.
Definition MSFrame.cpp:835
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
Definition MSFrame.cpp:1089
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
Definition MSFrame.cpp:60
static bool checkOptions()
Checks the set options.
Definition MSFrame.cpp:879
static bool gUseMesoSim
Definition MSGlobals.h:106
Container for junctions; performs operations on all stored junctions.
void postloadInitContainer()
Closes building of junctions.
The base class for an intersection.
Definition MSJunction.h:58
const ConstMSEdgeVector & getOutgoing() const
Definition MSJunction.h:114
const ConstMSEdgeVector & getIncoming() const
Definition MSJunction.h:108
static void clear()
Clears the dictionary.
Definition MSLane.cpp:2437
static void initRNGs(const OptionsCont &oc)
initialize rngs
Definition MSLane.cpp:4532
The simulated network and simulation perfomer.
Definition MSNet.h:89
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:451
void closeBuilding(const OptionsCont &oc, MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool junctionHigherSpeeds, const MMVersion &version)
Closes the network's building process.
Definition MSNet.cpp:256
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition MSNet.h:461
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition MSNet.h:328
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition MSNet.cpp:1212
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:501
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:378
void loadRoutes()
loads routes for the next few steps
Definition MSNet.cpp:437
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:421
Parser and container for routes during their loading.
static SumoRNG * getParsingRNG()
get parsing RNG
static SUMOTime getTime(const std::string &fileName)
parse time from state file
Parser and output filter for routes and vehicles state saving and loading.
A class that stores and controls tls and switching of their programs.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void switchOffAll()
switch all logic variants to 'off'
The parent class for traffic light logics.
static void checkParkingRerouteConsistency()
issues warning for incomplete parkingReroute relationships
The class responsible for building and deletion of vehicles.
int getLoadedVehicleNo() const
Returns the number of build vehicles.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void initOutputOptions()
init output options
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
static void setFactory(Factory func)
Sets the factory function to use for new MsgHandlers.
Definition MsgHandler.h:64
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
static MsgHandler * create(MsgType type)
MSNet & myNet
The network edges shall be obtained from.
Definition NLBuilder.h:162
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
Definition NLBuilder.cpp:80
Obtains edge efforts from a weights handler and stores them within the edges.
Definition NLBuilder.h:172
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
Definition NLBuilder.cpp:95
The main interface for loading a microsim.
Definition NLBuilder.h:58
static MSNet * init(const bool isLibsumo=false)
MSNet & myNet
The net to fill.
Definition NLBuilder.h:212
bool load(const std::string &mmlWhat, const bool isNet=false)
Loads a described subpart form the given list of files.
NLDetectorBuilder & myDetectorBuilder
The detector control builder to use.
Definition NLBuilder.h:209
virtual bool build()
Builds and initialises the simulation.
virtual ~NLBuilder()
Destructor.
void buildNet()
Closes the net building process.
NLBuilder(OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
Constructor.
NLJunctionControlBuilder & myJunctionBuilder
The junction control builder to use.
Definition NLBuilder.h:206
static SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
void buildDefaultMeanData(const std::string &optionName, const std::string &id, bool useLanes)
build meanData definition based on option
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.
Definition NLBuilder.h:203
OptionsCont & myOptions
The options to get the names of the files to load and further information from.
Definition NLBuilder.h:200
static void initRandomness()
initializes all RNGs
NLHandler & myXMLHandler
The handler used to parse the net.
Definition NLBuilder.h:215
Builds detectors for microsim.
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &writeAttributes, std::vector< MSEdge * > edges, bool aggregate, const std::string &device)
Creates edge based mean data collector using the given specification.
Interface for building edges.
virtual MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance)
Builds an edge instance (MSEdge in this case)
MSEdgeControl * build(const MMVersion &networkVersion)
builds the MSEdgeControl-class which holds all edges
The XML-Handler for network loading.
Definition NLHandler.h:79
bool haveSeenAdditionalSpeedRestrictions() const
Definition NLHandler.h:119
bool haveSeenInternalEdge() const
Definition NLHandler.h:103
bool hasJunctionHigherSpeeds() const
Definition NLHandler.h:107
MMVersion networkVersion() const
Definition NLHandler.h:127
bool haveSeenDefaultLength() const
Definition NLHandler.h:111
bool haveSeenMesoEdgeType() const
Definition NLHandler.h:123
Builder of microsim-junctions and tls.
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
void postLoadInitialization()
initialize junctions after all connections have been loaded
The XML-Handler for network loading.
void sortInternalShapes()
resolve mismatch between internal lane ids of both networks
The XML-Handler for shapes loading network loading.
Definition NLHandler.h:55
Builds trigger objects for microsim.
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
static SumoRNG * getRNG()
A storage for options typed value containers)
Definition OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void clear()
Removes all information from the container.
bool set(const std::string &name, const std::string &value, const bool append=false)
Sets the given value for the named option.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
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 int getArgC()
Return the number of command line arguments.
Definition OptionsIO.h:63
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition OptionsIO.cpp:74
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
Complete definition about what shall be retrieved and where to store it.
An XML-handler for network weights.
void add(SUMORouteLoader *loader)
add another loader
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
static void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
void stateLoaded(SUMOTime targetTime)
updates myTargetTime and resets vehicle state changes after loading a simulation state
static TraCIServer * getInstance()
Definition TraCIServer.h:68
static void openSocket(const std::map< int, CmdExecutor > &execs)
Initialises the server.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
Definition XMLSubSys.cpp:83
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
static void registerStateListener()
Definition Helper.cpp:698