 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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) {
122 std::vector<MSLane*> lanes;
123 for (
const std::string& laneID : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_LANES,
id.c_str(), ok)) {
125 if (lane ==
nullptr) {
126 throw InvalidArgument(
"The lane '" + laneID +
"' to use within MSLaneSpeedTrigger '" +
id +
"' is not known.");
128 lanes.push_back(lane);
131 throw InvalidArgument(
"The lanes to use within MSLaneSpeedTrigger '" +
id +
"' are not known.");
133 if (lanes.size() == 0) {
134 throw InvalidArgument(
"No lane defined for MSLaneSpeedTrigger '" +
id +
"'.");
167 throw InvalidArgument(
"Invalid position for charging station '" +
id +
"'.");
170 buildChargingStation(net,
id, lane, frompos, topos, name, chargingPower, efficiency, chargeInTransit, chargeDelay);
198 buildStoppingPlace(net,
id, lines, lane, frompos, topos, element, ptStopName, personCapacity);
205 throw InvalidArgument(
"Could not add access outside a stopping place.");
249 throw InvalidArgument(
"Invalid position for parking area '" +
id +
"'.");
253 beginParkingArea(net,
id, lines, lane, frompos, topos, capacity, width, length, angle, name, onRoad);
285 const std::string& base) {
298 if (edge ==
nullptr) {
299 throw InvalidArgument(
"The edge " + edgeID +
" to use within the calibrator '" +
id +
"' is not known.");
302 lane =
getLane(attrs,
"calibrator",
id);
303 if (&lane->
getEdge() != edge) {
304 throw InvalidArgument(
"The edge " + edgeID +
" to use within the calibrator '" +
id
305 +
"' does not match the calibrator lane '" + lane->
getID() +
".");
309 lane =
getLane(attrs,
"calibrator",
id);
312 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) {
356 for (
const std::string& edgeID : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES,
id.c_str(), ok)) {
358 if (edge ==
nullptr) {
359 throw InvalidArgument(
"The edge '" + edgeID +
"' to use within MSTriggeredRerouter '" +
id +
"' is not known.");
361 edges.push_back(edge);
364 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
366 if (edges.size() == 0) {
367 throw InvalidArgument(
"No edges found for MSTriggeredRerouter '" +
id +
"'.");
374 throw InvalidArgument(
"Could not parse MSTriggeredRerouter '" +
id +
"'.");
391 const std::vector<MSLane*>& destLanes,
392 const std::string& file) {
401 const std::string& file,
402 const std::string& outfile,
405 const std::string& vTypes) {
415 const std::string& file,
416 const std::string& outfile,
419 const std::string& vTypes) {
427 double prob,
const std::string& file,
bool off,
429 const std::string& vTypes) {
436 double frompos,
double topos,
const SumoXMLTag element, std::string ptStopName,
int personCapacity) {
448 const std::vector<std::string>& lines,
449 MSLane* lane,
double frompos,
double topos,
450 unsigned int capacity,
451 double width,
double length,
double angle,
const std::string& name,
454 MSParkingArea* stop =
new MSParkingArea(
id, lines, *lane, frompos, topos, capacity, width, length, angle, name, onRoad);
457 throw InvalidArgument(
"Could not build parking area '" +
id +
"'; probably declared twice.");
466 double width,
double length,
double angle) {
471 throw InvalidArgument(
"Cannot not add lot entry to on-road parking area.");
474 throw InvalidArgument(
"Could not add lot entry outside a parking area.");
484 throw InvalidArgument(
"Could not end a parking area that is not opened.");
494 throw InvalidArgument(
"Could not end a stopping place that is not opened.");
501 double chargingPower,
double efficiency,
bool chargeInTransit,
double chargeDelay) {
504 delete chargingStation;
505 throw InvalidArgument(
"Could not build charging station '" +
id +
"'; probably declared twice.");
512 const std::string& base,
513 const bool allowEmpty) {
533 const std::string& tt,
534 const std::string& tid) {
538 if (lane ==
nullptr) {
539 throw InvalidArgument(
"The lane " + objectid +
" to use within the " + tt +
" '" + tid +
"' is not known.");
548 const std::string& tt,
const std::string& tid,
550 assert(lane != 0 || edge != 0);
563 pos = length - (double) 0.1;
565 if (lane !=
nullptr) {
566 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");
568 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.
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
static bool checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
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.