81 double value,
double begTime,
double endTime)
const {
83 if (edge !=
nullptr) {
86 WRITE_ERRORF(
TL(
"Trying to set the effort for the unknown edge '%'."),
id);
96 double value,
double begTime,
double endTime)
const {
98 if (edge !=
nullptr) {
101 WRITE_ERRORF(
TL(
"Trying to set the travel time for the unknown edge '%'."),
id);
126 if (!
load(
"net-file",
true)) {
130 throw ProcessError(
TL(
"Invalid network, no network version declared."));
134 WRITE_WARNING(
TL(
"Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times."));
153 bool stateBeginMismatch =
false;
165 stateBeginMismatch =
true;
173 for (
auto it = junctions.
begin(); it != junctions.
end(); it++) {
174 const std::string sinkID = it->first +
"-sink";
175 const std::string sourceID = it->first +
"-source";
185 source->
initialize(
new std::vector<MSLane*>());
188 if (!edge->isInternal()) {
189 const_cast<MSEdge*
>(edge)->addSuccessor(sink);
193 if (!edge->isInternal()) {
198 WRITE_WARNINGF(
TL(
"A TAZ with id '%' already exists. Not building junction TAZ."), it->first)
205 if (!
load(
"additional-files")) {
219 tll->initMesoTLSPenalties();
231 throw ProcessError(
TL(
"Loading vehicles ahead of a state file is not supported. Correct --begin option or load vehicles with option --route-files"));
240 std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
248 if (measure ==
"CO" || measure ==
"CO2" || measure ==
"HC" || measure ==
"PMx" || measure ==
"NOx" || measure ==
"fuel" || measure ==
"electricity") {
249 measure +=
"_perVeh";
257 for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
282 if (!
load(
"route-files")) {
306 std::string validation = oc.
getString(
"xml-validation");
307 std::string routeValidation = oc.
getString(
"xml-validation.routes");
310 validation =
"never";
312 if (oc.
isDefault(
"xml-validation.routes")) {
313 routeValidation =
"never";
321 if (oc.
getInt(
"threads") > 1) {
346 NLHandler handler(
"", *net, db, tb, eb, jb);
348 NLBuilder builder(oc, *net, eb, jb, db, handler);
352 if (builder.
build()) {
380 std::vector<SUMOTime> stateDumpTimes;
381 std::vector<std::string> stateDumpFiles;
394 if (stateDumpFiles.size() != stateDumpTimes.size()) {
400 for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
402 std::replace(timeStamp.begin(), timeStamp.end(),
':',
'-');
403 stateDumpFiles.push_back(prefix +
"_" + timeStamp + suffix);
429 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
448 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
450 throw ProcessError(
TLF(
"The route file '%' is not accessible.", *fileIt));
454 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
466 WRITE_WARNING(
TL(
"LaneData requested for mesoscopic simulation but --meso-lane-queue is not active. Falling back to edgeData."));
471 false,
false,
false, 100000, 0,
SUMO_const_haltingSpeed,
"",
"", std::vector<MSEdge*>(),
false,
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_ERRORF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
#define PROGRESS_TIME_MESSAGE(before)
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
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 SumoRNG * getRecognitionRNG()
static void init()
Static intialization.
static SumoRNG * getResponseTimeRNG()
static SumoRNG * 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)
static void clear()
Clears the dictionary.
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 & getOutgoing() const
const ConstMSEdgeVector & getIncoming() const
static void clear()
Clears the dictionary.
static void initRNGs(const OptionsCont &oc)
initialize rngs
The simulated network and simulation perfomer.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
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 junctionHigherSpeeds, const MMVersion &version)
Closes the network's building process.
MSJunctionControl & getJunctionControl()
Returns the junctions control.
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
ShapeContainer & getShapeContainer()
Returns the shapes container.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
void loadRoutes()
loads routes for the next few steps
MSEdgeControl & getEdgeControl()
Returns the edge control.
Parser and container for routes during their loading.
static SumoRNG * getParsingRNG()
get parsing RNG
static SUMOTime getTime(const std::string &fileName)
parse time from state file
Parser and output filter for routes and vehicles state saving and loading.
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.
static void checkParkingRerouteConsistency()
issues warning for incomplete parkingReroute relationships
The class responsible for building and deletion of vehicles.
int getLoadedVehicleNo() const
Returns the number of build 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.
static SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
void buildDefaultMeanData(const std::string &optionName, const std::string &id, bool useLanes)
build meanData definition based on option
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.
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &writeAttributes, std::vector< MSEdge * > edges, bool aggregate, const std::string &device)
Creates edge based mean data collector using the given specification.
Interface for building 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)
MSEdgeControl * build(const MMVersion &networkVersion)
builds the MSEdgeControl-class which holds all edges
The XML-Handler for network loading.
bool haveSeenAdditionalSpeedRestrictions() const
bool haveSeenInternalEdge() const
bool hasJunctionHigherSpeeds() const
MMVersion networkVersion() const
bool haveSeenDefaultLength() 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.
void postLoadInitialization()
initialize junctions after all connections have been loaded
The XML-Handler for network loading.
void sortInternalShapes()
resolve mismatch between internal lane ids of both networks
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 SumoRNG * 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.
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 set(const std::string &name, const std::string &value, const bool append=false)
Sets the given value for the named option.
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(SumoRNG *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(OptionsCont &oc)
checks shared options and sets StdDefs
void stateLoaded(SUMOTime targetTime)
updates myTargetTime and resets vehicle state changes after loading a simulation state
static TraCIServer * getInstance()
static void openSocket(const std::map< int, CmdExecutor > &execs)
Initialises the server.
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, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
static void registerStateListener()