 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
30 #include <xercesc/parsers/SAXParser.hpp>
31 #include <xercesc/util/PlatformUtils.hpp>
32 #include <xercesc/util/TransService.hpp>
33 #include <xercesc/sax2/SAX2XMLReader.hpp>
60 double val,
double beg,
double end)
const {
67 WRITE_WARNING(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
69 WRITE_ERROR(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
81 double val,
double beg,
double end)
const {
82 ROEdge* e = myNet.getEdge(
id);
88 WRITE_WARNING(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
90 WRITE_ERROR(
"Trying to set a weight for the unknown edge '" +
id +
"'.");
104 myLoaders(oc.exists(
"unsorted-input") && oc.getBool(
"unsorted-input") ? 0 :
DELTA_T) {
116 throw ProcessError(
"Missing definition of network to load!");
119 throw ProcessError(
"The network file '" + file +
"' is not accessible.");
134 edgeIt.second->cacheParamRestrictions(paramKeys);
143 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
145 throw ProcessError(
"The additional file '" + *fileIt +
"' is not accessible.");
174 const std::string error =
"No route input specified or all routes were invalid.";
200 while (time <= end) {
210 if (time < end && time + increment > end) {
224 RONet& net,
const bool readAll) {
243 WRITE_ERROR(
"The loader for " + optionName +
" from file '" + fileIt +
"' could not be initialised (" + e.what() +
").");
253 const std::string& measure,
const bool useLanes,
const bool boundariesOverride) {
259 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
265 if (measure !=
"traveltime") {
266 std::string umeasure = measure;
267 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
268 umeasure = measure +
"_perVeh";
276 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
287 i.second->buildTimeLines(measure, boundariesOverride);
297 const double perc = (double)(time - start) / (double) absNo;
300 std::cout <<
"Reading up to time step: " +
time2string(time) +
"\r";
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
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.
The handler that parses a SUMO-network for its usage in a router.
RONet & myNet
The network edges shall be obtained from.
#define WRITE_WARNING(msg)
void openRoutes(RONet &net)
Builds and opens all route loaders.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
bool wasInformed() const
Returns the information whether any messages were added.
SUMOTime getFirstLoadTime() const
returns the timestamp of the first loaded vehicle or flow
void loadNext(SUMOTime step)
loads the next routes up to and including the given time step
#define PROGRESS_FAILED_MESSAGE()
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const bool myLogSteps
Information whether the routing steps should be logged.
static OptionsCont & getOptions()
Retrieves the options.
The router's network representation.
void writeStats(const SUMOTime time, const SUMOTime start, const SUMOTime absNo, bool endGiven)
void add(SUMORouteLoader *loader)
add another loader
OptionsCont & myOptions
Options to use.
Parser and container for routes during their loading.
virtual ~ROLoader()
Destructor.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
bool openTypedRoutes(const std::string &optionName, RONet &net, const bool readAll=false)
Opens route handler of the given type.
Complete definition about what shall be retrieved and where to store it.
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file)
Obtains edge travel times from a weights handler and stores them within the edges.
void addTravelTime(double value, double timeBegin, double timeEnd)
Adds a travel time value.
bool haveAllLoaded() const
returns whether loading is completed
void addEffort(double value, double timeBegin, double timeEnd)
Adds a weight value.
SUMORouteLoaderControl myLoaders
List of route loaders.
const bool myEmptyDestinationsAllowed
Information whether empty destinations are allowed.
Obtains edge weights from a weights handler and stores them within the edges.
std::string time2string(SUMOTime t)
A storage for options typed value containers)
virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb)
Loads the network.
SUMOTime string2time(const std::string &r)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define PROGRESS_BEGIN_MESSAGE(msg)
std::set< std::string > deprecatedVehicleClassesSeen
#define PROGRESS_DONE_MESSAGE()
A basic edge for routing applications.
bool furtherStored()
Returns the information whether further vehicles, persons or containers are stored.
static bool isReadable(std::string path)
Checks whether the given file is readable.
void processRoutes(const SUMOTime start, const SUMOTime end, const SUMOTime increment, RONet &net, const RORouterProvider &provider)
Loads routes from all previously build route loaders.
SUMOTime saveAndRemoveRoutesUntil(OptionsCont &options, const RORouterProvider &provider, SUMOTime time)
Computes routes described by their definitions and saves them.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
An XML-handler for network weights.
#define WRITE_MESSAGE(msg)
Interface for building instances of router-edges.
void setFileName(const std::string &name)
Sets the current file name.
ROLoader(OptionsCont &oc, const bool emptyDestinationsAllowed, const bool logSteps)
Constructor.
bool loadWeights(RONet &net, const std::string &optionName, const std::string &measure, const bool useLanes, const bool boundariesOverride)
Loads the net weights.