 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
60 : myHandler(nullptr), myParkingArea(nullptr), myCurrentStop(nullptr) {}
73 WRITE_WARNING(
"Vaporizers are deprecated. Use rerouters instead.");
82 WRITE_ERROR(
"Unknown edge ('" +
id +
"') referenced in a vaporizer.");
91 WRITE_ERROR(
"A vaporization begin time is negative (edge id='" +
id +
"').");
95 WRITE_ERROR(
"A vaporization ends before it starts (edge id='" +
id +
"').");
110 const std::string& base) {
121 std::vector<MSLane*> lanes;
122 for (
const std::string& laneID : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_LANES,
id.c_str(), ok)) {
124 if (lane ==
nullptr) {
125 throw InvalidArgument(
"The lane '" + laneID +
"' to use within MSLaneSpeedTrigger '" +
id +
"' is not known.");
127 lanes.push_back(lane);
130 throw InvalidArgument(
"The lanes to use within MSLaneSpeedTrigger '" +
id +
"' are not known.");
132 if (lanes.size() == 0) {
133 throw InvalidArgument(
"No lane defined for MSLaneSpeedTrigger '" +
id +
"'.");
166 throw InvalidArgument(
"Invalid position for charging station '" +
id +
"'.");
169 buildChargingStation(net,
id, lane, frompos, topos, name, chargingPower, efficiency, chargeInTransit, chargeDelay);
197 buildStoppingPlace(net,
id, lines, lane, frompos, topos, element, ptStopName, personCapacity);
204 throw InvalidArgument(
"Could not add access outside a stopping place.");
248 throw InvalidArgument(
"Invalid position for parking area '" +
id +
"'.");
252 beginParkingArea(net,
id, lines, lane, frompos, topos, capacity, width, length, angle, name, onRoad);
284 const std::string& base) {
297 if (edge ==
nullptr) {
298 throw InvalidArgument(
"The edge " + edgeID +
" to use within the calibrator '" +
id +
"' is not known.");
301 lane =
getLane(attrs,
"calibrator",
id);
302 if (&lane->
getEdge() != edge) {
303 throw InvalidArgument(
"The edge " + edgeID +
" to use within the calibrator '" +
id
304 +
"' does not match the calibrator lane '" + lane->
getID() +
".");
308 lane =
getLane(attrs,
"calibrator",
id);
311 const double pos =
getPosition(attrs, lane,
"calibrator",
id, edge);
318 if (routeProbe !=
"") {
320 if (probe ==
nullptr) {
321 throw InvalidArgument(
"The routeProbe '" + routeProbe +
"' to use within the calibrator '" +
id +
"' is not known.");
325 if (lane !=
nullptr && edge->
getLanes().size() > 1) {
327 +
"' defined for lane '" + lane->
getID()
328 +
"' will collect data for all lanes of edge '" + edge->
getID() +
"'.");
345 const std::string& base) {
355 for (
const std::string& edgeID : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES,
id.c_str(), ok)) {
357 if (edge ==
nullptr) {
358 throw InvalidArgument(
"The edge '" + edgeID +
"' to use within MSTriggeredRerouter '" +
id +
"' is not known.");
360 edges.push_back(edge);
363 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
365 if (edges.size() == 0) {
366 throw InvalidArgument(
"No edges found for MSTriggeredRerouter '" +
id +
"'.");
373 throw InvalidArgument(
"Could not parse MSTriggeredRerouter '" +
id +
"'.");
390 const std::vector<MSLane*>& destLanes,
391 const std::string& file) {
400 const std::string& file,
401 const std::string& outfile,
404 const std::string& vTypes) {
414 const std::string& file,
415 const std::string& outfile,
418 const std::string& vTypes) {
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,
int personCapacity) {
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.");
511 const std::string& base,
512 const bool allowEmpty) {
532 const std::string& tt,
533 const std::string& tid) {
537 if (lane ==
nullptr) {
538 throw InvalidArgument(
"The lane " + objectid +
" to use within the " + tt +
" '" + tid +
"' is not known.");
547 const std::string& tt,
const std::string& tid,
549 assert(lane != 0 || edge != 0);
562 pos = length - (double) 0.1;
564 if (lane !=
nullptr) {
565 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");
567 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the edges's '" + edge->
getID() +
"' length.");
void registerParent(const int tag, GenericSAXHandler *handler)
Assigning a parent handler which is enabled when the specified tag is closed.
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 bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
A lane area vehicles can halt at.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
A lane area vehicles can halt at.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
MSDetectorControl & getDetectorControl()
Returns the detector control.
#define WRITE_WARNING(msg)
Representation of a lane in the micro simulation.
void parseAndBeginParkingArea(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a parking area.
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.
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Builds a lane speed trigger.
Writes routes of vehicles passing a certain edge.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
The simulated network and simulation perfomer.
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 setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
MSStoppingPlace * myCurrentStop
The currently parsed stop to add access points to.
A wrapper for a Command function.
virtual bool addAccess(MSLane *lane, const double pos, const double length)
adds an access point to this stop
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, int personCapacity)
Builds a stopping place.
static OptionsCont & getOptions()
Retrieves the options.
Calibrates the flow on a segment to a specified one.
MSParkingArea * myParkingArea
definition of the currently parsed parking area
Changes the speed allowed on a set of lanes.
Reroutes vehicles passing an edge.
void parseAndAddLotEntry(const SUMOSAXAttributes &attrs)
Parses his values and adds a lot entry to current parking area.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Allow/disallow charge in transit in Charging Stations.
double getLength() const
return the length of the edge
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
SumoXMLTag
Numbers representing SUMO-XML - element names.
static StopPos checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
weights: time range begin
Delay in the charge of charging stations.
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
MSLane * getLane(const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid)
Returns the lane defined by attribute "lane".
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
const std::vector< std::string > getOptStringVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<>
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....
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, const std::string &vTypes)
builds a mesoscopic calibrator
double getLength() const
Returns the lane's length.
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
A road/street connecting two junctions.
bool parkOnRoad() const
whether vehicles park on the road
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.
MSStoppingPlace * getCurrentStop()
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
virtual void endStoppingPlace()
End a stopping place.
SUMOTime string2time(const std::string &r)
double getLength() const
Returns the lot rectangle length.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
MSEdge & getEdge() const
Returns the lane's edge.
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, const std::string &vTypes)
builds a microscopic calibrator
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to current parking area.
double getWidth() const
Returns the lot rectangle width.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
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
NLTriggerBuilder()
Constructor.
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
Base (microsim) event class.
T get(const std::string &id) const
Retrieves an item.
std::vector< MSEdge * > MSEdgeVector
Eficiency of the charge in Charging Stations.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
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
NLHandler * myHandler
The parent handler to set for subhandlers.
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
The XML-Handler for network loading.
virtual void endParkingArea()
End a parking area.
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
int getPersonsAbreast() const
virtual ~NLTriggerBuilder()
Destructor.
Calibrates the flow on a segment to a specified one.
double getAngle() const
Returns the lot rectangle angle.
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
A calibrator placed over edge.
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.
Encapsulated SAX-Attributes.
const std::string & getID() const
Returns the id.
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.