 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
74 double value,
double begTime,
double endTime)
const {
76 if (edge !=
nullptr) {
79 WRITE_ERROR(
"Trying to set the effort for the unknown edge '" +
id +
"'.");
89 double value,
double begTime,
double endTime)
const {
91 if (edge !=
nullptr) {
94 WRITE_ERROR(
"Trying to set the travel time for the unknown edge '" +
id +
"'.");
119 if (!
load(
"net-file",
true)) {
123 throw ProcessError(
"Invalid network, no network version declared.");
127 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.");
130 throw ProcessError(
"Network contains explicit neigh lanes which do not work together with option --lanechange.duration.");
139 if (!
load(
"additional-files")) {
157 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
165 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
166 measure +=
"_perVeh";
174 for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
206 if (!
load(
"route-files")) {
250 NLHandler handler(
"", *net, db, tb, eb, jb);
252 NLBuilder builder(oc, *net, eb, jb, db, handler);
256 if (builder.
build()) {
279 std::vector<SUMOTime> stateDumpTimes;
280 std::vector<std::string> stateDumpFiles;
289 for (std::vector<int>::const_iterator i = times.begin(); i != times.end(); ++i) {
294 if (stateDumpFiles.size() != stateDumpTimes.size()) {
300 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
301 stateDumpFiles.push_back(prefix +
"_" +
time2string(*i) + suffix);
332 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
352 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
354 throw ProcessError(
"The route file '" + *fileIt +
"' is not accessible.");
358 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Stores time-dependant events and executes them at the proper time.
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
static void initRandomness()
initializes all RNGs
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
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 setTargetTime(SUMOTime targetTime)
Sets myTargetTime on server and sockets to the given value.
The main interface for loading a microsim.
The XML-Handler for shapes loading network loading.
const IntVector & getIntVector(const std::string &name) const
Returns the list of integer-value of the named option (only for Option_IntVector)
static void close()
Closes all of an applications subsystems.
#define WRITE_WARNING(msg)
static void initOutputOptions()
init output options
void setAdditionalRestrictions()
apply additional restrictions
bool load(const std::string &mmlWhat, const bool isNet=false)
Loads a described subpart form the given list of files.
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
bool wasInformed() const
Returns the information whether any messages were added.
Interface for building edges.
ShapeContainer & getShapeContainer()
Returns the shapes container.
double networkVersion() const
void postloadInitContainer()
Closes building of junctions.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
static std::mt19937 * getEquipmentRNG()
bool haveSeenAdditionalSpeedRestrictions() const
The simulated network and simulation perfomer.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
OptionsCont & myOptions
The options to get the names of the files to load and further information from.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
MSEdgeControl * build(double networkVersion)
builds the MSEdgeControl-class which holds all edges
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
Builds trigger objects for microsim.
#define PROGRESS_TIME_MESSAGE(before)
void add(SUMORouteLoader *loader)
add another loader
virtual ~NLBuilder()
Destructor.
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 haveSeenInternalEdge() const
void switchOffAll()
switch all logic variants to 'off'
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
Obtains edge efforts from a weights handler and stores them within the edges.
NLJunctionControlBuilder & myJunctionBuilder
The junction control builder to use.
static long getCurrentMillis()
Returns the current time in milliseconds.
virtual void clear()
Clears information whether an error occurred previously.
Builder of microsim-junctions and tls.
Container for junctions; performs operations on all stored junctions.
SUMOTime getTime() const
get time
void buildNet()
Closes the net building process.
NLHandler & myXMLHandler
The handler used to parse the net.
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)
static void initRNGs(const OptionsCont &oc)
initialize rngs
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
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....
bool haveSeenNeighs() const
std::string time2string(SUMOTime t)
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
A storage for options typed value containers)
A road/street connecting two junctions.
The class responsible for building and deletion of vehicles (gui-version)
void loadRoutes()
loads routes for the next few steps
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.
SUMOTime string2time(const std::string &r)
static void openSocket(const std::map< int, CmdExecutor > &execs)
Initialises the server.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
virtual bool build()
Builds and initialises the simulation.
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance.
NLBuilder(OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
Constructor.
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
NLDetectorBuilder & myDetectorBuilder
The detector control builder to use.
static int getArgC()
Return the number of command line arguments.
#define PROGRESS_BEGIN_MESSAGE(msg)
static std::mt19937 * getParsingRNG()
get parsing RNG
Parser and container for routes during their loading.
static void buildStreams()
Builds the streams used possibly by the simulation.
SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
static bool isReadable(std::string path)
Checks whether the given file is readable.
The XML-Handler for network loading.
The class responsible for building and deletion of vehicles.
Stores edges and lanes, performs moving of vehicle.
static TraCIServer * getInstance()
A class that stores and controls tls and switching of their programs.
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, double version)
Closes the network's building process.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
MSEdgeControl & getEdgeControl()
Returns the edge control.
An XML-handler for network weights.
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
MSNet & myNet
The net to fill.
void clear()
Removes all information from the container.
static bool checkOptions()
Checks the set options.
#define WRITE_MESSAGE(msg)
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)
Parser and output filter for routes and vehicles state saving and loading.
Builds detectors for microsim.
MSNet & myNet
The network edges shall be obtained from.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.