Eclipse SUMO - Simulation of Urban MObility
NLDetectorBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 detectors for microsim
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <iostream>
30 #include <microsim/MSNet.h>
31 #include <microsim/MSLane.h>
32 #include <microsim/MSEdge.h>
35 // #include <microsim/output/MSMultiLaneE2Collector.h>
43 #include <microsim/MSGlobals.h>
51 #include "NLDetectorBuilder.h"
53 
54 #include <mesosim/MEInductLoop.h>
55 #include <mesosim/MELoop.h>
56 #include <mesosim/MESegment.h>
57 
58 
59 // ===========================================================================
60 // method definitions
61 // ===========================================================================
62 /* -------------------------------------------------------------------------
63  * NLDetectorBuilder::E3DetectorDefinition-methods
64  * ----------------------------------------------------------------------- */
66  const std::string& device, double haltingSpeedThreshold,
67  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
68  const std::string& vTypes, bool openEntry) :
69  myID(id), myDevice(device),
70  myHaltingSpeedThreshold(haltingSpeedThreshold),
71  myHaltingTimeThreshold(haltingTimeThreshold),
72  mySampleInterval(splInterval),
73  myVehicleTypes(vTypes),
74  myOpenEntry(openEntry) {
75 }
76 
77 
79 
80 
81 /* -------------------------------------------------------------------------
82  * NLDetectorBuilder-methods
83  * ----------------------------------------------------------------------- */
85  : myNet(net), myE3Definition(nullptr) {}
86 
87 
89  delete myE3Definition;
90 }
91 
92 
93 void
94 NLDetectorBuilder::buildInductLoop(const std::string& id,
95  const std::string& lane, double pos, SUMOTime splInterval,
96  const std::string& device, bool friendlyPos,
97  const std::string& vTypes) {
98  checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id);
99  // get and check the lane
100  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E1DETECTOR, id);
101  // get and check the position
102  pos = getPositionChecking(pos, clane, friendlyPos, id);
103  // build the loop
104  MSDetectorFileOutput* loop = createInductLoop(id, clane, pos, vTypes);
105  // add the file output
106  myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval);
107 }
108 
109 
110 void
112  const std::string& lane, double pos,
113  const std::string& device, bool friendlyPos,
114  const std::string& vTypes) {
115  // get and check the lane
117  // get and check the position
118  pos = getPositionChecking(pos, clane, friendlyPos, id);
119  // build the loop
120  MSDetectorFileOutput* loop = createInstantInductLoop(id, clane, pos, device, vTypes);
121  // add the file output
123 }
124 
125 
126 void
127 NLDetectorBuilder::buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
128  const std::string& device, SUMOTime frequency,
129  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
130  const std::string& vTypes, bool friendlyPos, bool showDetector,
132 
133  bool tlsGiven = tlls != nullptr;
134  bool toLaneGiven = toLane != nullptr;
135  bool posGiven = pos != std::numeric_limits<double>::max();
136  bool endPosGiven = endPos != std::numeric_limits<double>::max();
137 
138  assert(posGiven || endPosGiven);
139 
140  // Check positioning
141  if (posGiven) {
142  if (pos >= lane->getLength() || (pos < 0 && -pos > lane->getLength())) {
143  std::stringstream ss;
144  ss << "The given position (=" << pos << ") for detector '" << id
145  << "' does not lie on the given lane '" << lane->getID()
146  << "' with length " << lane->getLength();
147  if (friendlyPos) {
148  double newPos = pos > 0 ? lane->getLength() - POSITION_EPS : 0.;
149  ss << " (adjusting to new position " << newPos;
150  WRITE_WARNING(ss.str());
151  pos = newPos;
152  } else {
153  ss << " (0 <= pos < lane->getLength() is required)";
154  throw InvalidArgument(ss.str());
155  }
156  }
157  }
158  if (endPosGiven) {
159  if (endPos > lane->getLength() || (endPos <= 0 && -endPos >= lane->getLength())) {
160  std::stringstream ss;
161  ss << "The given end position (=" << endPos << ") for detector '" << id
162  << "' does not lie on the given lane '" << lane->getID()
163  << "' with length " << lane->getLength();
164  if (friendlyPos) {
165  double newEndPos = endPos > 0 ? lane->getLength() : POSITION_EPS;
166  ss << " (adjusting to new position " << newEndPos;
167  WRITE_WARNING(ss.str());
168  pos = newEndPos;
169  } else {
170  ss << " (0 <= pos < lane->getLength() is required)";
171  throw InvalidArgument(ss.str());
172  }
173  }
174  }
175 
176  MSE2Collector* det = nullptr;
177  if (tlsGiven) {
178  // Detector connected to TLS
179  det = createE2Detector(id, DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
181  // add the file output (XXX: Where's the corresponding delete?)
182  if (toLaneGiven) {
183  // Detector also associated to specific link
184  MSLane* lastLane = det->getLastLane();
185  MSLink* link = MSLinkContHelper::getConnectingLink(*lastLane, *toLane);
186  if (link == nullptr) {
187  throw InvalidArgument(
188  "The detector '" + id + "' cannot be build as no connection between lanes '"
189  + lastLane->getID() + "' and '" + toLane->getID() + "' exists.");
190  }
192  } else {
193  // detector for tls but without specific link
195  }
196  } else {
197  // User specified detector for xml-output
199  det = createE2Detector(id, DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
200  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, frequency);
201  }
202 
203 }
204 
205 void
206 NLDetectorBuilder::buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
207  const std::string& device, SUMOTime frequency,
208  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
209  const std::string& vTypes, bool friendlyPos, bool showDetector,
211 
212  bool tlsGiven = tlls != nullptr;
213  bool toLaneGiven = toLane != nullptr;
214  assert(pos != std::numeric_limits<double>::max());
215  assert(endPos != std::numeric_limits<double>::max());
216  assert(lanes.size() != 0);
217 
218  const MSLane* const firstLane = lanes[0];
219  const MSLane* const lastLane = lanes.back();
220 
221  // Check positioning
222  if (pos >= firstLane->getLength() || (pos < 0 && -pos > firstLane->getLength())) {
223  std::stringstream ss;
224  ss << "The given position (=" << pos << ") for detector '" << id
225  << "' does not lie on the given lane '" << firstLane->getID()
226  << "' with length " << firstLane->getLength();
227  if (friendlyPos) {
228  double newPos = pos > 0 ? firstLane->getLength() - POSITION_EPS : 0.;
229  ss << " (adjusting to new position " << newPos;
230  WRITE_WARNING(ss.str());
231  pos = newPos;
232  } else {
233  ss << " (0 <= pos < lane->getLength() is required)";
234  throw InvalidArgument(ss.str());
235  }
236  }
237  if (endPos > lastLane->getLength() || (endPos <= 0 && -endPos >= lastLane->getLength())) {
238  std::stringstream ss;
239  ss << "The given end position (=" << endPos << ") for detector '" << id
240  << "' does not lie on the given lane '" << lastLane->getID()
241  << "' with length " << lastLane->getLength();
242  if (friendlyPos) {
243  double newEndPos = endPos > 0 ? lastLane->getLength() : POSITION_EPS;
244  ss << " (adjusting to new position " << newEndPos;
245  WRITE_WARNING(ss.str());
246  pos = newEndPos;
247  } else {
248  ss << " (0 <= pos < lane->getLength() is required)";
249  throw InvalidArgument(ss.str());
250  }
251  }
252 
253  MSE2Collector* det = nullptr;
254  if (tlsGiven) {
255  // Detector connected to TLS
256  det = createE2Detector(id, DU_USER_DEFINED, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
258  // add the file output (XXX: Where's the corresponding delete?)
259  if (toLaneGiven) {
260  // Detector also associated to specific link
261  const MSLane* const lastDetLane = det->getLastLane();
262  const MSLink* const link = MSLinkContHelper::getConnectingLink(*lastDetLane, *toLane);
263  if (link == nullptr) {
264  throw InvalidArgument(
265  "The detector '" + id + "' cannot be build as no connection between lanes '"
266  + lastDetLane->getID() + "' and '" + toLane->getID() + "' exists.");
267  }
269  } else {
270  // detector for tls but without specific link
272  }
273  } else {
274  // User specified detector for xml-output
276 
277  det = createE2Detector(id, DU_USER_DEFINED, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
278  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, frequency);
279  }
280 
281 }
282 
283 
284 
285 void
287  const std::string& device, SUMOTime splInterval,
288  double haltingSpeedThreshold,
289  SUMOTime haltingTimeThreshold,
290  const std::string& vTypes, bool openEntry) {
291  checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id);
292  myE3Definition = new E3DetectorDefinition(id, device, haltingSpeedThreshold, haltingTimeThreshold, splInterval, vTypes, openEntry);
293 }
294 
295 
296 void
297 NLDetectorBuilder::addE3Entry(const std::string& lane,
298  double pos, bool friendlyPos) {
299  if (myE3Definition == nullptr) {
300  return;
301  }
303  // get and check the position
304  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
305  // build and save the entry
306  myE3Definition->myEntries.push_back(MSCrossSection(clane, pos));
307 }
308 
309 
310 void
311 NLDetectorBuilder::addE3Exit(const std::string& lane,
312  double pos, bool friendlyPos) {
313  if (myE3Definition == nullptr) {
314  return;
315  }
317  // get and check the position
318  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
319  // build and save the exit
320  myE3Definition->myExits.push_back(MSCrossSection(clane, pos));
321 }
322 
323 
324 std::string
326  if (myE3Definition == nullptr) {
327  return "<unknown>";
328  }
329  return myE3Definition->myID;
330 }
331 
332 
333 void
335  if (myE3Definition == nullptr) {
336  return;
337  }
338  // If E3 own entry or exit detectors
339  if (myE3Definition->myEntries.size() > 0 || myE3Definition->myExits.size() > 0) {
340  // create E3 detector
345  // add to net
347  } else
348  WRITE_WARNING(toString(SUMO_TAG_E3DETECTOR) + " with id = '" + myE3Definition->myID + "' will not be created because is empty (no " + toString(SUMO_TAG_DET_ENTRY) + " or " + toString(SUMO_TAG_DET_EXIT) + " was defined)")
349 
350  // clean up
351  delete myE3Definition;
352  myE3Definition = nullptr;
353 }
354 
355 
356 void
358  const std::string& vtype, SUMOTime frequency,
359  const std::string& device) {
361  new MSVTypeProbe(id, vtype, OutputDevice::getDevice(device), frequency);
362 }
363 
364 
365 void
366 NLDetectorBuilder::buildRouteProbe(const std::string& id, const std::string& edge,
367  SUMOTime frequency, SUMOTime begin,
368  const std::string& device,
369  const std::string& vTypes) {
372  MSRouteProbe* probe = new MSRouteProbe(id, e, id + "_" + toString(begin), id + "_" + toString(begin - frequency), vTypes);
373  // add the file output
374  myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin);
375 }
376 
379  MSLane* lane, double pos,
380  const std::string& vTypes, bool) {
382  return new MEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
383  }
384  return new MSInductLoop(id, lane, pos, vTypes);
385 }
386 
387 
390  MSLane* lane, double pos, const std::string& od,
391  const std::string& vTypes) {
392  return new MSInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
393 }
394 
395 
398  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
399  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
400  const std::string& vTypes, bool /* showDetector */) {
401  return new MSE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
402 }
403 
406  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
407  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
408  const std::string& vTypes, bool /* showDetector */) {
409  return new MSE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
410 }
411 
414  const CrossSectionVector& entries,
415  const CrossSectionVector& exits,
416  double haltingSpeedThreshold,
417  SUMOTime haltingTimeThreshold,
418  const std::string& vTypes,
419  bool openEntry) {
420  return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
421 }
422 
423 
424 double
425 NLDetectorBuilder::getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
426  const std::string& detid) {
427  // check whether it is given from the end
428  if (pos < 0) {
429  pos += lane->getLength();
430  }
431  // check whether it is on the lane
432  if (pos > lane->getLength()) {
433  if (friendlyPos) {
434  pos = lane->getLength();
435  } else {
436  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' end.");
437  }
438  }
439  if (pos < 0) {
440  if (friendlyPos) {
441  pos = 0.;
442  } else {
443  throw InvalidArgument("The position of detector '" + detid + "' lies before the lane's '" + lane->getID() + "' begin.");
444  }
445  }
446  return pos;
447 }
448 
449 
450 void
451 NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
452  SUMOTime begin, SUMOTime end, const std::string& type,
453  const bool useLanes, const bool withEmpty, const bool printDefaults,
454  const bool withInternal, const bool trackVehicles, const int detectPersons,
455  const double maxTravelTime, const double minSamples,
456  const double haltSpeed, const std::string& vTypes,
457  const std::string& device) {
458  if (begin < 0) {
459  throw InvalidArgument("Negative begin time for meandata dump '" + id + "'.");
460  }
461  if (end < 0) {
462  end = SUMOTime_MAX;
463  }
464  if (end <= begin) {
465  throw InvalidArgument("End before or at begin for meandata dump '" + id + "'.");
466  }
467  checkStepLengthMultiple(begin, " for meandata dump '" + id + "'");
468  MSMeanData* det = nullptr;
469  if (type == "" || type == "performance" || type == "traffic") {
470  det = new MSMeanData_Net(id, begin, end, useLanes, withEmpty,
471  printDefaults, withInternal, trackVehicles, detectPersons, maxTravelTime, minSamples, haltSpeed, vTypes);
472  } else if (type == "emissions" || type == "hbefa") {
473  if (type == "hbefa") {
474  WRITE_WARNING("The netstate type 'hbefa' is deprecated. Please use the type 'emissions' instead.");
475  }
476  det = new MSMeanData_Emissions(id, begin, end, useLanes, withEmpty,
477  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
478  } else if (type == "harmonoise") {
479  det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty,
480  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
481  } else if (type == "amitran") {
482  det = new MSMeanData_Amitran(id, begin, end, useLanes, withEmpty,
483  printDefaults, withInternal, trackVehicles, detectPersons, maxTravelTime, minSamples, haltSpeed, vTypes);
484  } else {
485  throw InvalidArgument("Invalid type '" + type + "' for meandata dump '" + id + "'.");
486  }
487  if (det != nullptr) {
488  if (frequency < 0) {
489  frequency = end - begin;
490  } else {
491  checkStepLengthMultiple(frequency, " for meandata dump '" + id + "'");
492  }
493  MSNet::getInstance()->getDetectorControl().add(det, device, frequency, begin);
494  }
495 }
496 
497 
498 
499 
500 // ------ Value checking/adapting methods ------
501 MSEdge*
502 NLDetectorBuilder::getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
503  const std::string& detid) {
504  // get and check the lane
505  MSEdge* edge = MSEdge::dictionary(edgeID);
506  if (edge == nullptr) {
507  throw InvalidArgument("The lane with the id '" + edgeID + "' is not known (while building " + toString(type) + " '" + detid + "').");
508  }
509  return edge;
510 }
511 
512 
513 MSLane*
514 NLDetectorBuilder::getLaneChecking(const std::string& laneID, SumoXMLTag type,
515  const std::string& detid) {
516  // get and check the lane
517  MSLane* lane = MSLane::dictionary(laneID);
518  if (lane == nullptr) {
519  throw InvalidArgument("The lane with the id '" + laneID + "' is not known (while building " + toString(type) + " '" + detid + "').");
520  }
521  return lane;
522 }
523 
524 
525 void
526 NLDetectorBuilder::checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id) {
527  if (splInterval < 0) {
528  throw InvalidArgument("Negative sampling frequency (in " + toString(type) + " '" + id + "').");
529  }
530  if (splInterval == 0) {
531  throw InvalidArgument("Sampling frequency must not be zero (in " + toString(type) + " '" + id + "').");
532  }
533  checkStepLengthMultiple(splInterval, " (in " + toString(type) + " '" + id + "')");
534 }
535 
536 
537 /****************************************************************************/
NLDetectorBuilder::createE2Detector
virtual MSE2Collector * createE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, double pos, double endPos, double length, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes, bool showDetector=true)
Creates a MSE2Collector instance, overridden by GUIE2Collector::createE2Detector()
Definition: NLDetectorBuilder.cpp:397
NLDetectorBuilder::E3DetectorDefinition::myHaltingTimeThreshold
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.
Definition: NLDetectorBuilder.h:397
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1866
NLDetectorBuilder::getLaneChecking
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
Definition: NLDetectorBuilder.cpp:514
MSNet::getDetectorControl
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:399
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
MSMeanData_Amitran.h
MSNet.h
MSDetectorFileOutput
Base of value-generating classes (detectors)
Definition: MSDetectorFileOutput.h:63
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
NLDetectorBuilder::getPositionChecking
double getPositionChecking(double pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
Definition: NLDetectorBuilder.cpp:425
MSDetectorControl.h
NLDetectorBuilder::E3DetectorDefinition::myEntries
CrossSectionVector myEntries
List of detector's entries.
Definition: NLDetectorBuilder.h:399
MSE3Collector
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:60
NLDetectorBuilder::buildInductLoop
void buildInductLoop(const std::string &id, const std::string &lane, double pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an e1 detector and adds it to the net.
Definition: NLDetectorBuilder.cpp:94
MSInstantInductLoop.h
MSMeanData_Emissions.h
NLDetectorBuilder::addE3Entry
void addE3Entry(const std::string &lane, double pos, bool friendlyPos)
Builds an entry point of an e3 detector.
Definition: NLDetectorBuilder.cpp:297
NLDetectorBuilder::createInductLoop
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
Definition: NLDetectorBuilder.cpp:378
MSMeanData_Harmonoise
Noise data collector for edges/lanes.
Definition: MSMeanData_Harmonoise.h:52
NLDetectorBuilder::getEdgeChecking
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
Definition: NLDetectorBuilder.cpp:502
MSRouteProbe
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:60
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
MEInductLoop.h
NLDetectorBuilder::E3DetectorDefinition::E3DetectorDefinition
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes, bool openEntry)
Constructor.
Definition: NLDetectorBuilder.cpp:65
NLDetectorBuilder::E3DetectorDefinition::myID
const std::string myID
The id of the detector.
Definition: NLDetectorBuilder.h:391
SUMO_TAG_LANE_AREA_DETECTOR
@ SUMO_TAG_LANE_AREA_DETECTOR
alternative tag for e2 detector
Definition: SUMOXMLDefinitions.h:71
FileHelpers.h
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
NLDetectorBuilder::E3DetectorDefinition
Holds the incoming definitions of an e3 detector unless the detector is build.
Definition: NLDetectorBuilder.h:373
MEInductLoop
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:47
MSInductLoop
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:64
MSE2Collector
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:81
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:90
MSCrossSection
A simple description of a position on a lane (crossing of a lane)
Definition: MSCrossSection.h:43
SUMO_TAG_DET_ENTRY
@ SUMO_TAG_DET_ENTRY
an e3 entry point
Definition: SUMOXMLDefinitions.h:81
MSEdge.h
MSVTypeProbe.h
MSE2Collector.h
NLDetectorBuilder::E3DetectorDefinition::mySampleInterval
SUMOTime mySampleInterval
The aggregation interval.
Definition: NLDetectorBuilder.h:403
MSMeanData_Net.h
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
DU_USER_DEFINED
@ DU_USER_DEFINED
Definition: MSDetectorFileOutput.h:51
Command_SaveTLCoupledLaneDet
Writes e2 state of a link for the time the link has yellow/red.
Definition: Command_SaveTLCoupledLaneDet.h:40
MESegment.h
NLDetectorBuilder::createEdgeLaneMeanData
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
Definition: NLDetectorBuilder.cpp:451
MSMeanData
Data collector for edges/lanes.
Definition: MSMeanData.h:59
MSMeanData_Emissions
Emission data collector for edges/lanes.
Definition: MSMeanData_Emissions.h:55
NLDetectorBuilder::E3DetectorDefinition::myExits
CrossSectionVector myExits
List of detector's exits.
Definition: NLDetectorBuilder.h:401
Command_SaveTLCoupledDet
Writes e2 state on each tls switch.
Definition: Command_SaveTLCoupledDet.h:48
MSMeanData_Amitran
Network state mean data collector for edges/lanes.
Definition: MSMeanData_Amitran.h:56
Command_SaveTLCoupledLaneDet.h
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
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
NLDetectorBuilder::myNet
MSNet & myNet
The net to fill.
Definition: NLDetectorBuilder.h:477
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:540
NLDetectorBuilder.h
NLDetectorBuilder::E3DetectorDefinition::myVehicleTypes
const std::string myVehicleTypes
The device the detector shall use.
Definition: NLDetectorBuilder.h:405
MSGlobals.h
UtilExceptions.h
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
NLDetectorBuilder::buildInstantInductLoop
void buildInstantInductLoop(const std::string &id, const std::string &lane, double pos, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an instantenous induction and adds it to the net.
Definition: NLDetectorBuilder.cpp:111
MSMeanData_Harmonoise.h
MSMeanData_Net
Network state mean data collector for edges/lanes.
Definition: MSMeanData_Net.h:57
MSInstantInductLoop
An instantaneous induction loop.
Definition: MSInstantInductLoop.h:54
Command_SaveTLCoupledDet.h
NLDetectorBuilder::beginE3Detector
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Stores temporary the initial information about an e3 detector to build.
Definition: NLDetectorBuilder.cpp:286
NLDetectorBuilder::endE3Detector
void endE3Detector()
Builds of an e3 detector using collected values.
Definition: NLDetectorBuilder.cpp:334
DetectorUsage
DetectorUsage
Definition: MSDetectorFileOutput.h:50
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
NLDetectorBuilder::buildE2Detector
void buildE2Detector(const std::string &id, MSLane *lane, double pos, double endPos, double length, const std::string &device, SUMOTime frequency, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes, bool friendlyPos, bool showDetector, MSTLLogicControl::TLSLogicVariants *tlls=0, MSLane *toLane=0)
Builds a new E2 detector and adds it to the net's detector control. Also performs some consistency ch...
Definition: NLDetectorBuilder.cpp:127
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
StringUtils.h
SUMO_TAG_ENTRY_EXIT_DETECTOR
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
Definition: SUMOXMLDefinitions.h:75
NLDetectorBuilder::E3DetectorDefinition::~E3DetectorDefinition
~E3DetectorDefinition()
Destructor.
Definition: NLDetectorBuilder.cpp:78
OutputDevice::getDevice
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
Definition: OutputDevice.cpp:54
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
MSGlobals::gMesoNet
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:105
InvalidArgument
Definition: UtilExceptions.h:56
NLDetectorBuilder::~NLDetectorBuilder
virtual ~NLDetectorBuilder()
Destructor.
Definition: NLDetectorBuilder.cpp:88
NLDetectorBuilder::myE3Definition
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
Definition: NLDetectorBuilder.h:482
NLDetectorBuilder::E3DetectorDefinition::myOpenEntry
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
Definition: NLDetectorBuilder.h:407
MSE2Collector::getLastLane
MSLane * getLastLane() const
Returns the id of the detector's last lane.
Definition: MSE2Collector.h:395
MSRouteProbe.h
NLDetectorBuilder::getCurrentE3ID
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
Definition: NLDetectorBuilder.cpp:325
NLDetectorBuilder::NLDetectorBuilder
NLDetectorBuilder(MSNet &net)
Constructor.
Definition: NLDetectorBuilder.cpp:84
NLDetectorBuilder::E3DetectorDefinition::myHaltingSpeedThreshold
double myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
Definition: NLDetectorBuilder.h:395
checkStepLengthMultiple
bool checkStepLengthMultiple(const SUMOTime t, const std::string &error)
Definition: SUMOTime.cpp:108
NLDetectorBuilder::createInstantInductLoop
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &od, const std::string &vTypes)
Creates an instance of an e1 detector using the given values.
Definition: NLDetectorBuilder.cpp:389
SUMO_TAG_ROUTEPROBE
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
Definition: SUMOXMLDefinitions.h:115
MSTLLogicControl::TLSLogicVariants
Storage for all programs of a single tls.
Definition: MSTLLogicControl.h:85
SUMO_TAG_E3DETECTOR
@ SUMO_TAG_E3DETECTOR
an e3 detector
Definition: SUMOXMLDefinitions.h:73
MSDetectorControl::add
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, SUMOTime splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
Definition: MSDetectorControl.cpp:63
config.h
NLDetectorBuilder::buildVTypeProbe
void buildVTypeProbe(const std::string &id, const std::string &vtype, SUMOTime frequency, const std::string &device)
Builds a vTypeProbe and adds it to the net.
Definition: NLDetectorBuilder.cpp:357
StringTokenizer.h
MELoop.h
NLDetectorBuilder::checkSampleInterval
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
Definition: NLDetectorBuilder.cpp:526
NLDetectorBuilder::addE3Exit
void addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
Definition: NLDetectorBuilder.cpp:311
SUMOTime_MAX
#define SUMOTime_MAX
Definition: SUMOTime.h:35
MSLane.h
SUMO_TAG_INDUCTION_LOOP
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
Definition: SUMOXMLDefinitions.h:65
MSInductLoop.h
NLDetectorBuilder::createE3Detector
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Creates an instance of an e3 detector using the given values.
Definition: NLDetectorBuilder.cpp:413
SUMO_TAG_E1DETECTOR
@ SUMO_TAG_E1DETECTOR
an e1 detector
Definition: SUMOXMLDefinitions.h:63
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
SUMO_TAG_E2DETECTOR
@ SUMO_TAG_E2DETECTOR
an e2 detector
Definition: SUMOXMLDefinitions.h:67
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
SUMO_TAG_DET_EXIT
@ SUMO_TAG_DET_EXIT
an e3 exit point
Definition: SUMOXMLDefinitions.h:83
CrossSectionVector
std::vector< MSCrossSection > CrossSectionVector
Definition: MSCrossSection.h:63
NLDetectorBuilder::buildRouteProbe
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device, const std::string &vTypes)
Builds a routeProbe and adds it to the net.
Definition: NLDetectorBuilder.cpp:366
NLDetectorBuilder::E3DetectorDefinition::myDevice
const std::string myDevice
The device the detector shall use.
Definition: NLDetectorBuilder.h:393
SUMO_TAG_INSTANT_INDUCTION_LOOP
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
Definition: SUMOXMLDefinitions.h:87
SUMO_TAG_VTYPEPROBE
@ SUMO_TAG_VTYPEPROBE
a vtypeprobe detector
Definition: SUMOXMLDefinitions.h:113
MSVTypeProbe
Writes positions of vehicles that have a certain (named) type.
Definition: MSVTypeProbe.h:52