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 lenghts and travel times");
158 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
166 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel") {
167 measure +=
"_perVeh";
175 for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
186 if (!
load(
"route-files")) {
192 if (!
load(
"additional-files")) {
218 std::vector<SUMOTime> stateDumpTimes;
219 std::vector<std::string> stateDumpFiles;
221 for (std::vector<int>::const_iterator i = times.begin(); i != times.end(); ++i) {
226 if (stateDumpFiles.size() != stateDumpTimes.size()) {
231 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
232 stateDumpFiles.push_back(prefix +
"_" +
time2string(*i) +
".sbx");
235 myNet.
closeBuilding(edges, junctions, routeLoaders, tlc, stateDumpTimes, stateDumpFiles,
261 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
281 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
283 throw ProcessError(
"The route file '" + *fileIt +
"' is not accessible.");
287 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.
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 closeBuilding(MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool lefthand, SUMOReal version)
Closes the network's building process.
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.
MSEdgeControl * build()
builds the MSEdgeControl-class which holds all edges
Builder of microsim-junctions and tls.
ShapeContainer & getShapeContainer()
Returns the shapes container.
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.
MSTLLogicControl * buildTLLogics() const
Returns the built tls-logic control.
SUMOTime string2time(const std::string &r)
#define PROGRESS_BEGIN_MESSAGE(msg)
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
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.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
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)
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.
void endProcessMsg(std::string msg)
Ends a process information.
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.