SUMO - Simulation of Urban MObility
NLTriggerBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
12 // Builds trigger objects for microsim
13 /****************************************************************************/
14 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
15 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
16 /****************************************************************************/
17 //
18 // This file is part of SUMO.
19 // SUMO is free software: you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation, either version 3 of the License, or
22 // (at your option) any later version.
23 //
24 /****************************************************************************/
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
38 #include <microsim/MSLane.h>
39 #include <microsim/MSEdge.h>
40 #include <microsim/MSGlobals.h>
41 #include <microsim/MSParkingArea.h>
54 #include "NLHandler.h"
55 #include "NLTriggerBuilder.h"
57 #include <utils/xml/XMLSubSys.h>
58 
59 
60 #include <mesosim/MELoop.h>
62 
63 
64 // ===========================================================================
65 // method definitions
66 // ===========================================================================
68  : myHandler(0), myParkingArea(0) {}
69 
70 
72 
73 void
75  myHandler = handler;
76 }
77 
78 
79 void
81  bool ok = true;
82  // get the id, throw if not given or empty...
83  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
84  if (!ok) {
85  return;
86  }
87  MSEdge* e = MSEdge::dictionary(id);
88  if (e == 0) {
89  WRITE_ERROR("Unknown edge ('" + id + "') referenced in a vaporizer.");
90  return;
91  }
92  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, 0, ok);
93  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, 0, ok);
94  if (!ok) {
95  return;
96  }
97  if (begin < 0) {
98  WRITE_ERROR("A vaporization begin time is negative (edge id='" + id + "').");
99  return;
100  }
101  if (begin >= end) {
102  WRITE_ERROR("A vaporization ends before it starts (edge id='" + id + "').");
103  return;
104  }
105  if (end >= string2time(OptionsCont::getOptions().getString("begin"))) {
110  }
111 }
112 
113 
114 
115 void
117  const std::string& base) {
118  // get the id, throw if not given or empty...
119  bool ok = true;
120  // get the id, throw if not given or empty...
121  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
122  if (!ok) {
123  return;
124  }
125  // get the file name to read further definitions from
126  std::string file = getFileName(attrs, base, true);
127  std::string objectid = attrs.get<std::string>(SUMO_ATTR_LANES, id.c_str(), ok);
128  if (!ok) {
129  throw InvalidArgument("The lanes to use within MSLaneSpeedTrigger '" + id + "' are not known.");
130  }
131  std::vector<MSLane*> lanes;
132  std::vector<std::string> laneIDs;
133  SUMOSAXAttributes::parseStringVector(objectid, laneIDs);
134  for (std::vector<std::string>::iterator i = laneIDs.begin(); i != laneIDs.end(); ++i) {
135  MSLane* lane = MSLane::dictionary(*i);
136  if (lane == 0) {
137  throw InvalidArgument("The lane to use within MSLaneSpeedTrigger '" + id + "' is not known.");
138  }
139  lanes.push_back(lane);
140  }
141  if (lanes.size() == 0) {
142  throw InvalidArgument("No lane defined for MSLaneSpeedTrigger '" + id + "'.");
143  }
144  try {
145  MSLaneSpeedTrigger* trigger = buildLaneSpeedTrigger(net, id, lanes, file);
146  if (file == "") {
148  }
149  } catch (ProcessError& e) {
150  throw InvalidArgument(e.what());
151  }
152 }
153 
154 void
156  bool ok = true;
157 
158  // get the id, throw if not given or empty...
159  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
160 
161  if (!ok) {
162  throw ProcessError();
163  }
164 
165  // get the lane
166  MSLane* lane = getLane(attrs, "chargingStation", id);
167 
168  // get the positions
169  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
170  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
171  double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), ok, 0);
172  double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), ok, 0);
173  bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), ok, 0);
174  int ChargeDelay = attrs.getOpt<int>(SUMO_ATTR_CHARGEDELAY, id.c_str(), ok, 0);
175 
176  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
177 
178  if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) {
179  throw InvalidArgument("Invalid position for Charging Station '" + id + "'.");
180  }
181 
182  // build the Charging Station
183  buildChargingStation(net, id, lane, frompos, topos, chargingPower, efficiency, chargeInTransit, ChargeDelay);
184 }
185 
186 
187 void
189  bool ok = true;
190  // get the id, throw if not given or empty...
191  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
192  if (!ok) {
193  throw ProcessError();
194  }
195 
196  //get the name, leave blank if not given
197  const std::string ptStopName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
198 
199  // get the lane
200  MSLane* lane = getLane(attrs, toString(element), id);
201  // get the positions
202  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
203  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
204  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
205  if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) {
206  throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'.");
207  }
208  // get the lines
209  std::vector<std::string> lines;
210  SUMOSAXAttributes::parseStringVector(attrs.getOpt<std::string>(SUMO_ATTR_LINES, id.c_str(), ok, "", false), lines);
211  // build the bus stop
212  buildStoppingPlace(net, id, lines, lane, frompos, topos, element, ptStopName);
213 }
214 
215 
216 void
218  // get the lane
219  MSLane* lane = getLane(attrs, "access" , "");
220  // get the positions
221  bool ok = true;
222  double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, "access", ok, 0);
223  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "access", ok, false);
224  if (!ok || !myHandler->checkStopPos(pos, pos, lane->getLength(), 0, friendlyPos)) {
225  throw InvalidArgument("Invalid position for access in stop '" + myCurrentStop->getID() + "'.");
226  }
227  // add bus stop access
228  if (myCurrentStop != 0) {
229  myCurrentStop->addAccess(lane, pos);
230  }
231 }
232 
233 
234 void
236  bool ok = true;
237  // get the id, throw if not given or empty...
238  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
239  if (!ok) {
240  throw ProcessError();
241  }
242  // get the lane
243  MSLane* lane = getLane(attrs, "parkingArea", id);
244  // get the positions
245  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
246  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
247  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
248  unsigned int capacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), ok, 0);
249  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), ok, 0);
250  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), ok, 0);
251  double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), ok, 0);
252  if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) {
253  throw InvalidArgument("Invalid position for parking area '" + id + "'.");
254  }
255  // get the lines
256  std::vector<std::string> lines;
257  SUMOSAXAttributes::parseStringVector(attrs.getOpt<std::string>(SUMO_ATTR_LINES, id.c_str(), ok, "", false), lines);
258  // build the parking area
259  beginParkingArea(net, id, lines, lane, frompos, topos, capacity, width, length, angle);
260 }
261 
262 
263 
264 void
266  bool ok = true;
267  // Check for open parking area
268  if (myParkingArea == 0) {
269  throw ProcessError();
270  }
271  // get the positions
272  double x = attrs.get<double>(SUMO_ATTR_X, "", ok);
273  if (!ok) {
274  throw InvalidArgument("Invalid x position for lot entry.");
275  }
276  double y = attrs.get<double>(SUMO_ATTR_Y, "", ok);
277  if (!ok) {
278  throw InvalidArgument("Invalid y position for lot entry.");
279  }
280  double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", ok, 0.);
281  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, "", ok, myParkingArea->getWidth());
282  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", ok, myParkingArea->getLength());
283  double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, "", ok, myParkingArea->getAngle());
284  // add the lot entry
285  addLotEntry(x, y, z, width, length, angle);
286 }
287 
288 
289 void
291  const std::string& base) {
292  bool ok = true;
293  // get the id, throw if not given or empty...
294  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
295  if (!ok) {
296  throw ProcessError();
297  }
298  MSLane* lane = 0;
299  MSEdge* edge = 0;
300  // get the file name to read further definitions from
301  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
302  std::string edgeID = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), ok);
303  edge = MSEdge::dictionary(edgeID);
304  if (edge == 0) {
305  throw InvalidArgument("The edge " + edgeID + " to use within the calibrator '" + id + "' is not known.");
306  }
307  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
308  lane = getLane(attrs, "calibrator", id);
309  if (&lane->getEdge() != edge) {
310  throw InvalidArgument("The edge " + edgeID + " to use within the calibrator '" + id
311  + "' does not match the calibrator lane '" + lane->getID() + ".");
312  }
313  }
314  } else {
315  lane = getLane(attrs, "calibrator", id);
316  edge = &lane->getEdge();
317  }
318  const double pos = getPosition(attrs, lane, "calibrator", id, edge);
319  const SUMOTime freq = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, DELTA_T); // !!! no error handling
320  std::string file = getFileName(attrs, base, true);
321  std::string outfile = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), ok, "");
322  std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), ok, "");
323  MSRouteProbe* probe = 0;
324  if (routeProbe != "") {
325  probe = dynamic_cast<MSRouteProbe*>(net.getDetectorControl().getTypedDetectors(SUMO_TAG_ROUTEPROBE).get(routeProbe));
326  }
328  if (lane != 0 && edge->getLanes().size() > 1) {
329  WRITE_WARNING("Meso calibrator '" + id
330  + "' defined for lane '" + lane->getID()
331  + "' will collect data for all lanes of edge '" + edge->getID() + "'.");
332  }
333  METriggeredCalibrator* trigger = buildMECalibrator(net, id, edge, pos, file, outfile, freq, probe);
334  if (file == "") {
335  trigger->registerParent(SUMO_TAG_CALIBRATOR, myHandler);
336  }
337  } else {
338  MSCalibrator* trigger = buildCalibrator(net, id, edge, lane, pos, file, outfile, freq, probe);
339  if (file == "") {
341  }
342  }
343 }
344 
345 
346 void
348  const std::string& base) {
349  bool ok = true;
350  // get the id, throw if not given or empty...
351  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
352  if (!ok) {
353  throw ProcessError();
354  }
355  // get the file name to read further definitions from
356  std::string file = getFileName(attrs, base, true);
357  std::string objectid = attrs.get<std::string>(SUMO_ATTR_EDGES, id.c_str(), ok);
358  if (!ok) {
359  throw InvalidArgument("The edge to use within MSTriggeredRerouter '" + id + "' is not known.");
360  }
361  MSEdgeVector edges;
362  std::vector<std::string> edgeIDs;
363  SUMOSAXAttributes::parseStringVector(objectid, edgeIDs);
364  for (std::vector<std::string>::iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
365  MSEdge* edge = MSEdge::dictionary(*i);
366  if (edge == 0) {
367  throw InvalidArgument("The edge to use within MSTriggeredRerouter '" + id + "' is not known.");
368  }
369  edges.push_back(edge);
370  }
371  if (edges.size() == 0) {
372  throw InvalidArgument("No edges found for MSTriggeredRerouter '" + id + "'.");
373  }
374  double prob = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), ok, 1);
375  bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), ok, false);
376  if (!ok) {
377  throw InvalidArgument("Could not parse MSTriggeredRerouter '" + id + "'.");
378  }
379  MSTriggeredRerouter* trigger = buildRerouter(net, id, edges, prob, file, off);
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  return new MSTriggeredRerouter(id, edges, prob, file, off);
428 }
429 
430 
431 void
432 NLTriggerBuilder::buildStoppingPlace(MSNet& net, std::string id, std::vector<std::string> lines, MSLane* lane,
433  double frompos, double topos, const SumoXMLTag element, std::string ptStopName) {
434  myCurrentStop = new MSStoppingPlace(id, lines, *lane, frompos, topos, ptStopName);
435  const bool success = element == SUMO_TAG_CONTAINER_STOP ? net.addContainerStop(myCurrentStop) : net.addBusStop(myCurrentStop);
436  if (!success) {
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 
452  MSParkingArea* stop = new MSParkingArea(id, lines, *lane, frompos, topos, capacity, width, length, angle);
453  if (!net.addParkingArea(stop)) {
454  delete stop;
455  throw InvalidArgument("Could not build parking area '" + id + "'; probably declared twice.");
456  } else {
457  myParkingArea = stop;
458  }
459 }
460 
461 
462 void
463 NLTriggerBuilder::addLotEntry(double x, double y, double z,
464  double width, double length, double angle) {
465  if (myParkingArea != 0) {
466  myParkingArea->addLotEntry(x, y, z, width, length, angle);
467  } else {
468  throw InvalidArgument("Could not add lot entry outside a parking area.");
469  }
470 }
471 
472 
473 void
475  if (myParkingArea != 0) {
476  myParkingArea = 0;
477  } else {
478  throw InvalidArgument("Could not end a parking area that is not opened.");
479  }
480 }
481 
482 
483 void
484 NLTriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos,
485  double chargingPower, double efficiency, bool chargeInTransit, int ChargeDelay) {
486  MSChargingStation* chargingStation = new MSChargingStation(id, *lane, frompos, topos, chargingPower, efficiency, chargeInTransit, ChargeDelay);
487 
488  if (!net.addChargingStation(chargingStation)) {
489  delete chargingStation;
490  throw InvalidArgument("Could not build Charging Station '" + id + "'; probably declared twice.");
491  }
492 }
493 
494 std::string
496  const std::string& base,
497  const bool allowEmpty) {
498  // get the file name to read further definitions from
499  bool ok = true;
500  std::string file = attrs.getOpt<std::string>(SUMO_ATTR_FILE, 0, ok, "");
501  if (file == "") {
502  if (allowEmpty) {
503  return file;
504  }
505  throw InvalidArgument("No filename given.");
506  }
507  // check whether absolute or relative filenames are given
508  if (!FileHelpers::isAbsolute(file)) {
509  return FileHelpers::getConfigurationRelative(base, file);
510  }
511  return file;
512 }
513 
514 
515 MSLane*
517  const std::string& tt,
518  const std::string& tid) {
519  bool ok = true;
520  std::string objectid = attrs.get<std::string>(SUMO_ATTR_LANE, tid.c_str(), ok);
521  MSLane* lane = MSLane::dictionary(objectid);
522  if (lane == 0) {
523  throw InvalidArgument("The lane " + objectid + " to use within the " + tt + " '" + tid + "' is not known.");
524  }
525  return lane;
526 }
527 
528 
529 double
531  MSLane* lane,
532  const std::string& tt, const std::string& tid,
533  MSEdge* edge) {
534  assert(lane != 0 || edge != 0);
535  const double length = lane != 0 ? lane->getLength() : edge->getLength();
536  bool ok = true;
537  double pos = attrs.get<double>(SUMO_ATTR_POSITION, 0, ok);
538  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, 0, ok, false);
539  if (!ok) {
540  throw InvalidArgument("Error on parsing a position information.");
541  }
542  if (pos < 0) {
543  pos = length + pos;
544  }
545  if (pos > length) {
546  if (friendlyPos) {
547  pos = length - (double) 0.1;
548  } else {
549  if (lane != 0) {
550  throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the lane's '" + lane->getID() + "' length.");
551  } else {
552  throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the edges's '" + edge->getID() + "' length.");
553  }
554  }
555  }
556  return pos;
557 }
558 
559 
560 
561 /****************************************************************************/
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:66
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, MSEdgeVector &edges, double prob, const std::string &file, bool off)
builds an rerouter
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
double getLength() const
return the length of the edge
Definition: MSEdge.h:570
SumoXMLTag
Numbers representing SUMO-XML - element names.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:582
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.
double getLength() const
Returns the lot rectangle length.
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:82
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
virtual void buildChargingStation(MSNet &net, const std::string &id, MSLane *lane, double frompos, double topos, double chargingPower, double efficiency, bool chargeInTransit, int ChargeDelay)
Builds a charging Station.
A lane area vehicles can halt at.
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:168
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:68
virtual void addAccess(MSLane *lane, const double pos)
adds an access point to this stop
Allow/disallow charge in transit in Charging Stations.
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
bool addBusStop(MSStoppingPlace *busStop)
Adds a bus stop.
Definition: MSNet.cpp:858
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:484
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:169
SUMOTime DELTA_T
Definition: SUMOTime.cpp:40
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:745
bool addParkingArea(MSParkingArea *parkingArea)
Adds a parking area.
Definition: MSNet.cpp:906
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:379
double getWidth() const
Returns the lot rectangle width.
NLTriggerBuilder()
Constructor.
Base (microsim) event class.
Definition: Command.h:61
MSParkingArea * myParkingArea
definition of the currently parsed parking area
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:110
virtual ~NLTriggerBuilder()
Destructor.
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:386
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
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:200
The simulated network and simulation perfomer.
Definition: MSNet.h:89
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
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.
Definition: Named.h:66
A road/street connecting two junctions.
Definition: MSEdge.h:81
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.
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
Encapsulated SAX-Attributes.
Calibrates the flow on a segment to a specified one.
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.
Definition: FileHelpers.cpp:97
virtual void endParkingArea()
End a parking area.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:398
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:47
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:176
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.
Definition: MSNet.h:368
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.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
The XML-Handler for network loading.
Definition: NLHandler.h:88
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
Reroutes vehicles passing an edge.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1553
static bool checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
bool addContainerStop(MSStoppingPlace *containerStop)
Adds a container stop.
Definition: MSNet.cpp:883
bool addChargingStation(MSChargingStation *chargingStation)
Adds a chargingg station.
Definition: MSNet.cpp:928
weights: time range end
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:113
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:57
A variable speed sign.
Eficiency of the charge in Charging Stations.
long long int SUMOTime
Definition: TraCIDefs.h:52
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.
Delay in the charge of charging stations.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:78
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
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
static bool gUseMesoSim
Definition: MSGlobals.h:98
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
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".
double getAngle() const
Returns the lot rectangle angle.