39 #include <xercesc/parsers/SAXParser.hpp>
40 #include <xercesc/sax2/SAX2XMLReader.hpp>
66 #ifdef CHECK_MEMORY_LEAKS
68 #endif // CHECK_MEMORY_LEAKS
84 WRITE_ERROR(
"Trying to set the effort for the unknown edge '" +
id +
"'.");
99 WRITE_ERROR(
"Trying to set the travel time for the unknown edge '" +
id +
"'.");
124 if (!
load(
"net-file",
true)) {
128 #ifdef HAVE_INTERNAL_LANES
130 WRITE_WARNING(
"Network contains internal links but option --no-internal-links is set. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times.");
134 throw ProcessError(
"Network contains explicit neigh lanes which do not work together with option --lanechange.duration.");
161 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
169 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
170 measure +=
"_perVeh";
178 for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
189 if (!
load(
"route-files")) {
195 if (!
load(
"additional-files")) {
225 std::vector<SUMOTime> stateDumpTimes;
226 std::vector<std::string> stateDumpFiles;
228 for (std::vector<int>::const_iterator i = times.begin(); i != times.end(); ++i) {
233 if (stateDumpFiles.size() != stateDumpTimes.size()) {
239 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
240 stateDumpFiles.push_back(prefix +
"_" +
time2string(*i) + suffix);
270 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
290 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
292 throw ProcessError(
"The route file '" + *fileIt +
"' is not accessible.");
296 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
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) ...
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Builds detectors for microsim.
void switchOffAll()
switch all logic variants to 'off'
SUMOReal networkVersion() const
Obtains edge efforts from a weights handler and stores them within the edges.
void buildNet()
Closes the net building process.
static bool isReadable(std::string path)
Checks whether the given file is readable.
static void buildStreams()
Builds the streams used possibly by the simulation.
Parser and output filter for routes and vehicles state saving and loading.
void addEdgeWeight(const std::string &id, SUMOReal val, SUMOReal beg, SUMOReal end) const
Adds an effort for a given edge and time period.
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
An XML-handler for network weights.
const IntVector & getIntVector(const std::string &name) const
Returns the list of integer-value of the named option (only for Option_IntVector) ...
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::string time2string(SUMOTime t)
MSNet & myNet
The network edges shall be obtained from.
void add(SUMORouteLoader *loader)
add another loader
OptionsCont & myOptions
The options to get the names of the files to load and further information from.
void addEdgeWeight(const std::string &id, SUMOReal val, SUMOReal beg, SUMOReal end) const
Adds a travel time for a given edge and time period.
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...
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
void addEffort(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds an effort information for an edge and a time span.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
static OptionsCont & getOptions()
Retrieves the options.
Container for junctions; performs operations on all stored junctions.
void addTravelTime(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds a travel time information for an edge and a time span.
A class that stores and controls tls and switching of their programs.
NLJunctionControlBuilder & myJunctionBuilder
The junction control builder to use.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
A road/street connecting two junctions.
#define PROGRESS_TIME_MESSAGE(before)
MSEdgeControl * build()
builds the MSEdgeControl-class which holds all edges
bool haveSeenNeighs() const
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 hasNeighs, bool lefthand, SUMOReal version)
Closes the network's building process.
Builder of microsim-junctions and tls.
ShapeContainer & getShapeContainer()
Returns the shapes container.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
Stores edges and lanes, performs moving of vehicle.
SUMOTime string2time(const std::string &r)
#define PROGRESS_BEGIN_MESSAGE(msg)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
MSNet & myNet
The net to fill.
bool wasInformed() const
Returns the information whether any messages were added.
NLBuilder(OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
Constructor.
The XML-Handler for network loading.
virtual bool build()
Builds and initialises the simulation.
Complete definition about what shall be retrieved and where to store it.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
The XML-Handler for shapes loading network loading.
bool haveSeenInternalEdge() const
A storage for options typed value containers)
SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
bool load(const std::string &mmlWhat, const bool isNet=false)
Loads a described subpart form the given list of files.
static long getCurrentMillis()
Returns the current time in milliseconds.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
virtual ~NLBuilder()
Destructor.
#define WRITE_MESSAGE(msg)
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
NLDetectorBuilder & myDetectorBuilder
The detector control builder to use.
NLHandler & myXMLHandler
The handler used to parse the net.
Parser and container for routes during their loading.
Interface for building edges.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.