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-2016 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>
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 #ifdef CHECK_MEMORY_LEAKS
67 #include <foreign/nvwa/debug_new.h>
68 #endif // CHECK_MEMORY_LEAKS
69 
70 
71 // ===========================================================================
72 // method definitions
73 // ===========================================================================
74 /* -------------------------------------------------------------------------
75  * NLDetectorBuilder::E3DetectorDefinition-methods
76  * ----------------------------------------------------------------------- */
78  const std::string& device, SUMOReal haltingSpeedThreshold,
79  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
80  const std::string& vTypes)
81  : myID(id), myDevice(device),
82  myHaltingSpeedThreshold(haltingSpeedThreshold),
83  myHaltingTimeThreshold(haltingTimeThreshold),
84  mySampleInterval(splInterval),
85  myVehicleTypes(vTypes) {}
86 
87 
89 
90 
91 /* -------------------------------------------------------------------------
92  * NLDetectorBuilder-methods
93  * ----------------------------------------------------------------------- */
95  : myNet(net), myE3Definition(0) {}
96 
97 
99  delete myE3Definition;
100 }
101 
102 
103 void
105  const std::string& lane, SUMOReal pos, SUMOTime splInterval,
106  const std::string& device, bool friendlyPos,
107  const std::string& vTypes) {
108  checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id);
109  // get and check the lane
110  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E1DETECTOR, id);
111  // get and check the position
112  pos = getPositionChecking(pos, clane, friendlyPos, id);
113  // build the loop
114  MSDetectorFileOutput* loop = createInductLoop(id, clane, pos, vTypes);
115  // add the file output
116  myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval);
117 }
118 
119 
120 void
122  const std::string& lane, SUMOReal pos,
123  const std::string& device, bool friendlyPos,
124  const std::string& vTypes) {
125  // get and check the lane
127  // get and check the position
128  pos = getPositionChecking(pos, clane, friendlyPos, id);
129  // build the loop
130  MSDetectorFileOutput* loop = createInstantInductLoop(id, clane, pos, device, vTypes);
131  // add the file output
133 }
134 
135 
136 void
138  const std::string& lane, SUMOReal pos, SUMOReal length,
139  bool cont, SUMOTime splInterval,
140  const std::string& device,
141  SUMOTime haltingTimeThreshold,
142  SUMOReal haltingSpeedThreshold,
143  SUMOReal jamDistThreshold, bool friendlyPos,
144  const std::string& vTypes) {
145  checkSampleInterval(splInterval, SUMO_TAG_E2DETECTOR, id);
146  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
147  // check whether the detector may lie over more than one lane
148  MSDetectorFileOutput* det = 0;
149  if (!cont) {
150  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
151  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
152  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval);
153  } else {
154  convContE2PosLength(id, clane, pos, length, friendlyPos);
155  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
156  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval);
157  }
158 }
159 
160 
161 void
163  const std::string& lane, SUMOReal pos, SUMOReal length,
164  bool cont,
166  const std::string& device,
167  SUMOTime haltingTimeThreshold,
168  SUMOReal haltingSpeedThreshold,
169  SUMOReal jamDistThreshold, bool friendlyPos,
170  const std::string& vTypes) {
171  if (tlls.getActive() == 0) {
172  throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa.");
173  }
174  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
175  // check whether the detector may lie over more than one lane
176  MSDetectorFileOutput* det = 0;
177  if (!cont) {
178  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
179  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
181  } else {
182  convContE2PosLength(id, clane, pos, length, friendlyPos);
183  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
185  }
186  // add the file output
188 }
189 
190 
191 void
193  const std::string& lane, SUMOReal pos, SUMOReal length,
194  bool cont,
196  const std::string& tolane,
197  const std::string& device,
198  SUMOTime haltingTimeThreshold,
199  SUMOReal haltingSpeedThreshold,
200  SUMOReal jamDistThreshold, bool friendlyPos,
201  const std::string& vTypes) {
202  if (tlls.getActive() == 0) {
203  throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa.");
204  }
205  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
206  MSLane* ctoLane = getLaneChecking(tolane, SUMO_TAG_E2DETECTOR, id);
207  MSLink* link = MSLinkContHelper::getConnectingLink(*clane, *ctoLane);
208  if (link == 0) {
209  throw InvalidArgument(
210  "The detector output can not be build as no connection between lanes '"
211  + lane + "' and '" + tolane + "' exists.");
212  }
213  if (pos < 0) {
214  pos = -pos;
215  }
216  // check whether the detector may lie over more than one lane
217  MSDetectorFileOutput* det = 0;
218  if (!cont) {
219  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
220  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
222  } else {
223  convContE2PosLength(id, clane, pos, length, friendlyPos);
224  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
226  }
227  // add the file output
229 }
230 
231 
232 void
233 NLDetectorBuilder::convUncontE2PosLength(const std::string& id, MSLane* clane,
234  SUMOReal& pos, SUMOReal& length,
235  bool friendlyPos) {
236  // get and check the position
237  pos = getPositionChecking(pos, clane, friendlyPos, id);
238  // check length
239  if (length <= 0) {
240  if (friendlyPos) {
241  length = (SUMOReal) 0.1;
242  } else {
243  throw InvalidArgument("Invalid length for detector '" + id + "'.");
244  }
245  }
246  if (length + pos > clane->getLength()) {
247  if (friendlyPos) {
248  length = clane->getLength() - pos;
249  } else {
250  throw InvalidArgument("The length of detector '" + id + "' reaches beyond the lane's '" + clane->getID() + "' length.");
251  }
252  }
253 }
254 
255 
256 void
257 NLDetectorBuilder::convContE2PosLength(const std::string& id, MSLane* clane,
258  SUMOReal& pos, SUMOReal& /*length*/,
259  bool friendlyPos) {
260  // get and check the position
261  pos = getPositionChecking(pos, clane, friendlyPos, id);
262  // length will be kept as is
263 }
264 
265 
266 void
268  const std::string& device, SUMOTime splInterval,
269  SUMOReal haltingSpeedThreshold,
270  SUMOTime haltingTimeThreshold,
271  const std::string& vTypes) {
272  checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id);
273  myE3Definition = new E3DetectorDefinition(id, device, haltingSpeedThreshold, haltingTimeThreshold, splInterval, vTypes);
274 }
275 
276 
277 void
278 NLDetectorBuilder::addE3Entry(const std::string& lane,
279  SUMOReal pos, bool friendlyPos) {
280  if (myE3Definition == 0) {
281  return;
282  }
284  // get and check the position
285  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
286  // build and save the entry
287  myE3Definition->myEntries.push_back(MSCrossSection(clane, pos));
288 }
289 
290 
291 void
292 NLDetectorBuilder::addE3Exit(const std::string& lane,
293  SUMOReal pos, bool friendlyPos) {
294  if (myE3Definition == 0) {
295  return;
296  }
298  // get and check the position
299  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
300  // build and save the exit
301  myE3Definition->myExits.push_back(MSCrossSection(clane, pos));
302 }
303 
304 
305 std::string
307  if (myE3Definition == 0) {
308  return "<unknown>";
309  }
310  return myE3Definition->myID;
311 }
312 
313 
314 void
316  if (myE3Definition == 0) {
317  return;
318  }
319  // If E3 own entry or exit detectors
320  if (myE3Definition->myEntries.size() > 0 || myE3Definition->myExits.size() > 0) {
321  // create E3 detector
325  // add to net
327  } else
328  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)")
329 
330  // clean up
331  delete myE3Definition;
332  myE3Definition = 0;
333 }
334 
335 
336 void
338  const std::string& vtype, SUMOTime frequency,
339  const std::string& device) {
341  new MSVTypeProbe(id, vtype, OutputDevice::getDevice(device), frequency);
342 }
343 
344 
345 void
346 NLDetectorBuilder::buildRouteProbe(const std::string& id, const std::string& edge,
347  SUMOTime frequency, SUMOTime begin,
348  const std::string& device,
349  const std::string& vTypes) {
352  MSRouteProbe* probe = new MSRouteProbe(id, e, id + "_" + toString(begin), id + "_" + toString(begin - frequency), vTypes);
353  // add the file output
354  myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin);
355 }
356 
357 
358 // -------------------
361  DetectorUsage usage,
362  MSLane* lane, SUMOReal pos, SUMOReal length,
363  SUMOTime haltingTimeThreshold,
364  SUMOReal haltingSpeedThreshold,
365  SUMOReal jamDistThreshold,
366  const std::string& vTypes) {
367  return createSingleLaneE2Detector(id, usage, lane, pos,
368  length, haltingTimeThreshold, haltingSpeedThreshold,
369  jamDistThreshold, vTypes);
370 }
371 
372 
375  MSLane* lane, SUMOReal pos, SUMOReal length,
376  SUMOTime haltingTimeThreshold,
377  SUMOReal haltingSpeedThreshold,
378  SUMOReal jamDistThreshold,
379  const std::string& vTypes) {
381  lane, pos, haltingTimeThreshold, haltingSpeedThreshold,
382  jamDistThreshold, vTypes);
383  static_cast<MS_E2_ZS_CollectorOverLanes*>(ret)->init(lane, length);
384  return ret;
385 }
386 
387 
390  MSLane* lane, SUMOReal pos,
391  const std::string& vTypes, bool) {
393  return new MEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes);
394  }
395  return new MSInductLoop(id, lane, pos, vTypes);
396 }
397 
398 
401  MSLane* lane, SUMOReal pos, const std::string& od,
402  const std::string& vTypes) {
403  return new MSInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes);
404 }
405 
406 
409  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
410  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
411  const std::string& vTypes) {
412  return new MSE2Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
413 }
414 
415 
418  DetectorUsage usage, MSLane* lane, SUMOReal pos,
419  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
420  const std::string& vTypes) {
421  return new MS_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
422 }
423 
424 
427  const CrossSectionVector& entries,
428  const CrossSectionVector& exits,
429  SUMOReal haltingSpeedThreshold,
430  SUMOTime haltingTimeThreshold,
431  const std::string& vTypes) {
432  return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes);
433 }
434 
435 
436 SUMOReal
438  const std::string& detid) {
439  // check whether it is given from the end
440  if (pos < 0) {
441  pos += lane->getLength();
442  }
443  // check whether it is on the lane
444  if (pos > lane->getLength()) {
445  if (friendlyPos) {
446  pos = lane->getLength();
447  } else {
448  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' end.");
449  }
450  }
451  if (pos < 0) {
452  if (friendlyPos) {
453  pos = 0.;
454  } else {
455  throw InvalidArgument("The position of detector '" + detid + "' lies before the lane's '" + lane->getID() + "' begin.");
456  }
457  }
458  return pos;
459 }
460 
461 
462 void
463 NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
464  SUMOTime begin, SUMOTime end, const std::string& type,
465  const bool useLanes, const bool withEmpty, const bool printDefaults,
466  const bool withInternal, const bool trackVehicles,
467  const SUMOReal maxTravelTime, const SUMOReal minSamples,
468  const SUMOReal haltSpeed, const std::string& vTypes,
469  const std::string& device) {
470  if (begin < 0) {
471  throw InvalidArgument("Negative begin time for meandata dump '" + id + "'.");
472  }
473  if (end < 0) {
474  end = SUMOTime_MAX;
475  }
476  if (end <= begin) {
477  throw InvalidArgument("End before or at begin for meandata dump '" + id + "'.");
478  }
479  MSMeanData* det = 0;
480  if (type == "" || type == "performance" || type == "traffic") {
481  det = new MSMeanData_Net(id, begin, end, useLanes, withEmpty,
482  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vTypes);
483  } else if (type == "emissions" || type == "hbefa") {
484  if (type == "hbefa") {
485  WRITE_WARNING("The netstate type 'hbefa' is deprecated. Please use the type 'emissions' instead.");
486  }
487  det = new MSMeanData_Emissions(id, begin, end, useLanes, withEmpty,
488  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
489  } else if (type == "harmonoise") {
490  det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty,
491  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
492  } else if (type == "amitran") {
493  det = new MSMeanData_Amitran(id, begin, end, useLanes, withEmpty,
494  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vTypes);
495  } else {
496  throw InvalidArgument("Invalid type '" + type + "' for meandata dump '" + id + "'.");
497  }
498  if (det != 0) {
499  if (frequency < 0) {
500  frequency = end - begin;
501  }
502  MSNet::getInstance()->getDetectorControl().add(det, device, frequency, begin);
503  }
504 }
505 
506 
507 
508 
509 // ------ Value checking/adapting methods ------
510 MSEdge*
511 NLDetectorBuilder::getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
512  const std::string& detid) {
513  // get and check the lane
514  MSEdge* edge = MSEdge::dictionary(edgeID);
515  if (edge == 0) {
516  throw InvalidArgument("The lane with the id '" + edgeID + "' is not known (while building " + toString(type) + " '" + detid + "').");
517  }
518  return edge;
519 }
520 
521 
522 MSLane*
523 NLDetectorBuilder::getLaneChecking(const std::string& laneID, SumoXMLTag type,
524  const std::string& detid) {
525  // get and check the lane
526  MSLane* lane = MSLane::dictionary(laneID);
527  if (lane == 0) {
528  throw InvalidArgument("The lane with the id '" + laneID + "' is not known (while building " + toString(type) + " '" + detid + "').");
529  }
530  return lane;
531 }
532 
533 
534 void
535 NLDetectorBuilder::checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id) {
536  if (splInterval < 0) {
537  throw InvalidArgument("Negative sampling frequency (in " + toString(type) + " '" + id + "').");
538  }
539  if (splInterval == 0) {
540  throw InvalidArgument("Sampling frequency must not be zero (in " + toString(type) + " '" + id + "').");
541  }
542 }
543 
544 
545 /****************************************************************************/
546 
Data collector for edges/lanes.
Definition: MSMeanData.h:67
SUMOReal getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:480
SumoXMLTag
Numbers representing SUMO-XML - element names.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:571
long long int SUMOTime
Definition: SUMOTime.h:43
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od, const std::string &vTypes)
Creates an instance of an e1 detector using the given values.
Storage for all programs of a single tls.
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)
An areal (along a single lane) detector.
Definition: MSE2Collector.h:83
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
Network state mean data collector for edges/lanes.
A detector which joins E2Collectors over consecutive lanes (backward)
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:68
const std::string myID
The id of the detector.
MSDetectorFileOutput * buildMultiLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Builds an e2 detector that continues on preceeding lanes.
void addE3Exit(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an exit point of an e3 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:159
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.
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:673
void buildInstantInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an instantenous induction and adds it to the net.
const std::string & getID() const
Returns the id.
Definition: Named.h:66
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 SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an e1 detector and adds it to the net.
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.
void convUncontE2PosLength(const std::string &id, MSLane *clane, SUMOReal &pos, SUMOReal &length, bool frinedly_pos)
Converts the length and the position information for an e2 detector.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
The simulated network and simulation perfomer.
Definition: MSNet.h:93
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes)
Creates an instance of an e3 detector using the given values.
const std::string myVehicleTypes
The device the detector shall use.
A road/street connecting two junctions.
Definition: MSEdge.h:80
Holds the incoming definitions of an e3 detector unless the detector is build.
MSE2Collector * buildSingleLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Builds an e2 detector that lies on only one lane.
Writes positions of vehicles that have a certain (named) type.
Definition: MSVTypeProbe.h:60
An instantenous induction loop.
Writes e2 state on each tls switch.
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, SUMOTime splInterval, const std::string &device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos, const std::string &vTypes)
Builds an e2 detector with a fixed interval and adds it to the net.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:254
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
SUMOReal myHaltingSpeedThreshold
The speed a vehicle&#39;s speed must be below to be assigned as jammed.
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 toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:370
CrossSectionVector myExits
List of detector&#39;s exits.
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:1286
#define SUMOTime_MAX
Definition: SUMOTime.h:44
virtual MSDetectorFileOutput * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Creates an instance of an e2ol-detector using the given values.
void convContE2PosLength(const std::string &id, MSLane *clane, SUMOReal &pos, SUMOReal &length, bool frinedly_pos)
Converts the length and the position information for an e2ol-detector.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
NLDetectorBuilder(MSNet &net)
Constructor.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:107
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
virtual MSE2Collector * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Creates an instance of an e2 detector using the given values.
Network state mean data collector for edges/lanes.
#define SUMOReal
Definition: config.h:213
virtual ~NLDetectorBuilder()
Destructor.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes)
Stores temporary the initial information about an e3 detector to build.
MSTrafficLightLogic * getActive() const
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:95
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
SUMOReal getPositionChecking(SUMOReal pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
const std::string myDevice
The device the detector shall use.
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.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes)
Constructor.