SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLDetectorBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
11 // Builds detectors for microsim
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
14 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
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>
49 #include <microsim/MSGlobals.h>
57 #include "NLDetectorBuilder.h"
59 
60 #ifdef HAVE_INTERNAL
61 #include <mesosim/MEInductLoop.h>
62 #include <mesosim/MELoop.h>
63 #include <mesosim/MESegment.h>
64 #endif
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, int splInterval)
80  : myID(id), myDevice(device),
81  myHaltingSpeedThreshold(haltingSpeedThreshold),
82  myHaltingTimeThreshold(haltingTimeThreshold),
83  mySampleInterval(splInterval) {}
84 
85 
87 
88 
89 /* -------------------------------------------------------------------------
90  * NLDetectorBuilder-methods
91  * ----------------------------------------------------------------------- */
93  : myNet(net), myE3Definition(0) {}
94 
95 
97 
98 
99 void
101  const std::string& lane, SUMOReal pos, int splInterval,
102  const std::string& device, bool friendlyPos, bool splitByType) {
103  checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id);
104  // get and check the lane
105  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E1DETECTOR, id);
106  if (!MSGlobals::gUseMesoSim) {
107  // get and check the position
108  pos = getPositionChecking(pos, clane, friendlyPos, id);
109  // build the loop
110  MSDetectorFileOutput* loop = createInductLoop(id, clane, pos, splitByType);
111  // add the file output
112  myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval);
113  } else {
114 #ifdef HAVE_INTERNAL
115  if (pos < 0) {
116  pos = clane->getLength() + pos;
117  }
118  MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(clane->getEdge());
119  MESegment* prev = s;
120  SUMOReal cpos = 0;
121  while (cpos + prev->getLength() < pos && s != 0) {
122  prev = s;
123  cpos += s->getLength();
124  s = s->getNextSegment();
125  }
126  SUMOReal rpos = pos - cpos; //-prev->getLength();
127  if (rpos > prev->getLength() || rpos < 0) {
128  if (friendlyPos) {
129  rpos = prev->getLength() - (SUMOReal) 0.1;
130  } else {
131  throw InvalidArgument("The position of detector '" + id + "' lies beyond the lane's '" + lane + "' length.");
132  }
133  }
134  MEInductLoop* loop =
135  createMEInductLoop(id, prev, rpos);
136  myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval);
137 #endif
138  }
139 }
140 
141 
142 void
144  const std::string& lane, SUMOReal pos,
145  const std::string& device, bool friendlyPos) {
146  // get and check the lane
148  // get and check the position
149  pos = getPositionChecking(pos, clane, friendlyPos, id);
150  // build the loop
151  MSDetectorFileOutput* loop = createInstantInductLoop(id, clane, pos, device);
152  // add the file output
154 }
155 
156 
157 void
159  const std::string& lane, SUMOReal pos, SUMOReal length,
160  bool cont, int splInterval,
161  const std::string& device,
162  SUMOTime haltingTimeThreshold,
163  SUMOReal haltingSpeedThreshold,
164  SUMOReal jamDistThreshold, bool friendlyPos) {
165  checkSampleInterval(splInterval, SUMO_TAG_E2DETECTOR, id);
166  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
167  // check whether the detector may lie over more than one lane
168  MSDetectorFileOutput* det = 0;
169  if (!cont) {
170  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
171  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
172  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval);
173  } else {
174  convContE2PosLength(id, clane, pos, length, friendlyPos);
175  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
176  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval);
177  }
178 }
179 
180 
181 void
183  const std::string& lane, SUMOReal pos, SUMOReal length,
184  bool cont,
186  const std::string& device,
187  SUMOTime haltingTimeThreshold,
188  SUMOReal haltingSpeedThreshold,
189  SUMOReal jamDistThreshold, bool friendlyPos) {
190  if (tlls.getActive() == 0) {
191  throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa.");
192  }
193  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
194  // check whether the detector may lie over more than one lane
195  MSDetectorFileOutput* det = 0;
196  if (!cont) {
197  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
198  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
200  } else {
201  convContE2PosLength(id, clane, pos, length, friendlyPos);
202  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
204  }
205  // add the file output
207 }
208 
209 
210 void
212  const std::string& lane, SUMOReal pos, SUMOReal length,
213  bool cont,
215  const std::string& tolane,
216  const std::string& device,
217  SUMOTime haltingTimeThreshold,
218  SUMOReal haltingSpeedThreshold,
219  SUMOReal jamDistThreshold, bool friendlyPos) {
220  if (tlls.getActive() == 0) {
221  throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa.");
222  }
223  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
224  MSLane* ctoLane = getLaneChecking(tolane, SUMO_TAG_E2DETECTOR, id);
225  MSLink* link = MSLinkContHelper::getConnectingLink(*clane, *ctoLane);
226  if (link == 0) {
227  throw InvalidArgument(
228  "The detector output can not be build as no connection between lanes '"
229  + lane + "' and '" + tolane + "' exists.");
230  }
231  if (pos < 0) {
232  pos = -pos;
233  }
234  // check whether the detector may lie over more than one lane
235  MSDetectorFileOutput* det = 0;
236  if (!cont) {
237  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
238  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
240  } else {
241  convContE2PosLength(id, clane, pos, length, friendlyPos);
242  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
244  }
245  // add the file output
247 }
248 
249 
250 void
251 NLDetectorBuilder::convUncontE2PosLength(const std::string& id, MSLane* clane,
252  SUMOReal& pos, SUMOReal& length,
253  bool friendlyPos) {
254  // get and check the position
255  pos = getPositionChecking(pos, clane, friendlyPos, id);
256  // check length
257  if (length < 0) {
258  length = clane->getLength() + length;
259  }
260  if (length + pos > clane->getLength()) {
261  if (friendlyPos) {
262  length = clane->getLength() - pos - (SUMOReal) 0.1;
263  } else {
264  throw InvalidArgument("The length of detector '" + id + "' lies beyond the lane's '" + clane->getID() + "' length.");
265  }
266  }
267  if (length < 0) {
268  if (friendlyPos) {
269  length = (SUMOReal) 0.1;
270  } else {
271  throw InvalidArgument("The length of detector '" + id + "' is almost 0.");
272  }
273  }
274 }
275 
276 
277 void
278 NLDetectorBuilder::convContE2PosLength(const std::string& id, MSLane* clane,
279  SUMOReal& pos, SUMOReal& /*length*/,
280  bool friendlyPos) {
281  // get and check the position
282  pos = getPositionChecking(pos, clane, friendlyPos, id);
283  // length will be kept as is
284 }
285 
286 
287 void
289  const std::string& device, int splInterval,
290  SUMOReal haltingSpeedThreshold,
291  SUMOTime haltingTimeThreshold) {
292  checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id);
293  myE3Definition = new E3DetectorDefinition(id, device, haltingSpeedThreshold, haltingTimeThreshold, splInterval);
294 }
295 
296 
297 void
298 NLDetectorBuilder::addE3Entry(const std::string& lane,
299  SUMOReal pos, bool friendlyPos) {
300  if (myE3Definition == 0) {
301  return;
302  }
304  // get and check the position
305  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
306  // build and save the entry
307  myE3Definition->myEntries.push_back(MSCrossSection(clane, pos));
308 }
309 
310 
311 void
312 NLDetectorBuilder::addE3Exit(const std::string& lane,
313  SUMOReal pos, bool friendlyPos) {
314  if (myE3Definition == 0) {
315  return;
316  }
318  // get and check the position
319  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
320  // build and save the exit
321  myE3Definition->myExits.push_back(MSCrossSection(clane, pos));
322 }
323 
324 
325 std::string
327  if (myE3Definition == 0) {
328  return "<unknown>";
329  }
330  return myE3Definition->myID;
331 }
332 
333 
334 void
336  if (myE3Definition == 0) {
337  return;
338  }
342  // add to net
344  // clean up
345  delete myE3Definition;
346  myE3Definition = 0;
347 }
348 
349 
350 void
352  const std::string& vtype, SUMOTime frequency,
353  const std::string& device) {
355  new MSVTypeProbe(id, vtype, OutputDevice::getDevice(device), frequency);
356 }
357 
358 
359 void
360 NLDetectorBuilder::buildRouteProbe(const std::string& id, const std::string& edge,
361  SUMOTime frequency, SUMOTime begin,
362  const std::string& device) {
365  MSRouteProbe* probe = new MSRouteProbe(id, e, begin);
366  // add the file output
367  myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin);
368 }
369 
370 
371 // -------------------
374  DetectorUsage usage,
375  MSLane* lane, SUMOReal pos, SUMOReal length,
376  SUMOTime haltingTimeThreshold,
377  SUMOReal haltingSpeedThreshold,
378  SUMOReal jamDistThreshold) {
379  return createSingleLaneE2Detector(id, usage, lane, pos,
380  length, haltingTimeThreshold, haltingSpeedThreshold,
381  jamDistThreshold);
382 }
383 
384 
387  MSLane* lane, SUMOReal pos, SUMOReal length,
388  SUMOTime haltingTimeThreshold,
389  SUMOReal haltingSpeedThreshold,
390  SUMOReal jamDistThreshold) {
392  lane, pos, haltingTimeThreshold, haltingSpeedThreshold,
393  jamDistThreshold);
394  static_cast<MS_E2_ZS_CollectorOverLanes*>(ret)->init(lane, length);
395  return ret;
396 }
397 
398 
401  MSLane* lane, SUMOReal pos, bool splitByType) {
402  return new MSInductLoop(id, lane, pos, splitByType);
403 }
404 
405 
408  MSLane* lane, SUMOReal pos, const std::string& od) {
409  return new MSInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos);
410 }
411 
412 
413 #ifdef HAVE_INTERNAL
414 MEInductLoop*
415 NLDetectorBuilder::createMEInductLoop(const std::string& id,
416  MESegment* s, SUMOReal pos) {
417  return new MEInductLoop(id, s, pos);
418 }
419 #endif
420 
421 
424  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
425  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold) {
426  return new MSE2Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
427 }
428 
429 
432  DetectorUsage usage, MSLane* lane, SUMOReal pos,
433  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold) {
434  return new MS_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
435 }
436 
437 
440  const CrossSectionVector& entries,
441  const CrossSectionVector& exits,
442  SUMOReal haltingSpeedThreshold,
443  SUMOTime haltingTimeThreshold) {
444  return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold);
445 }
446 
447 
448 SUMOReal
450  const std::string& detid) {
451  // check whether it is given from the end
452  if (pos < 0) {
453  pos = lane->getLength() + pos;
454  }
455  // check whether it is on the lane
456  if (pos > lane->getLength()) {
457  if (friendlyPos) {
458  pos = lane->getLength() - (SUMOReal) 0.1;
459  } else {
460  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' length.");
461  }
462  }
463  if (pos < 0) {
464  if (friendlyPos) {
465  pos = (SUMOReal) 0.1;
466  } else {
467  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' length.");
468  }
469  }
470  return pos;
471 }
472 
473 
474 void
475 NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
476  SUMOTime begin, SUMOTime end, const std::string& type,
477  const bool useLanes, const bool withEmpty, const bool printDefaults,
478  const bool withInternal, const bool trackVehicles,
479  const SUMOReal maxTravelTime, const SUMOReal minSamples,
480  const SUMOReal haltSpeed, const std::string& vTypes,
481  const std::string& device) {
482  if (begin < 0) {
483  throw InvalidArgument("Negative begin time for meandata dump '" + id + "'.");
484  }
485  if (end < 0) {
486  end = SUMOTime_MAX;
487  }
488  if (end <= begin) {
489  throw InvalidArgument("End before or at begin for meandata dump '" + id + "'.");
490  }
491  std::set<std::string> vt;
492  StringTokenizer st(vTypes);
493  while (st.hasNext()) {
494  vt.insert(st.next());
495  }
496  MSMeanData* det = 0;
497  if (type == "" || type == "performance" || type == "traffic") {
498  det = new MSMeanData_Net(id, begin, end, useLanes, withEmpty,
499  printDefaults, withInternal, trackVehicles,
500  maxTravelTime, minSamples, haltSpeed, vt);
501  } else if (type == "hbefa") {
502  det = new MSMeanData_HBEFA(id, begin, end, useLanes, withEmpty,
503  printDefaults, withInternal, trackVehicles,
504  maxTravelTime, minSamples, vt);
505  } else if (type == "harmonoise") {
506  det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty,
507  printDefaults, withInternal, trackVehicles,
508  maxTravelTime, minSamples, vt);
509  } else {
510  throw InvalidArgument("Invalid type '" + type + "' for meandata dump '" + id + "'.");
511  }
512  if (det != 0) {
513  if (frequency < 0) {
514  frequency = end - begin;
515  }
516  MSNet::getInstance()->getDetectorControl().add(det, device, frequency, begin);
517  }
518 }
519 
520 
521 
522 
523 // ------ Value checking/adapting methods ------
524 MSEdge*
525 NLDetectorBuilder::getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
526  const std::string& detid) {
527  // get and check the lane
528  MSEdge* edge = MSEdge::dictionary(edgeID);
529  if (edge == 0) {
530  throw InvalidArgument("The lane with the id '" + edgeID + "' is not known (while building " + toString(type) + " '" + detid + "').");
531  }
532  return edge;
533 }
534 
535 
536 MSLane*
537 NLDetectorBuilder::getLaneChecking(const std::string& laneID, SumoXMLTag type,
538  const std::string& detid) {
539  // get and check the lane
540  MSLane* lane = MSLane::dictionary(laneID);
541  if (lane == 0) {
542  throw InvalidArgument("The lane with the id '" + laneID + "' is not known (while building " + toString(type) + " '" + detid + "').");
543  }
544  return lane;
545 }
546 
547 
548 void
549 NLDetectorBuilder::checkSampleInterval(int splInterval, SumoXMLTag type, const std::string& id) {
550  if (splInterval < 0) {
551  throw InvalidArgument("Negative sampling frequency (in " + toString(type) + " '" + id + "').");
552  }
553  if (splInterval == 0) {
554  throw InvalidArgument("Sampling frequency must not be zero (in " + toString(type) + " '" + id + "').");
555  }
556 }
557 
558 
559 /****************************************************************************/
560 
Data collector for edges/lanes.
Definition: MSMeanData.h:66
SumoXMLTag
Numbers representing SUMO-XML - element names.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:442
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType)
Creates an instance of an e1 detector using the given values.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, int splInterval)
Constructor.
Storage for all programs of a single tls.
std::string next()
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:77
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
static bool dictionary(std::string id, MSLane *lane)
Inserts a MSLane into the static dictionary Returns true if the key id isn&#39;t already in the dictionar...
Definition: MSLane.cpp:807
A detector which joins E2Collectors over consecutive lanes (backward)
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:68
SUMOReal getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:360
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:150
MSDetectorFileOutput * buildMultiLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Builds an e2 detector that continues on preceeding lanes.
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:461
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.
MSDetectorFileOutput * buildSingleLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Builds an e2 detector that lies on only one lane.
Noise data collector for edges/lanes.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step (in s)
Definition: MSNet.cpp:500
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 buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, int splInterval, const std::string &device, bool friendlyPos, bool splitByType)
Builds an e1 detector and adds it to the net.
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.
The simulated network and simulation perfomer.
Definition: MSNet.h:87
virtual MSDetectorFileOutput * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2 detector using the given values.
const std::string & getID() const
Returns the id.
Definition: Named.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:73
Holds the incoming definitions of an e3 detector unless the detector is build.
MSTrafficLightLogic * getActive() const
Writes positions of vehicles that have a certain (named) type.
Definition: MSVTypeProbe.h:60
An instantenous induction loop.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
Writes e2 state on each tls switch.
void beginE3Detector(const std::string &id, const std::string &device, int splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Stores temporary the initial information about an e3 detector to build.
SUMOReal myHaltingSpeedThreshold
The speed a vehicle&#39;s speed must be below to be assigned as jammed.
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device)
Builds a routeProbe and adds it to the net.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:51
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:289
CrossSectionVector myExits
List of detector&#39;s exits.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Creates an instance of an e3 detector using the given values.
#define SUMOTime_MAX
Definition: SUMOTime.h:44
int mySampleInterval
The aggregation interval.
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.
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od)
Creates an instance of an e1 detector using the given values.
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, int splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
virtual MSDetectorFileOutput * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2ol-detector using the given values.
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:64
void checkSampleInterval(int splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
Network state mean data collector for edges/lanes.
#define SUMOReal
Definition: config.h:221
static const bool gUseMesoSim
Definition: MSGlobals.h:95
void buildInstantInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, const std::string &device, bool friendlyPos)
Builds an instantenous induction and adds it to the net.
virtual ~NLDetectorBuilder()
Destructor.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, int splInterval, const std::string &device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos)
Builds an e2 detector with a fixed interval and adds it to the net.
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.
Representation of a lane in the micro simulation.
Definition: MSLane.h:73
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.
Emission data collector for edges/lanes.
std::string myID
The id of the detector.
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.