60 #include <mesosim/MELoop.h> 61 #include <mesosim/METriggeredCalibrator.h> 64 #ifdef CHECK_MEMORY_LEAKS 66 #endif // CHECK_MEMORY_LEAKS 94 WRITE_ERROR(
"Unknown edge ('" +
id +
"') referenced in a vaporizer.");
103 WRITE_ERROR(
"A vaporization begin time is negative (edge id='" +
id +
"').");
107 WRITE_ERROR(
"A vaporization ends before it starts (edge id='" +
id +
"').");
122 const std::string& base) {
134 throw InvalidArgument(
"The lanes to use within MSLaneSpeedTrigger '" +
id +
"' are not known.");
136 std::vector<MSLane*> lanes;
137 std::vector<std::string> laneIDs;
139 for (std::vector<std::string>::iterator i = laneIDs.begin(); i != laneIDs.end(); ++i) {
142 throw InvalidArgument(
"The lane to use within MSLaneSpeedTrigger '" +
id +
"' is not known.");
144 lanes.push_back(lane);
146 if (lanes.size() == 0) {
147 throw InvalidArgument(
"No lane defined for MSLaneSpeedTrigger '" +
id +
"'.");
184 throw InvalidArgument(
"Invalid position for Charging Station '" +
id +
"'.");
188 std::vector<std::string> lines;
192 buildChargingStation(net,
id, lines, lane, frompos, topos, chrgpower, efficiency, chargeInTransit, ChargeDelay);
213 std::vector<std::string> lines;
234 throw InvalidArgument(
"Invalid position for container stop '" +
id +
"'.");
237 std::vector<std::string> lines;
245 const std::string& base) {
260 if (routeProbe !=
"") {
265 METriggeredCalibrator* trigger = buildMECalibrator(net,
id, &lane->
getEdge(), pos, file, outfile, freq, probe);
281 const std::string& base) {
292 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
295 std::vector<std::string> edgeIDs;
297 for (std::vector<std::string>::iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
300 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
302 edges.push_back(edge);
304 if (edges.size() == 0) {
305 throw InvalidArgument(
"No edges found for MSTriggeredRerouter '" +
id +
"'.");
310 throw InvalidArgument(
"Could not parse MSTriggeredRerouter '" +
id +
"'.");
327 const std::vector<MSLane*>& destLanes,
328 const std::string& file) {
334 METriggeredCalibrator*
335 NLTriggerBuilder::buildMECalibrator(
MSNet& ,
const std::string&
id,
337 const std::string& file,
338 const std::string& outfile,
340 return new METriggeredCalibrator(
id, edge, pos, file, outfile, freq, MSGlobals::gMesoNet->getSegmentForEdge(*edge, pos)->getLength(), probe);
348 const std::string& file,
349 const std::string& outfile,
358 SUMOReal prob,
const std::string& file,
bool off) {
365 const std::vector<std::string>& lines,
370 throw InvalidArgument(
"Could not build bus stop '" +
id +
"'; probably declared twice.");
377 const std::vector<std::string>& lines,
382 throw InvalidArgument(
"Could not build container stop '" +
id +
"'; probably declared twice.");
388 const std::vector<std::string>& lines,
394 delete chargingStation;
395 throw InvalidArgument(
"Could not build Charging Station '" +
id +
"'; probably declared twice.");
401 const std::string& base,
402 const bool allowEmpty) {
422 const std::string& tt,
423 const std::string& tid) {
428 throw InvalidArgument(
"The lane " + objectid +
" to use within the " + tt +
" '" + tid +
"' is not known.");
437 const std::string& tt,
const std::string& tid) {
451 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
virtual void buildBusStop(MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, SUMOReal frompos, SUMOReal topos)
Builds a bus stop.
MSEdge & getEdge() const
Returns the lane's edge.
virtual MSCalibrator * buildCalibrator(MSNet &net, const std::string &id, MSEdge *edge, SUMOReal pos, const std::string &file, const std::string &outfile, const SUMOTime freq, const MSRouteProbe *probe)
builds a microscopic calibrator
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
A lane area vehicles can halt at.
virtual void buildChargingStation(MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, SUMOReal frompos, SUMOReal topos, SUMOReal chrgpower, SUMOReal efficiency, SUMOReal chargeInTransit, SUMOReal ChargeDelay)
Builds a charging Station.
Writes routes of vehicles passing a certain edge.
SUMOReal getLength() const
Returns the lane's length.
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.
static bool checkStopPos(SUMOReal &startPos, SUMOReal &endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos)
check start and end position of a stop
bool addBusStop(MSStoppingPlace *busStop)
Adds a bus stop.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
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.
void parseAndBuildBusStop(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a bus stop.
NLTriggerBuilder()
Constructor.
Base (microsim) event class.
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.
The simulated network and simulation perfomer.
static OptionsCont & getOptions()
Retrieves the options.
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.
Changes the speed allowed on a set of lanes.
T get(const std::string &id) const
Retrieves an item.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
SUMOReal getLength() const
return the length of the edge
SUMOReal getPosition(const SUMOSAXAttributes &attrs, MSLane *lane, const std::string &tt, const std::string &tid)
returns the position on the lane checking it
Encapsulated SAX-Attributes.
NLHandler * myHandler
The parent handler to set for subhandlers.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
void parseAndBuildContainerStop(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a container stop.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
A wrapper for a Command function.
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
virtual void buildContainerStop(MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, SUMOReal frompos, SUMOReal topos)
Builds a container stop.
void registerParent(const int tag, GenericSAXHandler *handler)
Assigning a parent handler which is enabled when the specified tag is closed.
SUMOTime string2time(const std::string &r)
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
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 SUMOTime addEvent(Command *operation, SUMOTime execTimeStep, AdaptType type)
Adds an Event.
The XML-Handler for network loading.
Reroutes vehicles passing an edge.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
bool addContainerStop(MSStoppingPlace *containerStop)
Adds a container stop.
bool addChargingStation(MSChargingStation *chargingStation)
Adds a chargingg station.
Calibrates the flow on a segment to a specified one.
Patch the time in a way that it is at least as high as the simulation begin time. ...
static const bool gUseMesoSim
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, MSEdgeVector &edges, SUMOReal prob, const std::string &file, bool off)
builds an rerouter
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 MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Builds a lane speed trigger.
std::vector< MSEdge * > MSEdgeVector
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
Representation of a lane in the micro simulation.
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
MSLane * getLane(const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid)
Returns the lane defined by attribute "lane".