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