SUMO - Simulation of Urban MObility
NLTriggerBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
22 // Builds trigger objects for microsim
23 /****************************************************************************/
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
37 #include <microsim/MSLane.h>
38 #include <microsim/MSEdge.h>
39 #include <microsim/MSGlobals.h>
40 #include <microsim/MSParkingArea.h>
53 #include "NLHandler.h"
54 #include "NLTriggerBuilder.h"
56 #include <utils/xml/XMLSubSys.h>
57 
58 
59 #include <mesosim/MELoop.h>
61 
62 
63 // ===========================================================================
64 // method definitions
65 // ===========================================================================
67  : myHandler(0), myParkingArea(0), myCurrentStop(0) {}
68 
69 
71 
72 void
74  myHandler = handler;
75 }
76 
77 
78 void
80  bool ok = true;
81  // get the id, throw if not given or empty...
82  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
83  if (!ok) {
84  return;
85  }
86  MSEdge* e = MSEdge::dictionary(id);
87  if (e == 0) {
88  WRITE_ERROR("Unknown edge ('" + id + "') referenced in a vaporizer.");
89  return;
90  }
91  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, 0, ok);
92  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, 0, ok);
93  if (!ok) {
94  return;
95  }
96  if (begin < 0) {
97  WRITE_ERROR("A vaporization begin time is negative (edge id='" + id + "').");
98  return;
99  }
100  if (begin >= end) {
101  WRITE_ERROR("A vaporization ends before it starts (edge id='" + id + "').");
102  return;
103  }
104  if (end >= string2time(OptionsCont::getOptions().getString("begin"))) {
109  }
110 }
111 
112 
113 
114 void
116  const std::string& base) {
117  // get the id, throw if not given or empty...
118  bool ok = true;
119  // get the id, throw if not given or empty...
120  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
121  if (!ok) {
122  return;
123  }
124  // get the file name to read further definitions from
125  std::string file = getFileName(attrs, base, true);
126  std::string objectid = attrs.get<std::string>(SUMO_ATTR_LANES, id.c_str(), ok);
127  if (!ok) {
128  throw InvalidArgument("The lanes to use within MSLaneSpeedTrigger '" + id + "' are not known.");
129  }
130  std::vector<MSLane*> lanes;
131  std::vector<std::string> laneIDs;
132  SUMOSAXAttributes::parseStringVector(objectid, laneIDs);
133  for (std::vector<std::string>::iterator i = laneIDs.begin(); i != laneIDs.end(); ++i) {
134  MSLane* lane = MSLane::dictionary(*i);
135  if (lane == 0) {
136  throw InvalidArgument("The lane to use within MSLaneSpeedTrigger '" + id + "' is not known.");
137  }
138  lanes.push_back(lane);
139  }
140  if (lanes.size() == 0) {
141  throw InvalidArgument("No lane defined for MSLaneSpeedTrigger '" + id + "'.");
142  }
143  try {
144  MSLaneSpeedTrigger* trigger = buildLaneSpeedTrigger(net, id, lanes, file);
145  if (file == "") {
147  }
148  } catch (ProcessError& e) {
149  throw InvalidArgument(e.what());
150  }
151 }
152 
153 void
155  bool ok = true;
156 
157  // get the id, throw if not given or empty...
158  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
159 
160  if (!ok) {
161  throw ProcessError();
162  }
163 
164  // get the lane
165  MSLane* lane = getLane(attrs, "chargingStation", id);
166 
167  // get the positions
168  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
169  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
170  double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), ok, 0);
171  double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), ok, 0);
172  bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), ok, 0);
173  double chargeDelay = attrs.getOpt<double>(SUMO_ATTR_CHARGEDELAY, id.c_str(), ok, 0);
174 
175  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
176 
177  if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) {
178  throw InvalidArgument("Invalid position for Charging Station '" + id + "'.");
179  }
180 
181  // build the Charging Station
182  buildChargingStation(net, id, lane, frompos, topos, chargingPower, efficiency, chargeInTransit, chargeDelay);
183 }
184 
185 
186 void
188  bool ok = true;
189  // get the id, throw if not given or empty...
190  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
191  if (!ok) {
192  throw ProcessError();
193  }
194 
195  //get the name, leave blank if not given
196  const std::string ptStopName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
197 
198  // get the lane
199  MSLane* lane = getLane(attrs, toString(element), id);
200  // get the positions
201  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
202  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
203  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
204  if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) {
205  throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'.");
206  }
207  // get the lines
208  std::vector<std::string> lines;
209  SUMOSAXAttributes::parseStringVector(attrs.getOpt<std::string>(SUMO_ATTR_LINES, id.c_str(), ok, "", false), lines);
210  // build the bus stop
211  buildStoppingPlace(net, id, lines, lane, frompos, topos, element, ptStopName);
212 }
213 
214 
215 void
217  // get the lane
218  MSLane* lane = getLane(attrs, "access" , "");
219  // get the positions
220  bool ok = true;
221  double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, "access", ok, 0);
222  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "access", ok, false);
223  if (!ok || !myHandler->checkStopPos(pos, pos, lane->getLength(), 0, friendlyPos)) {
224  throw InvalidArgument("Invalid position " + toString(pos) + " for access on lane '" + lane->getID() + "' in stop '" + myCurrentStop->getID() + "'.");
225  }
226  // add bus stop access
227  if (myCurrentStop != 0) {
228  myCurrentStop->addAccess(lane, pos);
229  }
230 }
231 
232 
233 void
235  bool ok = true;
236  // get the id, throw if not given or empty...
237  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
238  if (!ok) {
239  throw ProcessError();
240  }
241  // get the lane
242  MSLane* lane = getLane(attrs, "parkingArea", id);
243  // get the positions
244  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
245  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
246  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
247  unsigned int capacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), ok, 0);
248  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), ok, 0);
249  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), ok, 0);
250  double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), ok, 0);
251  if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) {
252  throw InvalidArgument("Invalid position for parking area '" + id + "'.");
253  }
254  // get the lines
255  std::vector<std::string> lines;
256  SUMOSAXAttributes::parseStringVector(attrs.getOpt<std::string>(SUMO_ATTR_LINES, id.c_str(), ok, "", false), lines);
257  // build the parking area
258  beginParkingArea(net, id, lines, lane, frompos, topos, capacity, width, length, angle);
259 }
260 
261 
262 
263 void
265  bool ok = true;
266  // Check for open parking area
267  if (myParkingArea == 0) {
268  throw ProcessError();
269  }
270  // get the positions
271  double x = attrs.get<double>(SUMO_ATTR_X, "", ok);
272  if (!ok) {
273  throw InvalidArgument("Invalid x position for lot entry.");
274  }
275  double y = attrs.get<double>(SUMO_ATTR_Y, "", ok);
276  if (!ok) {
277  throw InvalidArgument("Invalid y position for lot entry.");
278  }
279  double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", ok, 0.);
280  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, "", ok, myParkingArea->getWidth());
281  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", ok, myParkingArea->getLength());
282  double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, "", ok, myParkingArea->getAngle());
283  // add the lot entry
284  addLotEntry(x, y, z, width, length, angle);
285 }
286 
287 
288 void
290  const std::string& base) {
291  bool ok = true;
292  // get the id, throw if not given or empty...
293  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
294  if (!ok) {
295  throw ProcessError();
296  }
297  MSLane* lane = 0;
298  MSEdge* edge = 0;
299  // get the file name to read further definitions from
300  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
301  std::string edgeID = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), ok);
302  edge = MSEdge::dictionary(edgeID);
303  if (edge == 0) {
304  throw InvalidArgument("The edge " + edgeID + " to use within the calibrator '" + id + "' is not known.");
305  }
306  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
307  lane = getLane(attrs, "calibrator", id);
308  if (&lane->getEdge() != edge) {
309  throw InvalidArgument("The edge " + edgeID + " to use within the calibrator '" + id
310  + "' does not match the calibrator lane '" + lane->getID() + ".");
311  }
312  }
313  } else {
314  lane = getLane(attrs, "calibrator", id);
315  edge = &lane->getEdge();
316  }
317  const double pos = getPosition(attrs, lane, "calibrator", id, edge);
318  const SUMOTime freq = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, DELTA_T); // !!! no error handling
319  std::string file = getFileName(attrs, base, true);
320  std::string outfile = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), ok, "");
321  std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), ok, "");
322  MSRouteProbe* probe = 0;
323  if (routeProbe != "") {
324  probe = dynamic_cast<MSRouteProbe*>(net.getDetectorControl().getTypedDetectors(SUMO_TAG_ROUTEPROBE).get(routeProbe));
325  }
327  if (lane != 0 && edge->getLanes().size() > 1) {
328  WRITE_WARNING("Meso calibrator '" + id
329  + "' defined for lane '" + lane->getID()
330  + "' will collect data for all lanes of edge '" + edge->getID() + "'.");
331  }
332  METriggeredCalibrator* trigger = buildMECalibrator(net, id, edge, pos, file, outfile, freq, probe);
333  if (file == "") {
334  trigger->registerParent(SUMO_TAG_CALIBRATOR, myHandler);
335  }
336  } else {
337  MSCalibrator* trigger = buildCalibrator(net, id, edge, lane, pos, file, outfile, freq, probe);
338  if (file == "") {
340  }
341  }
342 }
343 
344 
345 void
347  const std::string& base) {
348  bool ok = true;
349  // get the id, throw if not given or empty...
350  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
351  if (!ok) {
352  throw ProcessError();
353  }
354  // get the file name to read further definitions from
355  std::string file = getFileName(attrs, base, true);
356  std::string objectid = attrs.get<std::string>(SUMO_ATTR_EDGES, id.c_str(), ok);
357  if (!ok) {
358  throw InvalidArgument("The edge to use within MSTriggeredRerouter '" + id + "' is not known.");
359  }
360  MSEdgeVector edges;
361  std::vector<std::string> edgeIDs;
362  SUMOSAXAttributes::parseStringVector(objectid, edgeIDs);
363  for (std::vector<std::string>::iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
364  MSEdge* edge = MSEdge::dictionary(*i);
365  if (edge == 0) {
366  throw InvalidArgument("The edge '" + (*i) + "' to use within MSTriggeredRerouter '" + id + "' is not known.");
367  }
368  edges.push_back(edge);
369  }
370  if (edges.size() == 0) {
371  throw InvalidArgument("No edges found for MSTriggeredRerouter '" + id + "'.");
372  }
373  double prob = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), ok, 1);
374  bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), ok, false);
375  SUMOTime timeThreshold = TIME2STEPS(attrs.getOpt<double>(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, 0));
376  if (!ok) {
377  throw InvalidArgument("Could not parse MSTriggeredRerouter '" + id + "'.");
378  }
379  MSTriggeredRerouter* trigger = buildRerouter(net, id, edges, prob, file, off, timeThreshold);
380  // read in the trigger description
381  if (file == "") {
383  } else if (!XMLSubSys::runParser(*trigger, file)) {
384  throw ProcessError();
385  }
386 }
387 
388 
389 // -------------------------
390 
391 
393 NLTriggerBuilder::buildLaneSpeedTrigger(MSNet& /*net*/, const std::string& id,
394  const std::vector<MSLane*>& destLanes,
395  const std::string& file) {
396  return new MSLaneSpeedTrigger(id, destLanes, file);
397 }
398 
399 
401 NLTriggerBuilder::buildMECalibrator(MSNet& /*net*/, const std::string& id,
402  const MSEdge* edge,
403  double pos,
404  const std::string& file,
405  const std::string& outfile,
406  const SUMOTime freq, MSRouteProbe* probe) {
407  return new METriggeredCalibrator(id, edge, pos, file, outfile, freq, MSGlobals::gMesoNet->getSegmentForEdge(*edge, pos)->getLength(), probe);
408 }
409 
410 
412 NLTriggerBuilder::buildCalibrator(MSNet& /*net*/, const std::string& id,
413  MSEdge* edge,
414  MSLane* lane,
415  double pos,
416  const std::string& file,
417  const std::string& outfile,
418  const SUMOTime freq, const MSRouteProbe* probe) {
419  return new MSCalibrator(id, edge, lane, pos, file, outfile, freq, edge->getLength(), probe);
420 }
421 
422 
424 NLTriggerBuilder::buildRerouter(MSNet&, const std::string& id,
425  MSEdgeVector& edges,
426  double prob, const std::string& file, bool off,
427  SUMOTime timeThreshold) {
428  return new MSTriggeredRerouter(id, edges, prob, file, off, timeThreshold);
429 }
430 
431 
432 void
433 NLTriggerBuilder::buildStoppingPlace(MSNet& net, std::string id, std::vector<std::string> lines, MSLane* lane,
434  double frompos, double topos, const SumoXMLTag element, std::string ptStopName) {
435  myCurrentStop = new MSStoppingPlace(id, lines, *lane, frompos, topos, ptStopName);
436  if (!net.addStoppingPlace(element, myCurrentStop)) {
437  delete myCurrentStop;
438  myCurrentStop = 0;
439  throw InvalidArgument("Could not build " + toString(element) + " '" + id + "'; probably declared twice.");
440  }
441 }
442 
443 
444 void
445 NLTriggerBuilder::beginParkingArea(MSNet& net, const std::string& id,
446  const std::vector<std::string>& lines,
447  MSLane* lane, double frompos, double topos,
448  unsigned int capacity,
449  double width, double length, double angle) {
450  // Close previous parking area if there are not lots inside
451  MSParkingArea* stop = new MSParkingArea(id, lines, *lane, frompos, topos, capacity, width, length, angle);
452  if (!net.addStoppingPlace(SUMO_TAG_PARKING_AREA, stop)) {
453  delete stop;
454  throw InvalidArgument("Could not build parking area '" + id + "'; probably declared twice.");
455  } else {
456  myParkingArea = stop;
457  }
458 }
459 
460 
461 void
462 NLTriggerBuilder::addLotEntry(double x, double y, double z,
463  double width, double length, double angle) {
464  if (myParkingArea != 0) {
465  myParkingArea->addLotEntry(x, y, z, width, length, angle);
466  } else {
467  throw InvalidArgument("Could not add lot entry outside a parking area.");
468  }
469 }
470 
471 
472 void
474  if (myParkingArea != 0) {
475  myParkingArea = 0;
476  } else {
477  throw InvalidArgument("Could not end a parking area that is not opened.");
478  }
479 }
480 
481 
482 void
483 NLTriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos,
484  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay) {
485  MSChargingStation* chargingStation = new MSChargingStation(id, *lane, frompos, topos, chargingPower, efficiency, chargeInTransit, chargeDelay);
486  if (!net.addStoppingPlace(SUMO_TAG_CHARGING_STATION, chargingStation)) {
487  delete chargingStation;
488  throw InvalidArgument("Could not build charging station '" + id + "'; probably declared twice.");
489  }
490 }
491 
492 std::string
494  const std::string& base,
495  const bool allowEmpty) {
496  // get the file name to read further definitions from
497  bool ok = true;
498  std::string file = attrs.getOpt<std::string>(SUMO_ATTR_FILE, 0, ok, "");
499  if (file == "") {
500  if (allowEmpty) {
501  return file;
502  }
503  throw InvalidArgument("No filename given.");
504  }
505  // check whether absolute or relative filenames are given
506  if (!FileHelpers::isAbsolute(file)) {
507  return FileHelpers::getConfigurationRelative(base, file);
508  }
509  return file;
510 }
511 
512 
513 MSLane*
515  const std::string& tt,
516  const std::string& tid) {
517  bool ok = true;
518  std::string objectid = attrs.get<std::string>(SUMO_ATTR_LANE, tid.c_str(), ok);
519  MSLane* lane = MSLane::dictionary(objectid);
520  if (lane == 0) {
521  throw InvalidArgument("The lane " + objectid + " to use within the " + tt + " '" + tid + "' is not known.");
522  }
523  return lane;
524 }
525 
526 
527 double
529  MSLane* lane,
530  const std::string& tt, const std::string& tid,
531  MSEdge* edge) {
532  assert(lane != 0 || edge != 0);
533  const double length = lane != 0 ? lane->getLength() : edge->getLength();
534  bool ok = true;
535  double pos = attrs.get<double>(SUMO_ATTR_POSITION, 0, ok);
536  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, 0, ok, false);
537  if (!ok) {
538  throw InvalidArgument("Error on parsing a position information.");
539  }
540  if (pos < 0) {
541  pos = length + pos;
542  }
543  if (pos > length) {
544  if (friendlyPos) {
545  pos = length - (double) 0.1;
546  } else {
547  if (lane != 0) {
548  throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the lane's '" + lane->getID() + "' length.");
549  } else {
550  throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the edges's '" + edge->getID() + "' length.");
551  }
552  }
553  }
554  return pos;
555 }
556 
557 
558 
559 /****************************************************************************/
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.
Definition: MSParkingArea.h:65
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&#39;s edge.
Definition: MSLane.h:607
a routeprobe detector
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
Definition: FileHelpers.cpp:81
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
A lane area vehicles can halt at.
A calibrator placed over edge.
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:67
virtual void addAccess(MSLane *lane, const double pos)
adds an access point to this stop
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&#39;s lanes.
Definition: MSEdge.h:167
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
SUMOTime DELTA_T
Definition: SUMOTime.cpp:39
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:497
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn&#39;t already in the dictionary...
Definition: MSEdge.cpp:744
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:378
const std::string & getID() const
Returns the id.
Definition: Named.h:74
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, MSEdgeVector &edges, double prob, const std::string &file, bool off, SUMOTime timeThreshold)
builds an rerouter
NLTriggerBuilder()
Constructor.
Base (microsim) event class.
Definition: Command.h:60
MSParkingArea * myParkingArea
definition of the currently parsed parking area
double getLength() const
return the length of the edge
Definition: MSEdge.h:569
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything&#39;s ok.
Definition: XMLSubSys.cpp:109
virtual ~NLTriggerBuilder()
Destructor.
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:385
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.
Definition: MSNet.cpp:857
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)
Definition: MsgHandler.h:199
The simulated network and simulation perfomer.
Definition: MSNet.h:90
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
Changes the speed allowed on a set of lanes.
A road/street connecting two junctions.
Definition: MSEdge.h:80
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
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.
Definition: FileHelpers.cpp:96
virtual void endParkingArea()
End a parking area.
virtual void buildChargingStation(MSNet &net, const std::string &id, MSLane *lane, double frompos, double topos, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay)
Builds a charging Station.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:399
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.
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)
Definition: SUMOTime.cpp:46
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
#define POSITION_EPS
Definition: config.h:175
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane *> &destLanes, const std::string &file)
Builds a lane speed trigger.
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:369
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
double getLength() const
Returns the lot rectangle length.
The XML-Handler for network loading.
Definition: NLHandler.h:87
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:205
Reroutes vehicles passing an edge.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1639
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.
double getWidth() const
Returns the lot rectangle width.
weights: time range end
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.
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)
Begin a parking area.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:112
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:56
A variable speed sign.
Eficiency of the charge in Charging Stations.
long long int SUMOTime
Definition: TraCIDefs.h:51
Delay in the charge of charging stations.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
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.
static bool gUseMesoSim
Definition: MSGlobals.h:97
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
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".