54 #include <mesosim/METriggeredCalibrator.h>
57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
87 WRITE_ERROR(
"Unknown edge ('" +
id +
"') referenced in a vaporizer.");
96 WRITE_ERROR(
"A vaporization begin time is negative (edge id='" +
id +
"').");
100 WRITE_ERROR(
"A vaporization ends before it starts (edge id='" +
id +
"').");
119 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
124 std::string file = getFileName(attrs, base,
true);
125 std::string objectid = attrs.getStringReporting(
SUMO_ATTR_LANES,
id.c_str(), ok);
127 throw InvalidArgument(
"The lanes to use within MSLaneSpeedTrigger '" +
id +
"' are not known.");
129 std::vector<MSLane*> lanes;
130 std::vector<std::string> laneIDs;
132 for (std::vector<std::string>::iterator i = laneIDs.begin(); i != laneIDs.end(); ++i) {
135 throw InvalidArgument(
"The lane to use within MSLaneSpeedTrigger '" +
id +
"' is not known.");
137 lanes.push_back(lane);
139 if (lanes.size() == 0) {
140 throw InvalidArgument(
"No lane defined for MSLaneSpeedTrigger '" +
id +
"'.");
157 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
162 MSLane* lane = getLane(attrs,
"busStop",
id);
167 if (!ok || !myHandler->checkStopPos(frompos, topos, lane->
getLength(), 10., friendlyPos)) {
171 std::vector<std::string> lines;
174 buildBusStop(net,
id, lines, lane, frompos, topos);
184 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
189 MSLane* lane = getLane(attrs,
"calibrator",
id);
190 const SUMOReal pos = getPosition(attrs, lane,
"calibrator",
id);
193 std::string file = getFileName(attrs, base,
true);
195 std::string outfile = attrs.getOptStringReporting(
SUMO_ATTR_OUTPUT, 0, ok,
"");
196 METriggeredCalibrator* trigger = buildCalibrator(net,
id, &lane->
getEdge(), pos, file, outfile, freq);
210 std::string
id = attrs.getStringReporting(
SUMO_ATTR_ID, 0, ok);
215 std::string file = getFileName(attrs, base,
true);
216 std::string objectid = attrs.getStringReporting(
SUMO_ATTR_EDGES,
id.c_str(), ok);
218 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
220 std::vector<MSEdge*> edges;
221 std::vector<std::string> edgeIDs;
223 for (std::vector<std::string>::iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
226 throw InvalidArgument(
"The edge to use within MSTriggeredRerouter '" +
id +
"' is not known.");
228 edges.push_back(edge);
230 if (edges.size() == 0) {
231 throw InvalidArgument(
"No edges found for MSTriggeredRerouter '" +
id +
"'.");
234 bool off = attrs.getOptBoolReporting(
SUMO_ATTR_OFF,
id.c_str(), ok,
false);
236 throw InvalidArgument(
"Could not parse MSTriggeredRerouter '" +
id +
"'.");
250 const std::vector<MSLane*>& destLanes,
251 const std::string& file) {
257 METriggeredCalibrator*
258 NLTriggerBuilder::buildCalibrator(
MSNet& net,
const std::string&
id,
260 const std::string& file,
261 const std::string& outfile,
263 return new METriggeredCalibrator(
id, edge, pos, file, outfile, freq);
270 std::vector<MSEdge*>& edges,
271 SUMOReal prob,
const std::string& file,
bool off) {
278 const std::vector<std::string>& lines,
281 if (!net.addBusStop(stop)) {
283 throw InvalidArgument(
"Could not build bus stop '" +
id +
"'; probably declared twice.");
292 const std::string& base,
296 std::string file = attrs.getOptStringReporting(
SUMO_ATTR_FILE, 0, ok,
"");
313 const std::string& tt,
316 std::string objectid = attrs.getStringReporting(
SUMO_ATTR_LANE, tid.c_str(), ok);
319 throw InvalidArgument(
"The lane " + objectid +
" to use within the " + tt +
" '" + tid +
"' is not known.");
328 const std::string& tt,
const std::string& tid)
throw(
InvalidArgument) {
342 throw InvalidArgument(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");