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")) {
252 NLHandler handler(
"", *net, db, tb, eb, jb);
254 NLBuilder builder(oc, *net, eb, jb, db, handler);
258 if (builder.
build()) {
274 std::vector<SUMOTime> stateDumpTimes;
275 std::vector<std::string> stateDumpFiles;
283 for (std::vector<int>::const_iterator i = times.begin(); i != times.end(); ++i) {
288 if (stateDumpFiles.size() != stateDumpTimes.size()) {
294 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
295 stateDumpFiles.push_back(prefix +
"_" +
time2string(*i) + suffix);
326 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
346 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
348 throw ProcessError(
"The route file '" + *fileIt +
"' is not accessible.");
352 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Builds detectors for microsim.
void switchOffAll()
switch all logic variants to 'off'
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
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.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
The main interface for loading a microsim.
static void buildStreams()
Builds the streams used possibly by the simulation.
Parser and output filter for routes and vehicles state saving and loading.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
An XML-handler for network weights.
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.
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 getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool wasInformed() const
Returns the information whether any messages were added.
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.
static void close()
Closes all of an applications subsystems.
void setAdditionalRestrictions()
apply additional restrictions
static std::mt19937 * getEquipmentRNG()
#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.
static std::mt19937 * getParsingRNG()
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
A class that stores and controls tls and switching of their programs.
NLJunctionControlBuilder & myJunctionBuilder
The junction control builder to use.
A road/street connecting two junctions.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
#define PROGRESS_TIME_MESSAGE(before)
void clear()
Removes all information from the 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) ...
Builder of microsim-junctions and tls.
ShapeContainer & getShapeContainer()
Returns the shapes container.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
Stores edges and lanes, performs moving of vehicle.
SUMOTime string2time(const std::string &r)
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) ...
#define PROGRESS_BEGIN_MESSAGE(msg)
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
static int getArgC()
Return the number of command line arguments.
MSNet & myNet
The net to fill.
The class responsible for building and deletion of vehicles (gui-version)
NLBuilder(OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
Constructor.
double networkVersion() 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, double version)
Closes the network's building process.
The XML-Handler for network loading.
static bool checkOptions()
Checks the set options.
virtual bool build()
Builds and initialises the simulation.
Complete definition about what shall be retrieved and where to store it.
bool haveSeenAdditionalSpeedRestrictions() const
static void openSocket(const std::map< int, CmdExecutor > &execs)
Initialises the server.
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.
const IntVector & getIntVector(const std::string &name) const
Returns the list of integer-value of the named option (only for Option_IntVector) ...
void setTargetTime(SUMOTime targetTime)
Sets myTargetTime on server and sockets to the given value.
static TraCIServer * getInstance()
A storage for options typed value containers)
SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance...
bool haveSeenInternalEdge() const
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.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
MSEdgeControl & getEdgeControl()
Returns the edge control.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
The class responsible for building and deletion of vehicles.
static long getCurrentMillis()
Returns the current time in milliseconds.
Builds trigger objects for microsim.
virtual ~NLBuilder()
Destructor.
void loadRoutes()
loads routes for the next few steps
void clear()
Clears information whether an error occurred previously.
bool haveSeenNeighs() const
#define WRITE_MESSAGE(msg)
static void initOutputOptions()
init output options
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
NLDetectorBuilder & myDetectorBuilder
The detector control builder to use.
Stores time-dependant events and executes them at the proper time.
NLHandler & myXMLHandler
The handler used to parse the net.
Parser and container for routes during their loading.
Interface for building edges.
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.
MSEdgeControl * build(double networkVersion)
builds the MSEdgeControl-class which holds all edges