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