76 double value,
double begTime,
double endTime)
const {
78 if (edge !=
nullptr) {
81 WRITE_ERROR(
"Trying to set the effort for the unknown edge '" +
id +
"'.");
91 double value,
double begTime,
double endTime)
const {
93 if (edge !=
nullptr) {
96 WRITE_ERROR(
"Trying to set the travel time for the unknown edge '" +
id +
"'.");
121 if (!
load(
"net-file",
true)) {
125 throw ProcessError(
"Invalid network, no network version declared.");
129 WRITE_WARNING(
"Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times.");
138 if (!
load(
"additional-files")) {
152 tll->initMesoTLSPenalties();
159 for (
auto it = junctions.
begin(); it != junctions.
end(); it++) {
160 const std::string sinkID = it->first +
"-sink";
161 const std::string sourceID = it->first +
"-source";
171 source->
initialize(
new std::vector<MSLane*>());
174 if (!edge->isInternal()) {
175 const_cast<MSEdge*
>(edge)->addSuccessor(sink);
179 if (!edge->isInternal()) {
184 WRITE_WARNINGF(
"A TAZ with id '%' already exists. Not building junction TAZ.", it->first)
194 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
202 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
203 measure +=
"_perVeh";
211 for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
242 if (!
load(
"route-files")) {
271 if (oc.
getInt(
"threads") > 1) {
296 NLHandler handler(
"", *net, db, tb, eb, jb);
298 NLBuilder builder(oc, *net, eb, jb, db, handler);
302 if (builder.
build()) {
327 std::vector<SUMOTime> stateDumpTimes;
328 std::vector<std::string> stateDumpFiles;
341 if (stateDumpFiles.size() != stateDumpTimes.size()) {
342 throw ProcessError(
"Wrong number of state file names!");
347 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
349 std::replace(timeStamp.begin(), timeStamp.end(),
':',
'-');
350 stateDumpFiles.push_back(prefix +
"_" + timeStamp + suffix);
380 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
399 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
401 throw ProcessError(
"The route file '" + *fileIt +
"' is not accessible.");
405 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
#define PROGRESS_TIME_MESSAGE(before)
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
static bool isReadable(std::string path)
Checks whether the given file is readable.
The class responsible for building and deletion of vehicles (gui-version)
static std::mt19937 * getResponseTimeRNG()
static std::mt19937 * getEquipmentRNG()
Stores edges and lanes, performs moving of vehicle.
void setMesoTypes()
update meso edge type parameters
void setAdditionalRestrictions()
apply additional restrictions
A road/street connecting two junctions.
void setOtherTazConnector(const MSEdge *edge)
void addSuccessor(MSEdge *edge, const MSEdge *via=nullptr)
Adds an edge to the list of edges which may be reached from this edge and to the incoming of the othe...
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
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....
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
Stores time-dependant events and executes them at the proper time.
static void buildStreams()
Builds the streams used possibly by the simulation.
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
static bool checkOptions()
Checks the set options.
Container for junctions; performs operations on all stored junctions.
void postloadInitContainer()
Closes building of junctions.
The base class for an intersection.
const ConstMSEdgeVector & getIncoming() const
const ConstMSEdgeVector & getOutgoing() const
static void initRNGs(const OptionsCont &oc)
initialize rngs
The simulated network and simulation perfomer.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
ShapeContainer & getShapeContainer()
Returns the shapes container.
MSJunctionControl & getJunctionControl()
Returns the junctions control.
MSEdgeControl & getEdgeControl()
Returns the edge control.
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
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, double version)
Closes the network's building process.
void loadRoutes()
loads routes for the next few steps
Parser and container for routes during their loading.
static std::mt19937 * getParsingRNG()
get parsing RNG
Parser and output filter for routes and vehicles state saving and loading.
SUMOTime getTime() const
get time
A class that stores and controls tls and switching of their programs.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void switchOffAll()
switch all logic variants to 'off'
The parent class for traffic light logics.
The class responsible for building and deletion of vehicles.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void initOutputOptions()
init output options
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
static void setFactory(Factory func)
Sets the factory function to use for new MsgHandlers.
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
static MsgHandler * create(MsgType type)
MSNet & myNet
The network edges shall be obtained from.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
Obtains edge efforts from a weights handler and stores them within the edges.
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
The main interface for loading a microsim.
static MSNet * init(const bool isLibsumo=false)
MSNet & myNet
The net to fill.
bool load(const std::string &mmlWhat, const bool isNet=false)
Loads a described subpart form the given list of files.
NLDetectorBuilder & myDetectorBuilder
The detector control builder to use.
virtual bool build()
Builds and initialises the simulation.
virtual ~NLBuilder()
Destructor.
void buildNet()
Closes the net building process.
NLBuilder(OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
Constructor.
NLJunctionControlBuilder & myJunctionBuilder
The junction control builder to use.
SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.
OptionsCont & myOptions
The options to get the names of the files to load and further information from.
static void initRandomness()
initializes all RNGs
NLHandler & myXMLHandler
The handler used to parse the net.
Builds detectors for microsim.
Interface for building edges.
MSEdgeControl * build(double networkVersion)
builds the MSEdgeControl-class which holds all edges
virtual MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance)
Builds an edge instance (MSEdge in this case)
The XML-Handler for network loading.
bool haveSeenAdditionalSpeedRestrictions() const
bool haveSeenInternalEdge() const
double networkVersion() const
bool haveSeenDefaultLength() const
bool haveSeenNeighs() const
bool haveSeenMesoEdgeType() const
Builder of microsim-junctions and tls.
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
The XML-Handler for shapes loading network loading.
Builds trigger objects for microsim.
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
static std::mt19937 * getRNG()
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void clear()
Removes all information from the container.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
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 int getArgC()
Return the number of command line arguments.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
static void initRandGlobal(std::mt19937 *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
Complete definition about what shall be retrieved and where to store it.
An XML-handler for network weights.
void add(SUMORouteLoader *loader)
add another loader
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
static void close()
Closes all of an applications subsystems.
static bool checkOptions()
checks shared options and sets StdDefs
void stateLoaded(SUMOTime targetTime)
updates myTargetTime and resets vehicle state changes after loading a simulation state
static void openSocket(const std::map< int, CmdExecutor > &execs)
Initialises the server.
static TraCIServer * getInstance()
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false)
Runs the given handler on the given file; returns if everything's ok.
static void registerVehicleStateListener()