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-2018 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 /****************************************************************************/
20 // Builds detectors for microsim
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <iostream>
31 #include <microsim/MSNet.h>
32 #include <microsim/MSLane.h>
33 #include <microsim/MSEdge.h>
36 // #include <microsim/output/MSMultiLaneE2Collector.h>
44 #include <microsim/MSGlobals.h>
52 #include "NLDetectorBuilder.h"
54 
55 #include <mesosim/MEInductLoop.h>
56 #include <mesosim/MELoop.h>
57 #include <mesosim/MESegment.h>
58 
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
63 /* -------------------------------------------------------------------------
64  * NLDetectorBuilder::E3DetectorDefinition-methods
65  * ----------------------------------------------------------------------- */
67  const std::string& device, double haltingSpeedThreshold,
68  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
69  const std::string& vTypes, bool openEntry) :
70  myID(id), myDevice(device),
71  myHaltingSpeedThreshold(haltingSpeedThreshold),
72  myHaltingTimeThreshold(haltingTimeThreshold),
73  mySampleInterval(splInterval),
74  myVehicleTypes(vTypes),
75  myOpenEntry(openEntry) {
76 }
77 
78 
80 
81 
82 /* -------------------------------------------------------------------------
83  * NLDetectorBuilder-methods
84  * ----------------------------------------------------------------------- */
86  : myNet(net), myE3Definition(nullptr) {}
87 
88 
90  delete myE3Definition;
91 }
92 
93 
94 void
95 NLDetectorBuilder::buildInductLoop(const std::string& id,
96  const std::string& lane, double pos, SUMOTime splInterval,
97  const std::string& device, bool friendlyPos,
98  const std::string& vTypes) {
99  checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id);
100  // get and check the lane
101  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E1DETECTOR, id);
102  // get and check the position
103  pos = getPositionChecking(pos, clane, friendlyPos, id);
104  // build the loop
105  MSDetectorFileOutput* loop = createInductLoop(id, clane, pos, vTypes);
106  // add the file output
107  myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval);
108 }
109 
110 
111 void
113  const std::string& lane, double pos,
114  const std::string& device, bool friendlyPos,
115  const std::string& vTypes) {
116  // get and check the lane
118  // get and check the position
119  pos = getPositionChecking(pos, clane, friendlyPos, id);
120  // build the loop
121  MSDetectorFileOutput* loop = createInstantInductLoop(id, clane, pos, device, vTypes);
122  // add the file output
124 }
125 
126 
127 void
128 NLDetectorBuilder::buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
129  const std::string& device, SUMOTime frequency,
130  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
131  const std::string& vTypes, bool friendlyPos, bool showDetector,
133 
134  bool tlsGiven = tlls != nullptr;
135  bool toLaneGiven = toLane != nullptr;
136  bool posGiven = pos != std::numeric_limits<double>::max();
137  bool endPosGiven = endPos != std::numeric_limits<double>::max();
138 
139  assert(posGiven || endPosGiven);
140 
141  // Check positioning
142  if (posGiven) {
143  if (pos >= lane->getLength() || (pos < 0 && -pos > lane->getLength())) {
144  std::stringstream ss;
145  ss << "The given position (=" << pos << ") for detector '" << id
146  << "' does not lie on the given lane '" << lane->getID()
147  << "' with length " << lane->getLength();
148  if (friendlyPos) {
149  double newPos = pos > 0 ? lane->getLength() - POSITION_EPS : 0.;
150  ss << " (adjusting to new position " << newPos;
151  WRITE_WARNING(ss.str());
152  pos = newPos;
153  } else {
154  ss << " (0 <= pos < lane->getLength() is required)";
155  throw InvalidArgument(ss.str());
156  }
157  }
158  }
159  if (endPosGiven) {
160  if (endPos > lane->getLength() || (endPos <= 0 && -endPos >= lane->getLength())) {
161  std::stringstream ss;
162  ss << "The given end position (=" << endPos << ") for detector '" << id
163  << "' does not lie on the given lane '" << lane->getID()
164  << "' with length " << lane->getLength();
165  if (friendlyPos) {
166  double newEndPos = endPos > 0 ? lane->getLength() : POSITION_EPS;
167  ss << " (adjusting to new position " << newEndPos;
168  WRITE_WARNING(ss.str());
169  pos = newEndPos;
170  } else {
171  std::stringstream ss;
172  ss << " (0 <= pos < lane->getLength() is required)";
173  throw InvalidArgument(ss.str());
174  }
175  }
176  }
177 
178  MSE2Collector* det = nullptr;
179  if (tlsGiven) {
180  // Detector connected to TLS
181  det = createE2Detector(id, DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
183  // add the file output (XXX: Where's the corresponding delete?)
184  if (toLaneGiven) {
185  // Detector also associated to specific link
186  MSLane* lastLane = det->getLastLane();
187  MSLink* link = MSLinkContHelper::getConnectingLink(*lastLane, *toLane);
188  if (link == nullptr) {
189  throw InvalidArgument(
190  "The detector '" + id + "' cannot be build as no connection between lanes '"
191  + lastLane->getID() + "' and '" + toLane->getID() + "' exists.");
192  }
194  } else {
195  // detector for tls but without specific link
197  }
198  } else {
199  // User specified detector for xml-output
201  det = createE2Detector(id, DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
202  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, frequency);
203  }
204 
205 }
206 
207 void
208 NLDetectorBuilder::buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
209  const std::string& device, SUMOTime frequency,
210  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
211  const std::string& vTypes, bool friendlyPos, bool showDetector,
213 
214  bool tlsGiven = tlls != nullptr;
215  bool toLaneGiven = toLane != nullptr;
216  assert(pos != std::numeric_limits<double>::max());
217  assert(endPos != std::numeric_limits<double>::max());
218  assert(lanes.size() != 0);
219 
220  MSLane* firstLane = lanes[0];
221  MSLane* lastLane = lanes[lanes.size() - 1];
222 
223  // Check positioning
224  if (pos >= firstLane->getLength() || (pos < 0 && -pos > firstLane->getLength())) {
225  std::stringstream ss;
226  ss << "The given position (=" << pos << ") for detector '" << id
227  << "' does not lie on the given lane '" << firstLane->getID()
228  << "' with length " << firstLane->getLength();
229  if (friendlyPos) {
230  double newPos = pos > 0 ? firstLane->getLength() - POSITION_EPS : 0.;
231  ss << " (adjusting to new position " << newPos;
232  WRITE_WARNING(ss.str());
233  pos = newPos;
234  } else {
235  ss << " (0 <= pos < lane->getLength() is required)";
236  throw InvalidArgument(ss.str());
237  }
238  }
239  if (endPos > lastLane->getLength() || (endPos <= 0 && -endPos >= lastLane->getLength())) {
240  std::stringstream ss;
241  ss << "The given end position (=" << endPos << ") for detector '" << id
242  << "' does not lie on the given lane '" << lastLane->getID()
243  << "' with length " << lastLane->getLength();
244  if (friendlyPos) {
245  double newEndPos = endPos > 0 ? lastLane->getLength() : POSITION_EPS;
246  ss << " (adjusting to new position " << newEndPos;
247  WRITE_WARNING(ss.str());
248  pos = newEndPos;
249  } else {
250  ss << " (0 <= pos < lane->getLength() is required)";
251  throw InvalidArgument(ss.str());
252  }
253  }
254 
255  MSE2Collector* det = nullptr;
256  if (tlsGiven) {
257  // Detector connected to TLS
258  det = createE2Detector(id, DU_USER_DEFINED, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
260  // add the file output (XXX: Where's the corresponding delete?)
261  if (toLaneGiven) {
262  // Detector also associated to specific link
263  MSLane* lastLane = det->getLastLane();
264  MSLink* link = MSLinkContHelper::getConnectingLink(*lastLane, *toLane);
265  if (link == nullptr) {
266  throw InvalidArgument(
267  "The detector '" + id + "' cannot be build as no connection between lanes '"
268  + lastLane->getID() + "' and '" + toLane->getID() + "' exists.");
269  }
271  } else {
272  // detector for tls but without specific link
274  }
275  } else {
276  // User specified detector for xml-output
278 
279  det = createE2Detector(id, DU_USER_DEFINED, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
280  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, frequency);
281  }
282 
283 }
284 
285 
286 
287 void
289  const std::string& device, SUMOTime splInterval,
290  double haltingSpeedThreshold,
291  SUMOTime haltingTimeThreshold,
292  const std::string& vTypes, bool openEntry) {
293  checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id);
294  myE3Definition = new E3DetectorDefinition(id, device, haltingSpeedThreshold, haltingTimeThreshold, splInterval, vTypes, openEntry);
295 }
296 
297 
298 void
299 NLDetectorBuilder::addE3Entry(const std::string& lane,
300  double pos, bool friendlyPos) {
301  if (myE3Definition == nullptr) {
302  return;
303  }
305  // get and check the position
306  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
307  // build and save the entry
308  myE3Definition->myEntries.push_back(MSCrossSection(clane, pos));
309 }
310 
311 
312 void
313 NLDetectorBuilder::addE3Exit(const std::string& lane,
314  double pos, bool friendlyPos) {
315  if (myE3Definition == nullptr) {
316  return;
317  }
319  // get and check the position
320  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
321  // build and save the exit
322  myE3Definition->myExits.push_back(MSCrossSection(clane, pos));
323 }
324 
325 
326 std::string
328  if (myE3Definition == nullptr) {
329  return "<unknown>";
330  }
331  return myE3Definition->myID;
332 }
333 
334 
335 void
337  if (myE3Definition == nullptr) {
338  return;
339  }
340  // If E3 own entry or exit detectors
341  if (myE3Definition->myEntries.size() > 0 || myE3Definition->myExits.size() > 0) {
342  // create E3 detector
347  // add to net
349  } else
350  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)")
351 
352  // clean up
353  delete myE3Definition;
354  myE3Definition = nullptr;
355 }
356 
357 
358 void
360  const std::string& vtype, SUMOTime frequency,
361  const std::string& device) {
363  new MSVTypeProbe(id, vtype, OutputDevice::getDevice(device), frequency);
364 }
365 
366 
367 void
368 NLDetectorBuilder::buildRouteProbe(const std::string& id, const std::string& edge,
369  SUMOTime frequency, SUMOTime begin,
370  const std::string& device,
371  const std::string& vTypes) {
374  MSRouteProbe* probe = new MSRouteProbe(id, e, id + "_" + toString(begin), id + "_" + toString(begin - frequency), vTypes);
375  // add the file output
376  myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin);
377 }
378 
381  MSLane* lane, double pos,
382  const std::string& vTypes, bool) {
384  return new MEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
385  }
386  return new MSInductLoop(id, lane, pos, vTypes);
387 }
388 
389 
392  MSLane* lane, double pos, const std::string& od,
393  const std::string& vTypes) {
394  return new MSInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
395 }
396 
397 
400  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
401  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
402  const std::string& vTypes, bool /* showDetector */) {
403  return new MSE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
404 }
405 
408  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
409  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
410  const std::string& vTypes, bool /* showDetector */) {
411  return new MSE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
412 }
413 
416  const CrossSectionVector& entries,
417  const CrossSectionVector& exits,
418  double haltingSpeedThreshold,
419  SUMOTime haltingTimeThreshold,
420  const std::string& vTypes,
421  bool openEntry) {
422  return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
423 }
424 
425 
426 double
427 NLDetectorBuilder::getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
428  const std::string& detid) {
429  // check whether it is given from the end
430  if (pos < 0) {
431  pos += lane->getLength();
432  }
433  // check whether it is on the lane
434  if (pos > lane->getLength()) {
435  if (friendlyPos) {
436  pos = lane->getLength();
437  } else {
438  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' end.");
439  }
440  }
441  if (pos < 0) {
442  if (friendlyPos) {
443  pos = 0.;
444  } else {
445  throw InvalidArgument("The position of detector '" + detid + "' lies before the lane's '" + lane->getID() + "' begin.");
446  }
447  }
448  return pos;
449 }
450 
451 
452 void
453 NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
454  SUMOTime begin, SUMOTime end, const std::string& type,
455  const bool useLanes, const bool withEmpty, const bool printDefaults,
456  const bool withInternal, const bool trackVehicles,
457  const double maxTravelTime, const double minSamples,
458  const double haltSpeed, const std::string& vTypes,
459  const std::string& device) {
460  if (begin < 0) {
461  throw InvalidArgument("Negative begin time for meandata dump '" + id + "'.");
462  }
463  if (end < 0) {
464  end = SUMOTime_MAX;
465  }
466  if (end <= begin) {
467  throw InvalidArgument("End before or at begin for meandata dump '" + id + "'.");
468  }
469  MSMeanData* det = nullptr;
470  if (type == "" || type == "performance" || type == "traffic") {
471  det = new MSMeanData_Net(id, begin, end, useLanes, withEmpty,
472  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vTypes);
473  } else if (type == "emissions" || type == "hbefa") {
474  if (type == "hbefa") {
475  WRITE_WARNING("The netstate type 'hbefa' is deprecated. Please use the type 'emissions' instead.");
476  }
477  det = new MSMeanData_Emissions(id, begin, end, useLanes, withEmpty,
478  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
479  } else if (type == "harmonoise") {
480  det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty,
481  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
482  } else if (type == "amitran") {
483  det = new MSMeanData_Amitran(id, begin, end, useLanes, withEmpty,
484  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vTypes);
485  } else {
486  throw InvalidArgument("Invalid type '" + type + "' for meandata dump '" + id + "'.");
487  }
488  if (det != nullptr) {
489  if (frequency < 0) {
490  frequency = end - begin;
491  }
492  MSNet::getInstance()->getDetectorControl().add(det, device, frequency, begin);
493  }
494 }
495 
496 
497 
498 
499 // ------ Value checking/adapting methods ------
500 MSEdge*
501 NLDetectorBuilder::getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
502  const std::string& detid) {
503  // get and check the lane
504  MSEdge* edge = MSEdge::dictionary(edgeID);
505  if (edge == nullptr) {
506  throw InvalidArgument("The lane with the id '" + edgeID + "' is not known (while building " + toString(type) + " '" + detid + "').");
507  }
508  return edge;
509 }
510 
511 
512 MSLane*
513 NLDetectorBuilder::getLaneChecking(const std::string& laneID, SumoXMLTag type,
514  const std::string& detid) {
515  // get and check the lane
516  MSLane* lane = MSLane::dictionary(laneID);
517  if (lane == nullptr) {
518  throw InvalidArgument("The lane with the id '" + laneID + "' is not known (while building " + toString(type) + " '" + detid + "').");
519  }
520  return lane;
521 }
522 
523 
524 void
525 NLDetectorBuilder::checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id) {
526  if (splInterval < 0) {
527  throw InvalidArgument("Negative sampling frequency (in " + toString(type) + " '" + id + "').");
528  }
529  if (splInterval == 0) {
530  throw InvalidArgument("Sampling frequency must not be zero (in " + toString(type) + " '" + id + "').");
531  }
532 }
533 
534 
535 /****************************************************************************/
536 
Data collector for edges/lanes.
Definition: MSMeanData.h:60
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:640
a routeprobe detector
long long int SUMOTime
Definition: SUMOTime.h:36
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:80
Network state mean data collector for edges/lanes.
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:61
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:165
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:514
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:788
const std::string & getID() const
Returns the id.
Definition: Named.h:78
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.
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.
void endE3Detector()
Builds of an e3 detector using collected values.
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes, bool openEntry)
Constructor.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
The simulated network and simulation perfomer.
Definition: MSNet.h:84
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:75
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.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
Writes positions of vehicles that have a certain (named) type.
Definition: MSVTypeProbe.h:53
An instantenous induction loop.
an e3 exit point
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:263
#define POSITION_EPS
Definition: config.h:172
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:379
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:1730
#define SUMOTime_MAX
Definition: SUMOTime.h:37
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.
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:106
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:58
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.
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:91
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
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:48
Base of value-generating classes (detectors)
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:64
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.