Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Builds trigger objects for microsim
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
30 #include <microsim/MSLane.h>
31 #include <microsim/MSEdge.h>
32 #include <microsim/MSGlobals.h>
33 #include <microsim/MSParkingArea.h>
46 #include "NLHandler.h"
47 #include "NLTriggerBuilder.h"
49 #include <utils/xml/XMLSubSys.h>
50 
51 
52 #include <mesosim/MELoop.h>
54 
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
60  : myHandler(nullptr), myParkingArea(nullptr), myCurrentStop(nullptr) {}
61 
62 
64 
65 void
67  myHandler = handler;
68 }
69 
70 
71 void
73  WRITE_WARNING("Vaporizers are deprecated. Use rerouters instead.");
74  bool ok = true;
75  // get the id, throw if not given or empty...
76  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
77  if (!ok) {
78  return;
79  }
80  MSEdge* e = MSEdge::dictionary(id);
81  if (e == nullptr) {
82  WRITE_ERROR("Unknown edge ('" + id + "') referenced in a vaporizer.");
83  return;
84  }
85  SUMOTime begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, nullptr, ok);
86  SUMOTime end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, ok);
87  if (!ok) {
88  return;
89  }
90  if (begin < 0) {
91  WRITE_ERROR("A vaporization begin time is negative (edge id='" + id + "').");
92  return;
93  }
94  if (begin >= end) {
95  WRITE_ERROR("A vaporization ends before it starts (edge id='" + id + "').");
96  return;
97  }
98  if (end >= string2time(OptionsCont::getOptions().getString("begin"))) {
103  }
104 }
105 
106 
107 
108 void
110  const std::string& base) {
111  // get the id, throw if not given or empty...
112  bool ok = true;
113  // get the id, throw if not given or empty...
114  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
115  if (!ok) {
116  return;
117  }
118  // get the file name to read further definitions from
119  std::string file = getFileName(attrs, base, true);
120  std::string objectid = attrs.get<std::string>(SUMO_ATTR_LANES, id.c_str(), ok);
121  std::vector<MSLane*> lanes;
122  for (const std::string& laneID : attrs.get<std::vector<std::string> >(SUMO_ATTR_LANES, id.c_str(), ok)) {
123  MSLane* lane = MSLane::dictionary(laneID);
124  if (lane == nullptr) {
125  throw InvalidArgument("The lane '" + laneID + "' to use within MSLaneSpeedTrigger '" + id + "' is not known.");
126  }
127  lanes.push_back(lane);
128  }
129  if (!ok) {
130  throw InvalidArgument("The lanes to use within MSLaneSpeedTrigger '" + id + "' are not known.");
131  }
132  if (lanes.size() == 0) {
133  throw InvalidArgument("No lane defined for MSLaneSpeedTrigger '" + id + "'.");
134  }
135  try {
136  MSLaneSpeedTrigger* trigger = buildLaneSpeedTrigger(net, id, lanes, file);
137  if (file == "") {
139  }
140  } catch (ProcessError& e) {
141  throw InvalidArgument(e.what());
142  }
143 }
144 
145 void
147  bool ok = true;
148 
149  // get the id, throw if not given or empty...
150  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
151  if (!ok) {
152  throw ProcessError();
153  }
154 
155  MSLane* const lane = getLane(attrs, "chargingStation", id);
156  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
157  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
158  const double chargingPower = attrs.getOpt<double>(SUMO_ATTR_CHARGINGPOWER, id.c_str(), ok, 0);
159  const double efficiency = attrs.getOpt<double>(SUMO_ATTR_EFFICIENCY, id.c_str(), ok, 0);
160  const bool chargeInTransit = attrs.getOpt<bool>(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), ok, 0);
161  const double chargeDelay = attrs.getOpt<double>(SUMO_ATTR_CHARGEDELAY, id.c_str(), ok, 0);
162  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
163  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
164 
165  if (!ok || (myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
166  throw InvalidArgument("Invalid position for charging station '" + id + "'.");
167  }
168 
169  buildChargingStation(net, id, lane, frompos, topos, name, chargingPower, efficiency, chargeInTransit, chargeDelay);
170 }
171 
172 
173 void
175  bool ok = true;
176  // get the id, throw if not given or empty...
177  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
178  if (!ok) {
179  throw ProcessError();
180  }
181 
182  //get the name, leave blank if not given
183  const std::string ptStopName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
184 
185  MSLane* lane = getLane(attrs, toString(element), id);
186  // get the positions
187  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
188  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
189  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
190  if (!ok || (myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
191  throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'.");
192  }
193  const std::vector<std::string>& lines = attrs.getOptStringVector(SUMO_ATTR_LINES, id.c_str(), ok, false);
194  const int defaultCapacity = MAX2(MSStoppingPlace::getPersonsAbreast(topos - frompos) * 3, 6);
195  const int personCapacity = attrs.getOpt<int>(SUMO_ATTR_PERSON_CAPACITY, id.c_str(), ok, defaultCapacity);
196  // build the bus stop
197  buildStoppingPlace(net, id, lines, lane, frompos, topos, element, ptStopName, personCapacity);
198 }
199 
200 
201 void
203  if (myCurrentStop == nullptr) {
204  throw InvalidArgument("Could not add access outside a stopping place.");
205  }
206  // get the lane
207  MSLane* lane = getLane(attrs, "access", myCurrentStop->getID());
208  if (!lane->allowsVehicleClass(SVC_PEDESTRIAN)) {
209  WRITE_WARNING("Ignoring invalid access from non-pedestrian lane '" + lane->getID() + "' in busStop '" + myCurrentStop->getID() + "'.");
210  return;
211  }
212  // get the positions
213  bool ok = true;
214  double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, "access", ok, 0);
215  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "access", ok, -1);
216  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "access", ok, false);
217  if (!ok || (myHandler->checkStopPos(pos, pos, lane->getLength(), 0, friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
218  throw InvalidArgument("Invalid position " + toString(pos) + " for access on lane '" + lane->getID() + "' in stop '" + myCurrentStop->getID() + "'.");
219  }
220  // add bus stop access
221  if (!myCurrentStop->addAccess(lane, pos, length)) {
222  throw InvalidArgument("Duplicate access on lane '" + lane->getID() + "' for stop '" + myCurrentStop->getID() + "'");
223  }
224 }
225 
226 
227 void
229  bool ok = true;
230  // get the id, throw if not given or empty...
231  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
232  if (!ok) {
233  throw ProcessError();
234  }
235  // get the lane
236  MSLane* lane = getLane(attrs, "parkingArea", id);
237  // get the positions
238  double frompos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0);
239  double topos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength());
240  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
241  unsigned int capacity = attrs.getOpt<int>(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), ok, 0);
242  bool onRoad = attrs.getOpt<bool>(SUMO_ATTR_ONROAD, id.c_str(), ok, false);
243  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), ok, 0);
244  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, id.c_str(), ok, 0);
245  double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, id.c_str(), ok, 0);
246  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
247  if (!ok || (myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
248  throw InvalidArgument("Invalid position for parking area '" + id + "'.");
249  }
250  const std::vector<std::string>& lines = attrs.getOptStringVector(SUMO_ATTR_LINES, id.c_str(), ok, false);
251  // build the parking area
252  beginParkingArea(net, id, lines, lane, frompos, topos, capacity, width, length, angle, name, onRoad);
253 }
254 
255 
256 
257 void
259  bool ok = true;
260  // Check for open parking area
261  if (myParkingArea == nullptr) {
262  throw ProcessError();
263  }
264  // get the positions
265  double x = attrs.get<double>(SUMO_ATTR_X, "", ok);
266  if (!ok) {
267  throw InvalidArgument("Invalid x position for lot entry.");
268  }
269  double y = attrs.get<double>(SUMO_ATTR_Y, "", ok);
270  if (!ok) {
271  throw InvalidArgument("Invalid y position for lot entry.");
272  }
273  double z = attrs.getOpt<double>(SUMO_ATTR_Z, "", ok, 0.);
274  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, "", ok, myParkingArea->getWidth());
275  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "", ok, myParkingArea->getLength());
276  double angle = attrs.getOpt<double>(SUMO_ATTR_ANGLE, "", ok, myParkingArea->getAngle());
277  // add the lot entry
278  addLotEntry(x, y, z, width, length, angle);
279 }
280 
281 
282 void
284  const std::string& base) {
285  bool ok = true;
286  // get the id, throw if not given or empty...
287  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
288  if (!ok) {
289  throw ProcessError();
290  }
291  MSLane* lane = nullptr;
292  MSEdge* edge = nullptr;
293  // get the file name to read further definitions from
294  if (attrs.hasAttribute(SUMO_ATTR_EDGE)) {
295  std::string edgeID = attrs.get<std::string>(SUMO_ATTR_EDGE, id.c_str(), ok);
296  edge = MSEdge::dictionary(edgeID);
297  if (edge == nullptr) {
298  throw InvalidArgument("The edge " + edgeID + " to use within the calibrator '" + id + "' is not known.");
299  }
300  if (attrs.hasAttribute(SUMO_ATTR_LANE)) {
301  lane = getLane(attrs, "calibrator", id);
302  if (&lane->getEdge() != edge) {
303  throw InvalidArgument("The edge " + edgeID + " to use within the calibrator '" + id
304  + "' does not match the calibrator lane '" + lane->getID() + ".");
305  }
306  }
307  } else {
308  lane = getLane(attrs, "calibrator", id);
309  edge = &lane->getEdge();
310  }
311  const double pos = getPosition(attrs, lane, "calibrator", id, edge);
312  const SUMOTime freq = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, DELTA_T); // !!! no error handling
313  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
314  std::string file = getFileName(attrs, base, true);
315  std::string outfile = attrs.getOpt<std::string>(SUMO_ATTR_OUTPUT, id.c_str(), ok, "");
316  std::string routeProbe = attrs.getOpt<std::string>(SUMO_ATTR_ROUTEPROBE, id.c_str(), ok, "");
317  MSRouteProbe* probe = nullptr;
318  if (routeProbe != "") {
319  probe = dynamic_cast<MSRouteProbe*>(net.getDetectorControl().getTypedDetectors(SUMO_TAG_ROUTEPROBE).get(routeProbe));
320  if (probe == nullptr) {
321  throw InvalidArgument("The routeProbe '" + routeProbe + "' to use within the calibrator '" + id + "' is not known.");
322  }
323  }
325  if (lane != nullptr && edge->getLanes().size() > 1) {
326  WRITE_WARNING("Meso calibrator '" + id
327  + "' defined for lane '" + lane->getID()
328  + "' will collect data for all lanes of edge '" + edge->getID() + "'.");
329  }
330  METriggeredCalibrator* trigger = buildMECalibrator(net, id, edge, pos, file, outfile, freq, probe, vTypes);
331  if (file == "") {
333  }
334  } else {
335  MSCalibrator* trigger = buildCalibrator(net, id, edge, lane, pos, file, outfile, freq, probe, vTypes);
336  if (file == "") {
338  }
339  }
340 }
341 
342 
343 void
345  const std::string& base) {
346  bool ok = true;
347  // get the id, throw if not given or empty...
348  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
349  if (!ok) {
350  throw ProcessError();
351  }
352  // get the file name to read further definitions from
353  std::string file = getFileName(attrs, base, true);
354  MSEdgeVector edges;
355  for (const std::string& edgeID : attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, id.c_str(), ok)) {
356  MSEdge* edge = MSEdge::dictionary(edgeID);
357  if (edge == nullptr) {
358  throw InvalidArgument("The edge '" + edgeID + "' to use within MSTriggeredRerouter '" + id + "' is not known.");
359  }
360  edges.push_back(edge);
361  }
362  if (!ok) {
363  throw InvalidArgument("The edge to use within MSTriggeredRerouter '" + id + "' is not known.");
364  }
365  if (edges.size() == 0) {
366  throw InvalidArgument("No edges found for MSTriggeredRerouter '" + id + "'.");
367  }
368  double prob = attrs.getOpt<double>(SUMO_ATTR_PROB, id.c_str(), ok, 1);
369  bool off = attrs.getOpt<bool>(SUMO_ATTR_OFF, id.c_str(), ok, false);
370  SUMOTime timeThreshold = TIME2STEPS(attrs.getOpt<double>(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, 0));
371  const std::string vTypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, "");
372  if (!ok) {
373  throw InvalidArgument("Could not parse MSTriggeredRerouter '" + id + "'.");
374  }
375  MSTriggeredRerouter* trigger = buildRerouter(net, id, edges, prob, file, off, timeThreshold, vTypes);
376  // read in the trigger description
377  if (file == "") {
379  } else if (!XMLSubSys::runParser(*trigger, file)) {
380  throw ProcessError();
381  }
382 }
383 
384 
385 // -------------------------
386 
387 
389 NLTriggerBuilder::buildLaneSpeedTrigger(MSNet& /*net*/, const std::string& id,
390  const std::vector<MSLane*>& destLanes,
391  const std::string& file) {
392  return new MSLaneSpeedTrigger(id, destLanes, file);
393 }
394 
395 
397 NLTriggerBuilder::buildMECalibrator(MSNet& /*net*/, const std::string& id,
398  const MSEdge* edge,
399  double pos,
400  const std::string& file,
401  const std::string& outfile,
402  const SUMOTime freq,
403  MSRouteProbe* probe,
404  const std::string& vTypes) {
405  return new METriggeredCalibrator(id, edge, pos, file, outfile, freq, MSGlobals::gMesoNet->getSegmentForEdge(*edge, pos)->getLength(), probe, vTypes);
406 }
407 
408 
410 NLTriggerBuilder::buildCalibrator(MSNet& /*net*/, const std::string& id,
411  MSEdge* edge,
412  MSLane* lane,
413  double pos,
414  const std::string& file,
415  const std::string& outfile,
416  const SUMOTime freq,
417  const MSRouteProbe* probe,
418  const std::string& vTypes) {
419  return new MSCalibrator(id, edge, lane, pos, file, outfile, freq, edge->getLength(), probe, vTypes);
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  const std::string& vTypes) {
429  return new MSTriggeredRerouter(id, edges, prob, file, off, timeThreshold, vTypes);
430 }
431 
432 
433 void
434 NLTriggerBuilder::buildStoppingPlace(MSNet& net, std::string id, std::vector<std::string> lines, MSLane* lane,
435  double frompos, double topos, const SumoXMLTag element, std::string ptStopName, int personCapacity) {
436  myCurrentStop = new MSStoppingPlace(id, lines, *lane, frompos, topos, ptStopName, personCapacity);
437  if (!net.addStoppingPlace(element, myCurrentStop)) {
438  delete myCurrentStop;
439  myCurrentStop = nullptr;
440  throw InvalidArgument("Could not build " + toString(element) + " '" + id + "'; probably declared twice.");
441  }
442 }
443 
444 
445 void
446 NLTriggerBuilder::beginParkingArea(MSNet& net, const std::string& id,
447  const std::vector<std::string>& lines,
448  MSLane* lane, double frompos, double topos,
449  unsigned int capacity,
450  double width, double length, double angle, const std::string& name,
451  bool onRoad) {
452  // Close previous parking area if there are not lots inside
453  MSParkingArea* stop = new MSParkingArea(id, lines, *lane, frompos, topos, capacity, width, length, angle, name, onRoad);
454  if (!net.addStoppingPlace(SUMO_TAG_PARKING_AREA, stop)) {
455  delete stop;
456  throw InvalidArgument("Could not build parking area '" + id + "'; probably declared twice.");
457  } else {
458  myParkingArea = stop;
459  }
460 }
461 
462 
463 void
464 NLTriggerBuilder::addLotEntry(double x, double y, double z,
465  double width, double length, double angle) {
466  if (myParkingArea != nullptr) {
467  if (!myParkingArea->parkOnRoad()) {
468  myParkingArea->addLotEntry(x, y, z, width, length, angle);
469  } else {
470  throw InvalidArgument("Cannot not add lot entry to on-road parking area.");
471  }
472  } else {
473  throw InvalidArgument("Could not add lot entry outside a parking area.");
474  }
475 }
476 
477 
478 void
480  if (myParkingArea != nullptr) {
481  myParkingArea = nullptr;
482  } else {
483  throw InvalidArgument("Could not end a parking area that is not opened.");
484  }
485 }
486 
487 
488 void
490  if (myCurrentStop != nullptr) {
491  myCurrentStop = nullptr;
492  } else {
493  throw InvalidArgument("Could not end a stopping place that is not opened.");
494  }
495 }
496 
497 
498 void
499 NLTriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, const std::string& name,
500  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay) {
501  MSChargingStation* chargingStation = new MSChargingStation(id, *lane, frompos, topos, name, chargingPower, efficiency, chargeInTransit, chargeDelay);
502  if (!net.addStoppingPlace(SUMO_TAG_CHARGING_STATION, chargingStation)) {
503  delete chargingStation;
504  throw InvalidArgument("Could not build charging station '" + id + "'; probably declared twice.");
505  }
506  myCurrentStop = chargingStation;
507 }
508 
509 std::string
511  const std::string& base,
512  const bool allowEmpty) {
513  // get the file name to read further definitions from
514  bool ok = true;
515  std::string file = attrs.getOpt<std::string>(SUMO_ATTR_FILE, nullptr, ok, "");
516  if (file == "") {
517  if (allowEmpty) {
518  return file;
519  }
520  throw InvalidArgument("No filename given.");
521  }
522  // check whether absolute or relative filenames are given
523  if (!FileHelpers::isAbsolute(file)) {
524  return FileHelpers::getConfigurationRelative(base, file);
525  }
526  return file;
527 }
528 
529 
530 MSLane*
532  const std::string& tt,
533  const std::string& tid) {
534  bool ok = true;
535  std::string objectid = attrs.get<std::string>(SUMO_ATTR_LANE, tid.c_str(), ok);
536  MSLane* lane = MSLane::dictionary(objectid);
537  if (lane == nullptr) {
538  throw InvalidArgument("The lane " + objectid + " to use within the " + tt + " '" + tid + "' is not known.");
539  }
540  return lane;
541 }
542 
543 
544 double
546  MSLane* lane,
547  const std::string& tt, const std::string& tid,
548  MSEdge* edge) {
549  assert(lane != 0 || edge != 0);
550  const double length = lane != nullptr ? lane->getLength() : edge->getLength();
551  bool ok = true;
552  double pos = attrs.get<double>(SUMO_ATTR_POSITION, nullptr, ok);
553  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, nullptr, ok, false);
554  if (!ok) {
555  throw InvalidArgument("Error on parsing a position information.");
556  }
557  if (pos < 0) {
558  pos = length + pos;
559  }
560  if (pos > length) {
561  if (friendlyPos) {
562  pos = length - (double) 0.1;
563  } else {
564  if (lane != nullptr) {
565  throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the lane's '" + lane->getID() + "' length.");
566  } else {
567  throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the edges's '" + edge->getID() + "' length.");
568  }
569  }
570  }
571  return pos;
572 }
573 
576  return myParkingArea == nullptr ? myCurrentStop : myParkingArea;
577 }
578 
579 /****************************************************************************/
GenericSAXHandler::registerParent
void registerParent(const int tag, GenericSAXHandler *handler)
Assigning a parent handler which is enabled when the specified tag is closed.
Definition: GenericSAXHandler.cpp:161
SUMO_ATTR_ANGLE
@ SUMO_ATTR_ANGLE
Definition: SUMOXMLDefinitions.h:794
SVC_PEDESTRIAN
@ SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
XMLSubSys::runParser
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.
Definition: XMLSubSys.cpp:112
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1866
METriggeredCalibrator.h
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:59
SUMOSAXAttributes::hasAttribute
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
MSParkingArea
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
MSEventControl::addEvent
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
Definition: MSEventControl.cpp:52
MSNet::getDetectorControl
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:399
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
MSLaneSpeedTrigger.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSDetectorControl.h
SUMO_ATTR_LENGTH
@ SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:393
NLTriggerBuilder::parseAndBeginParkingArea
void parseAndBeginParkingArea(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a parking area.
Definition: NLTriggerBuilder.cpp:228
NLTriggerBuilder::beginParkingArea
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.
Definition: NLTriggerBuilder.cpp:446
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
NLTriggerBuilder::buildLaneSpeedTrigger
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Builds a lane speed trigger.
Definition: NLTriggerBuilder.cpp:389
OptionsCont.h
MSRouteProbe
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:60
SUMOSAXAttributes::get
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
Definition: SUMOSAXAttributes.h:492
NLTriggerBuilder::addAccess
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
Definition: NLTriggerBuilder.cpp:202
MSNet::getBeginOfTimestepEvents
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:429
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
MSCalibrator.h
WrappingCommand.h
FileHelpers::getConfigurationRelative
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:115
SUMO_ATTR_OFF
@ SUMO_ATTR_OFF
Definition: SUMOXMLDefinitions.h:764
SUMO_ATTR_Z
@ SUMO_ATTR_Z
Definition: SUMOXMLDefinitions.h:400
FileHelpers.h
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
NLTriggerBuilder::setHandler
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
Definition: NLTriggerBuilder.cpp:66
SUMO_ATTR_EDGE
@ SUMO_ATTR_EDGE
Definition: SUMOXMLDefinitions.h:423
NLTriggerBuilder::myCurrentStop
MSStoppingPlace * myCurrentStop
The currently parsed stop to add access points to.
Definition: NLTriggerBuilder.h:412
SUMO_ATTR_LINES
@ SUMO_ATTR_LINES
Definition: SUMOXMLDefinitions.h:776
WrappingCommand
A wrapper for a Command function.
Definition: WrappingCommand.h:51
MSStoppingPlace::addAccess
virtual bool addAccess(MSLane *lane, const double pos, const double length)
adds an access point to this stop
Definition: MSStoppingPlace.cpp:271
NLTriggerBuilder::buildStoppingPlace
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.
Definition: NLTriggerBuilder.cpp:434
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:90
METriggeredCalibrator
Calibrates the flow on a segment to a specified one.
Definition: METriggeredCalibrator.h:38
NLTriggerBuilder::myParkingArea
MSParkingArea * myParkingArea
definition of the currently parsed parking area
Definition: NLTriggerBuilder.h:410
MSChargingStation.h
MSLaneSpeedTrigger
Changes the speed allowed on a set of lanes.
Definition: MSLaneSpeedTrigger.h:53
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MSTriggeredRerouter
Reroutes vehicles passing an edge.
Definition: MSTriggeredRerouter.h:61
MSEdge.h
NLTriggerBuilder::parseAndAddLotEntry
void parseAndAddLotEntry(const SUMOSAXAttributes &attrs)
Parses his values and adds a lot entry to current parking area.
Definition: NLTriggerBuilder.cpp:258
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
SUMO_ATTR_ROUTEPROBE
@ SUMO_ATTR_ROUTEPROBE
Definition: SUMOXMLDefinitions.h:670
SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
SUMOSAXAttributes::getSUMOTimeReporting
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Definition: SUMOSAXAttributes.cpp:63
SUMO_ATTR_CHARGEINTRANSIT
@ SUMO_ATTR_CHARGEINTRANSIT
Allow/disallow charge in transit in Charging Stations.
Definition: SUMOXMLDefinitions.h:473
MSEdge::getLength
double getLength() const
return the length of the edge
Definition: MSEdge.h:589
MSEdge::decVaporization
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:398
SUMO_ATTR_FILE
@ SUMO_ATTR_FILE
Definition: SUMOXMLDefinitions.h:664
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
SUMORouteHandler::checkStopPos
static StopPos checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
Definition: SUMORouteHandler.cpp:283
NLTriggerBuilder::getFileName
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
Definition: NLTriggerBuilder.cpp:510
SUMO_ATTR_BEGIN
@ SUMO_ATTR_BEGIN
weights: time range begin
Definition: SUMOXMLDefinitions.h:678
SUMO_ATTR_CHARGEDELAY
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations.
Definition: SUMOXMLDefinitions.h:475
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
NLTriggerBuilder::parseAndBuildStoppingPlace
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
Definition: NLTriggerBuilder.cpp:174
NLHandler.h
SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_CHARGINGPOWER
Definition: SUMOXMLDefinitions.h:469
SUMO_ATTR_PROB
@ SUMO_ATTR_PROB
Definition: SUMOXMLDefinitions.h:629
SUMO_ATTR_STARTPOS
@ SUMO_ATTR_STARTPOS
Definition: SUMOXMLDefinitions.h:797
SUMO_TAG_CHARGING_STATION
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
Definition: SUMOXMLDefinitions.h:111
NLTriggerBuilder::parseAndBuildLaneSpeedTrigger
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
Definition: NLTriggerBuilder.cpp:109
NLTriggerBuilder::getLane
MSLane * getLane(const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid)
Returns the lane defined by attribute "lane".
Definition: NLTriggerBuilder.cpp:531
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
SUMO_TAG_VSS
@ SUMO_TAG_VSS
A variable speed sign.
Definition: SUMOXMLDefinitions.h:89
MSDetectorControl::getTypedDetectors
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
Definition: MSDetectorControl.cpp:103
SUMOSAXAttributes::getOptStringVector
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<>
Definition: SUMOSAXAttributes.cpp:123
MSEdge::dictionary
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....
Definition: MSEdge.cpp:765
SUMO_ATTR_WIDTH
@ SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:386
NLTriggerBuilder::buildMECalibrator
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
Definition: NLTriggerBuilder.cpp:397
SUMO_ATTR_EDGES
@ SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
SUMO_TAG_PARKING_AREA
@ SUMO_TAG_PARKING_AREA
A parking area.
Definition: SUMOXMLDefinitions.h:107
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:540
ProcessError
Definition: UtilExceptions.h:39
MSNet::addStoppingPlace
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
Definition: MSNet.cpp:905
SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_PERSON_CAPACITY
Definition: SUMOXMLDefinitions.h:649
MSGlobals.h
UtilExceptions.h
SUMO_ATTR_Y
@ SUMO_ATTR_Y
Definition: SUMOXMLDefinitions.h:399
MSChargingStation
Definition: MSChargingStation.h:50
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSParkingArea::parkOnRoad
bool parkOnRoad() const
whether vehicles park on the road
Definition: MSParkingArea.h:92
SUMO_TAG_REROUTER
@ SUMO_TAG_REROUTER
A rerouter.
Definition: SUMOXMLDefinitions.h:95
SUMOSAXAttributes::getOpt
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.
Definition: SUMOSAXAttributes.h:518
MSParkingArea.h
NLTriggerBuilder::getCurrentStop
MSStoppingPlace * getCurrentStop()
Definition: NLTriggerBuilder.cpp:575
MSParkingArea::addLotEntry
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
Definition: MSParkingArea.cpp:98
NLTriggerBuilder::endStoppingPlace
virtual void endStoppingPlace()
End a stopping place.
Definition: NLTriggerBuilder.cpp:489
SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_FRIENDLY_POS
Definition: SUMOXMLDefinitions.h:765
string2time
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:44
MSParkingArea::getLength
double getLength() const
Returns the lot rectangle length.
Definition: MSParkingArea.cpp:336
NLTriggerBuilder.h
MSLane::allowsVehicleClass
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: MSLane.h:805
SUMO_ATTR_FREQUENCY
@ SUMO_ATTR_FREQUENCY
Definition: SUMOXMLDefinitions.h:662
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
MSEdge::incVaporization
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:391
SUMO_ATTR_LANES
@ SUMO_ATTR_LANES
Definition: SUMOXMLDefinitions.h:638
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
NLTriggerBuilder::buildCalibrator
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
Definition: NLTriggerBuilder.cpp:410
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
NLTriggerBuilder::addLotEntry
void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to current parking area.
Definition: NLTriggerBuilder.cpp:464
MSParkingArea::getWidth
double getWidth() const
Returns the lot rectangle width.
Definition: MSParkingArea.cpp:330
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
SUMO_ATTR_ROADSIDE_CAPACITY
@ SUMO_ATTR_ROADSIDE_CAPACITY
Definition: SUMOXMLDefinitions.h:772
SUMOSAXAttributes::getOptSUMOTimeReporting
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.
Definition: SUMOSAXAttributes.cpp:90
MSGlobals::gMesoNet
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:105
NLTriggerBuilder::NLTriggerBuilder
NLTriggerBuilder()
Constructor.
Definition: NLTriggerBuilder.cpp:59
SUMO_ATTR_HALTING_TIME_THRESHOLD
@ SUMO_ATTR_HALTING_TIME_THRESHOLD
Definition: SUMOXMLDefinitions.h:750
SUMO_ATTR_OUTPUT
@ SUMO_ATTR_OUTPUT
Definition: SUMOXMLDefinitions.h:788
NLTriggerBuilder::getPosition
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
Definition: NLTriggerBuilder.cpp:545
SUMO_ATTR_VTYPES
@ SUMO_ATTR_VTYPES
Definition: SUMOXMLDefinitions.h:632
InvalidArgument
Definition: UtilExceptions.h:56
MSTriggeredRerouter.h
Command
Base (microsim) event class.
Definition: Command.h:52
NamedObjectCont::get
T get(const std::string &id) const
Retrieves an item.
Definition: NamedObjectCont.h:98
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:74
MSRouteProbe.h
SUMO_ATTR_EFFICIENCY
@ SUMO_ATTR_EFFICIENCY
Eficiency of the charge in Charging Stations.
Definition: SUMOXMLDefinitions.h:471
SUMO_ATTR_ONROAD
@ SUMO_ATTR_ONROAD
Definition: SUMOXMLDefinitions.h:773
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
FileHelpers::isAbsolute
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
Definition: FileHelpers.cpp:129
SUMO_TAG_ROUTEPROBE
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
Definition: SUMOXMLDefinitions.h:115
NLTriggerBuilder::buildRerouter
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
Definition: NLTriggerBuilder.cpp:424
NLTriggerBuilder::myHandler
NLHandler * myHandler
The parent handler to set for subhandlers.
Definition: NLTriggerBuilder.h:408
NLTriggerBuilder::parseAndBuildChargingStation
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
Definition: NLTriggerBuilder.cpp:146
NLHandler
The XML-Handler for network loading.
Definition: NLHandler.h:80
NLTriggerBuilder::endParkingArea
virtual void endParkingArea()
End a parking area.
Definition: NLTriggerBuilder.cpp:479
config.h
StringTokenizer.h
SUMO_ATTR_END
@ SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
NLTriggerBuilder::parseAndBuildRerouter
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
Definition: NLTriggerBuilder.cpp:344
MELoop.h
MSStoppingPlace::getPersonsAbreast
int getPersonsAbreast() const
Definition: MSStoppingPlace.cpp:138
MSEventControl.h
MSLane.h
SUMO_ATTR_NAME
@ SUMO_ATTR_NAME
Definition: SUMOXMLDefinitions.h:380
NLTriggerBuilder::~NLTriggerBuilder
virtual ~NLTriggerBuilder()
Destructor.
Definition: NLTriggerBuilder.cpp:63
MSCalibrator
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:50
MSParkingArea::getAngle
double getAngle() const
Returns the lot rectangle angle.
Definition: MSParkingArea.cpp:342
NLTriggerBuilder::buildVaporizer
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
Definition: NLTriggerBuilder.cpp:72
SUMO_TAG_CALIBRATOR
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
Definition: SUMOXMLDefinitions.h:91
NLTriggerBuilder::buildChargingStation
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.
Definition: NLTriggerBuilder.cpp:499
MSStoppingPlace.h
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
SUMO_ATTR_X
@ SUMO_ATTR_X
Definition: SUMOXMLDefinitions.h:398
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
SUMOXMLDefinitions.h
NLTriggerBuilder::parseAndBuildCalibrator
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
Definition: NLTriggerBuilder.cpp:283
XMLSubSys.h