61 : myHandler(nullptr), myParkingArea(nullptr), myCurrentStop(nullptr) {}
74 WRITE_WARNING(
"Vaporizers are deprecated. Use rerouters instead.");
83 WRITE_ERROR(
"Unknown edge ('" +
id +
"') referenced in a vaporizer.");
92 WRITE_ERROR(
"A vaporization begin time is negative (edge id='" +
id +
"').");
96 WRITE_ERROR(
"A vaporization ends before it starts (edge id='" +
id +
"').");
111 const std::string& base) {
123 throw InvalidArgument(
"The lanes to use within MSLaneSpeedTrigger '" +
id +
"' are not known.");
125 std::vector<MSLane*> lanes;
126 std::vector<std::string> laneIDs;
128 for (std::vector<std::string>::iterator i = laneIDs.begin(); i != laneIDs.end(); ++i) {
130 if (lane ==
nullptr) {
131 throw InvalidArgument(
"The lane to use within MSLaneSpeedTrigger '" +
id +
"' is not known.");
133 lanes.push_back(lane);
135 if (lanes.size() == 0) {
136 throw InvalidArgument(
"No lane defined for MSLaneSpeedTrigger '" +
id +
"'.");
169 throw InvalidArgument(
"Invalid position for charging station '" +
id +
"'.");
172 buildChargingStation(net,
id, lane, frompos, topos, name, chargingPower, efficiency, chargeInTransit, chargeDelay);
198 std::vector<std::string> lines;
208 throw InvalidArgument(
"Could not add access outside a stopping place.");
248 throw InvalidArgument(
"Invalid position for parking area '" +
id +
"'.");
251 std::vector<std::string> lines;
254 beginParkingArea(net,
id, lines, lane, frompos, topos, capacity, width, length, angle, name, onRoad);
286 const std::string& base) {
299 if (edge ==
nullptr) {
300 throw InvalidArgument(
"The edge " + edgeID +
" to use within the calibrator '" +
id +
"' is not known.");
303 lane =
getLane(attrs,
"calibrator",
id);
304 if (&lane->
getEdge() != edge) {
305 throw InvalidArgument(
"The edge " + edgeID +
" to use within the calibrator '" +
id 306 +
"' does not match the calibrator lane '" + lane->
getID() +
".");
310 lane =
getLane(attrs,
"calibrator",
id);
313 const double pos =
getPosition(attrs, lane,
"calibrator",
id, edge);
319 if (routeProbe !=
"") {
321 if (probe ==
nullptr) {
322 throw InvalidArgument(
"The routeProbe '" + routeProbe +
"' to use within the calibrator '" +
id +
"' is not known.");
326 if (lane !=
nullptr && edge->
getLanes().size() > 1) {
328 +
"' defined for lane '" + lane->
getID()
329 +
"' will collect data for all lanes of edge '" + edge->
getID() +
"'.");
346 const std::string& base) {
357 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
360 std::vector<std::string> edgeIDs;
362 for (std::vector<std::string>::iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
364 if (edge ==
nullptr) {
365 throw InvalidArgument(
"The edge '" + (*i) +
"' to use within MSTriggeredRerouter '" +
id +
"' is not known.");
367 edges.push_back(edge);
369 if (edges.size() == 0) {
370 throw InvalidArgument(
"No edges found for MSTriggeredRerouter '" +
id +
"'.");
377 throw InvalidArgument(
"Could not parse MSTriggeredRerouter '" +
id +
"'.");
394 const std::vector<MSLane*>& destLanes,
395 const std::string& file) {
404 const std::string& file,
405 const std::string& outfile,
416 const std::string& file,
417 const std::string& outfile,
426 double prob,
const std::string& file,
bool off,
428 const std::string& vTypes) {
435 double frompos,
double topos,
const SumoXMLTag element, std::string ptStopName) {
447 const std::vector<std::string>& lines,
448 MSLane* lane,
double frompos,
double topos,
449 unsigned int capacity,
450 double width,
double length,
double angle,
const std::string& name,
453 MSParkingArea* stop =
new MSParkingArea(
id, lines, *lane, frompos, topos, capacity, width, length, angle, name, onRoad);
456 throw InvalidArgument(
"Could not build parking area '" +
id +
"'; probably declared twice.");
465 double width,
double length,
double angle) {
470 throw InvalidArgument(
"Cannot not add lot entry to on-road parking area.");
473 throw InvalidArgument(
"Could not add lot entry outside a parking area.");
483 throw InvalidArgument(
"Could not end a parking area that is not opened.");
493 throw InvalidArgument(
"Could not end a stopping place that is not opened.");
500 double chargingPower,
double efficiency,
bool chargeInTransit,
double chargeDelay) {
503 delete chargingStation;
504 throw InvalidArgument(
"Could not build charging station '" +
id +
"'; probably declared twice.");
510 const std::string& base,
511 const bool allowEmpty) {
531 const std::string& tt,
532 const std::string& tid) {
536 if (lane ==
nullptr) {
537 throw InvalidArgument(
"The lane " + objectid +
" to use within the " + tt +
" '" + tid +
"' is not known.");
546 const std::string& tt,
const std::string& tid,
548 assert(lane != 0 || edge != 0);
561 pos = length - (double) 0.1;
563 if (lane !=
nullptr) {
564 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");
566 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the edges's '" + edge->
getID() +
"' length.");
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
void parseAndAddLotEntry(const SUMOSAXAttributes &attrs)
Parses his values and adds a lot entry to current parking area.
A lane area vehicles can halt at.
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void buildStoppingPlace(MSNet &net, std::string id, std::vector< std::string > lines, MSLane *lane, double frompos, double topos, const SumoXMLTag element, std::string string)
Builds a stopping place.
MSEdge & getEdge() const
Returns the lane's edge.
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, MSEdgeVector &edges, double prob, const std::string &file, bool off, SUMOTime timeThreshold, const std::string &vTypes)
builds an rerouter
A lane area vehicles can halt at.
A calibrator placed over edge.
Writes routes of vehicles passing a certain edge.
Allow/disallow charge in transit in Charging Stations.
T get(const std::string &id) const
Retrieves an item.
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
weights: time range begin
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
double getLength() const
Returns the lane's length.
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...
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
const std::string & getID() const
Returns the id.
NLTriggerBuilder()
Constructor.
Base (microsim) event class.
MSParkingArea * myParkingArea
definition of the currently parsed parking area
double getLength() const
return the length of the edge
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.
virtual ~NLTriggerBuilder()
Destructor.
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
void parseAndBeginParkingArea(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a parking area.
virtual MSCalibrator * buildCalibrator(MSNet &net, const std::string &id, MSEdge *edge, MSLane *lane, double pos, const std::string &file, const std::string &outfile, const SUMOTime freq, const MSRouteProbe *probe)
builds a microscopic calibrator
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to current parking area.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
static OptionsCont & getOptions()
Retrieves the options.
Changes the speed allowed on a set of lanes.
A road/street connecting two junctions.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Encapsulated SAX-Attributes.
Calibrates the flow on a segment to a specified one.
NLHandler * myHandler
The parent handler to set for subhandlers.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
virtual void endParkingArea()
End a parking area.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
A wrapper for a Command function.
virtual METriggeredCalibrator * buildMECalibrator(MSNet &net, const std::string &id, const MSEdge *edge, double pos, const std::string &file, const std::string &outfile, const SUMOTime freq, MSRouteProbe *probe)
builds a mesoscopic calibrator
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
virtual void beginParkingArea(MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, double frompos, double topos, unsigned int capacity, double width, double length, double angle, const std::string &name, bool onRoad)
Begin a parking area.
void registerParent(const int tag, GenericSAXHandler *handler)
Assigning a parent handler which is enabled when the specified tag is closed.
MSStoppingPlace * myCurrentStop
The currently parsed stop to add access points to.
SUMOTime string2time(const std::string &r)
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane *> &destLanes, const std::string &file)
Builds a lane speed trigger.
bool parkOnRoad() const
whether vehicles park on the road
MSDetectorControl & getDetectorControl()
Returns the detector control.
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
virtual bool addAccess(MSLane *lane, const double pos, const double length)
adds an access point to this stop
double getLength() const
Returns the lot rectangle length.
The XML-Handler for network loading.
Reroutes vehicles passing an edge.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
static bool checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual void endStoppingPlace()
End a stopping place.
double getWidth() const
Returns the lot rectangle width.
virtual void buildChargingStation(MSNet &net, const std::string &id, MSLane *lane, double frompos, double topos, const std::string &name, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay)
Builds a charging station.
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Calibrates the flow on a segment to a specified one.
Eficiency of the charge in Charging Stations.
Delay in the charge of charging stations.
std::vector< MSEdge * > MSEdgeVector
double getPosition(const SUMOSAXAttributes &attrs, MSLane *lane, const std::string &tt, const std::string &tid, MSEdge *edge=0)
returns the position on the lane checking it
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
Representation of a lane in the micro simulation.
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
double getAngle() const
Returns the lot rectangle angle.
MSLane * getLane(const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid)
Returns the lane defined by attribute "lane".