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  : 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  delete myE3Definition;
98 }
99 
100 
101 void
103  const std::string& lane, SUMOReal pos, SUMOTime splInterval,
104  const std::string& device, bool friendlyPos, bool splitByType) {
105  checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id);
106  // get and check the lane
107  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E1DETECTOR, id);
108  // get and check the position
109  pos = getPositionChecking(pos, clane, friendlyPos, id);
110  // build the loop
111  MSDetectorFileOutput* loop = createInductLoop(id, clane, pos, splitByType);
112  // add the file output
113  myNet.getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, loop, device, splInterval);
114 }
115 
116 
117 void
119  const std::string& lane, SUMOReal pos,
120  const std::string& device, bool friendlyPos) {
121  // get and check the lane
123  // get and check the position
124  pos = getPositionChecking(pos, clane, friendlyPos, id);
125  // build the loop
126  MSDetectorFileOutput* loop = createInstantInductLoop(id, clane, pos, device);
127  // add the file output
129 }
130 
131 
132 void
134  const std::string& lane, SUMOReal pos, SUMOReal length,
135  bool cont, SUMOTime splInterval,
136  const std::string& device,
137  SUMOTime haltingTimeThreshold,
138  SUMOReal haltingSpeedThreshold,
139  SUMOReal jamDistThreshold, bool friendlyPos) {
140  checkSampleInterval(splInterval, SUMO_TAG_E2DETECTOR, id);
141  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
142  // check whether the detector may lie over more than one lane
143  MSDetectorFileOutput* det = 0;
144  if (!cont) {
145  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
146  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
147  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval);
148  } else {
149  convContE2PosLength(id, clane, pos, length, friendlyPos);
150  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
151  myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval);
152  }
153 }
154 
155 
156 void
158  const std::string& lane, SUMOReal pos, SUMOReal length,
159  bool cont,
161  const std::string& device,
162  SUMOTime haltingTimeThreshold,
163  SUMOReal haltingSpeedThreshold,
164  SUMOReal jamDistThreshold, bool friendlyPos) {
165  if (tlls.getActive() == 0) {
166  throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa.");
167  }
168  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
169  // check whether the detector may lie over more than one lane
170  MSDetectorFileOutput* det = 0;
171  if (!cont) {
172  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
173  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
175  } else {
176  convContE2PosLength(id, clane, pos, length, friendlyPos);
177  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
179  }
180  // add the file output
182 }
183 
184 
185 void
187  const std::string& lane, SUMOReal pos, SUMOReal length,
188  bool cont,
190  const std::string& tolane,
191  const std::string& device,
192  SUMOTime haltingTimeThreshold,
193  SUMOReal haltingSpeedThreshold,
194  SUMOReal jamDistThreshold, bool friendlyPos) {
195  if (tlls.getActive() == 0) {
196  throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa.");
197  }
198  MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id);
199  MSLane* ctoLane = getLaneChecking(tolane, SUMO_TAG_E2DETECTOR, id);
200  MSLink* link = MSLinkContHelper::getConnectingLink(*clane, *ctoLane);
201  if (link == 0) {
202  throw InvalidArgument(
203  "The detector output can not be build as no connection between lanes '"
204  + lane + "' and '" + tolane + "' exists.");
205  }
206  if (pos < 0) {
207  pos = -pos;
208  }
209  // check whether the detector may lie over more than one lane
210  MSDetectorFileOutput* det = 0;
211  if (!cont) {
212  convUncontE2PosLength(id, clane, pos, length, friendlyPos);
213  det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
215  } else {
216  convContE2PosLength(id, clane, pos, length, friendlyPos);
217  det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
219  }
220  // add the file output
222 }
223 
224 
225 void
226 NLDetectorBuilder::convUncontE2PosLength(const std::string& id, MSLane* clane,
227  SUMOReal& pos, SUMOReal& length,
228  bool friendlyPos) {
229  // get and check the position
230  pos = getPositionChecking(pos, clane, friendlyPos, id);
231  // check length
232  if (length < 0) {
233  length = clane->getLength() + length;
234  }
235  if (length + pos > clane->getLength()) {
236  if (friendlyPos) {
237  length = clane->getLength() - pos - (SUMOReal) 0.1;
238  } else {
239  throw InvalidArgument("The length of detector '" + id + "' lies beyond the lane's '" + clane->getID() + "' length.");
240  }
241  }
242  if (length < 0) {
243  if (friendlyPos) {
244  length = (SUMOReal) 0.1;
245  } else {
246  throw InvalidArgument("The length of detector '" + id + "' is almost 0.");
247  }
248  }
249 }
250 
251 
252 void
253 NLDetectorBuilder::convContE2PosLength(const std::string& id, MSLane* clane,
254  SUMOReal& pos, SUMOReal& /*length*/,
255  bool friendlyPos) {
256  // get and check the position
257  pos = getPositionChecking(pos, clane, friendlyPos, id);
258  // length will be kept as is
259 }
260 
261 
262 void
264  const std::string& device, SUMOTime splInterval,
265  SUMOReal haltingSpeedThreshold,
266  SUMOTime haltingTimeThreshold) {
267  checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id);
268  myE3Definition = new E3DetectorDefinition(id, device, haltingSpeedThreshold, haltingTimeThreshold, splInterval);
269 }
270 
271 
272 void
273 NLDetectorBuilder::addE3Entry(const std::string& lane,
274  SUMOReal pos, bool friendlyPos) {
275  if (myE3Definition == 0) {
276  return;
277  }
279  // get and check the position
280  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
281  // build and save the entry
282  myE3Definition->myEntries.push_back(MSCrossSection(clane, pos));
283 }
284 
285 
286 void
287 NLDetectorBuilder::addE3Exit(const std::string& lane,
288  SUMOReal pos, bool friendlyPos) {
289  if (myE3Definition == 0) {
290  return;
291  }
293  // get and check the position
294  pos = getPositionChecking(pos, clane, friendlyPos, myE3Definition->myID);
295  // build and save the exit
296  myE3Definition->myExits.push_back(MSCrossSection(clane, pos));
297 }
298 
299 
300 std::string
302  if (myE3Definition == 0) {
303  return "<unknown>";
304  }
305  return myE3Definition->myID;
306 }
307 
308 
309 void
311  if (myE3Definition == 0) {
312  return;
313  }
314  // If E3 own entry or exit detectors
315  if (myE3Definition->myEntries.size() > 0 || myE3Definition->myExits.size() > 0) {
316  // create E3 detector
320  // add to net
322  } else
323  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)")
324 
325  // clean up
326  delete myE3Definition;
327  myE3Definition = 0;
328 }
329 
330 
331 void
333  const std::string& vtype, SUMOTime frequency,
334  const std::string& device) {
336  new MSVTypeProbe(id, vtype, OutputDevice::getDevice(device), frequency);
337 }
338 
339 
340 void
341 NLDetectorBuilder::buildRouteProbe(const std::string& id, const std::string& edge,
342  SUMOTime frequency, SUMOTime begin,
343  const std::string& device) {
346  MSRouteProbe* probe = new MSRouteProbe(id, e, id + "_" + toString(begin), id + "_" + toString(begin - frequency));
347  // add the file output
348  myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin);
349 }
350 
351 
352 // -------------------
355  DetectorUsage usage,
356  MSLane* lane, SUMOReal pos, SUMOReal length,
357  SUMOTime haltingTimeThreshold,
358  SUMOReal haltingSpeedThreshold,
359  SUMOReal jamDistThreshold) {
360  return createSingleLaneE2Detector(id, usage, lane, pos,
361  length, haltingTimeThreshold, haltingSpeedThreshold,
362  jamDistThreshold);
363 }
364 
365 
368  MSLane* lane, SUMOReal pos, SUMOReal length,
369  SUMOTime haltingTimeThreshold,
370  SUMOReal haltingSpeedThreshold,
371  SUMOReal jamDistThreshold) {
373  lane, pos, haltingTimeThreshold, haltingSpeedThreshold,
374  jamDistThreshold);
375  static_cast<MS_E2_ZS_CollectorOverLanes*>(ret)->init(lane, length);
376  return ret;
377 }
378 
379 
382  MSLane* lane, SUMOReal pos, bool splitByType, bool) {
384  return new MEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos);
385  }
386  return new MSInductLoop(id, lane, pos, splitByType);
387 }
388 
389 
392  MSLane* lane, SUMOReal pos, const std::string& od) {
393  return new MSInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos);
394 }
395 
396 
399  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
400  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold) {
401  return new MSE2Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
402 }
403 
404 
407  DetectorUsage usage, MSLane* lane, SUMOReal pos,
408  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold) {
409  return new MS_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
410 }
411 
412 
415  const CrossSectionVector& entries,
416  const CrossSectionVector& exits,
417  SUMOReal haltingSpeedThreshold,
418  SUMOTime haltingTimeThreshold) {
419  return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold);
420 }
421 
422 
423 SUMOReal
425  const std::string& detid) {
426  // check whether it is given from the end
427  if (pos < 0) {
428  pos = lane->getLength() + pos;
429  }
430  // check whether it is on the lane
431  if (pos > lane->getLength()) {
432  if (friendlyPos) {
433  pos = lane->getLength() - (SUMOReal) 0.1;
434  } else {
435  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' length.");
436  }
437  }
438  if (pos < 0) {
439  if (friendlyPos) {
440  pos = (SUMOReal) 0.1;
441  } else {
442  throw InvalidArgument("The position of detector '" + detid + "' lies beyond the lane's '" + lane->getID() + "' length.");
443  }
444  }
445  return pos;
446 }
447 
448 
449 void
450 NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
451  SUMOTime begin, SUMOTime end, const std::string& type,
452  const bool useLanes, const bool withEmpty, const bool printDefaults,
453  const bool withInternal, const bool trackVehicles,
454  const SUMOReal maxTravelTime, const SUMOReal minSamples,
455  const SUMOReal haltSpeed, const std::string& vTypes,
456  const std::string& device) {
457  if (begin < 0) {
458  throw InvalidArgument("Negative begin time for meandata dump '" + id + "'.");
459  }
460  if (end < 0) {
461  end = SUMOTime_MAX;
462  }
463  if (end <= begin) {
464  throw InvalidArgument("End before or at begin for meandata dump '" + id + "'.");
465  }
466  std::set<std::string> vt;
467  StringTokenizer st(vTypes);
468  while (st.hasNext()) {
469  vt.insert(st.next());
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, vt);
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, vt);
481  } else if (type == "harmonoise") {
482  det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty,
483  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vt);
484  } else if (type == "amitran") {
485  det = new MSMeanData_Amitran(id, begin, end, useLanes, withEmpty,
486  printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vt);
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:67
SumoXMLTag
Numbers representing SUMO-XML - element names.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:567
long long int SUMOTime
Definition: SUMOTime.h:43
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: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.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval)
Constructor.
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:475
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, bool splitByType)
Builds an e1 detector and adds it to the net.
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
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:666
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.
Noise data collector for edges/lanes.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:254
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.
virtual MSE2Collector * 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.
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
const std::string & getID() const
Returns the id.
Definition: Named.h:66
A road/street connecting two junctions.
Definition: MSEdge.h:80
Holds the incoming definitions of an e3 detector unless the detector is build.
MSTrafficLightLogic * getActive() const
MSE2Collector * 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.
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.
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.
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:55
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.
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.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1226
#define SUMOTime_MAX
Definition: SUMOTime.h:44
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.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:102
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.
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:65
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, SUMOTime 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.
Network state mean data collector for edges/lanes.
#define SUMOReal
Definition: config.h:213
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
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.
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Stores temporary the initial information about an e3 detector to build.
static bool gUseMesoSim
Definition: MSGlobals.h:90
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
std::string myID
The id of the detector.
Base of value-generating classes (detectors)
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType, bool show=true)
Creates an instance of an e1 detector using the given values.
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.