SUMO - Simulation of Urban MObility
NLDetectorBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Builds detectors for microsim
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef NLDetectorBuilder_h
24 #define NLDetectorBuilder_h
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>
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
45 class MSLane;
46 class MSEdge;
47 
48 class MEInductLoop;
49 class MESegment;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
63 public:
69 
70 
72  virtual ~NLDetectorBuilder();
73 
74 
77 
98  void buildInductLoop(const std::string& id,
99  const std::string& lane, SUMOReal pos, SUMOTime splInterval,
100  const std::string& device, bool friendlyPos, bool splitByType);
101 
102 
118  void buildInstantInductLoop(const std::string& id,
119  const std::string& lane, SUMOReal pos,
120  const std::string& device, bool friendlyPos);
121 
122 
147  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
148  bool cont, SUMOTime splInterval, const std::string& device, SUMOTime haltingTimeThreshold,
149  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
150  bool friendlyPos);
151 
152 
177  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
178  bool cont, MSTLLogicControl::TLSLogicVariants& tlls,
179  const std::string& device, SUMOTime haltingTimeThreshold,
180  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
181  bool friendlyPos);
182 
183 
209  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
210  bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& tolane,
211  const std::string& device, SUMOTime haltingTimeThreshold,
212  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
213  bool friendlyPos);
214 
215 
229  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
230  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold);
231 
232 
245  void addE3Entry(const std::string& lane, SUMOReal pos, bool friendlyPos);
246 
247 
260  void addE3Exit(const std::string& lane, SUMOReal pos, bool friendlyPos);
261 
262 
272  void endE3Detector();
273 
274 
282  std::string getCurrentE3ID() const;
283 
284 
298  void buildVTypeProbe(const std::string& id,
299  const std::string& vtype, SUMOTime frequency,
300  const std::string& device);
301 
302 
317  void buildRouteProbe(const std::string& id, const std::string& edge,
318  SUMOTime frequency, SUMOTime begin,
319  const std::string& device);
321 
322 
323 
328 
339  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
340  MSLane* lane, SUMOReal pos, bool splitByType, bool show = true);
341 
342 
352  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
353  MSLane* lane, SUMOReal pos, const std::string& od);
354 
367  virtual MSE2Collector* createSingleLaneE2Detector(const std::string& id,
368  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
369  SUMOTime haltingTimeThreshold,
370  SUMOReal haltingSpeedThreshold,
371  SUMOReal jamDistThreshold);
372 
373 
388  const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos,
389  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
390  SUMOReal jamDistThreshold);
391 
392 
403  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
404  const CrossSectionVector& entries, const CrossSectionVector& exits,
405  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold);
406 
407 
425  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
426  SUMOTime begin, SUMOTime end, const std::string& type,
427  const bool useLanes, const bool withEmpty, const bool printDefaults,
428  const bool withInternal, const bool trackVehicles,
429  const SUMOReal maxTravelTime, const SUMOReal minSamples,
430  const SUMOReal haltSpeed, const std::string& vTypes,
431  const std::string& device);
433 
434 
435 
448  MSE2Collector* buildSingleLaneE2Det(const std::string& id,
449  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
450  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
451  SUMOReal jamDistThreshold);
452 
453 
466  MSDetectorFileOutput* buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
467  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
468  SUMOReal jamDistThreshold);
469 
470 
471 
472 
473 protected:
479  public:
487  E3DetectorDefinition(const std::string& id,
488  const std::string& device, SUMOReal haltingSpeedThreshold,
489  SUMOTime haltingTimeThreshold, SUMOTime splInterval);
490 
493 
495  std::string myID;
497  const std::string myDevice;
509 
510  private:
513 
516 
517  };
518 
519 
520 protected:
537  SUMOReal getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos,
538  const std::string& detid);
539 
540 
549  void convUncontE2PosLength(const std::string& id, MSLane* clane,
550  SUMOReal& pos, SUMOReal& length, bool frinedly_pos);
551 
552 
561  void convContE2PosLength(const std::string& id, MSLane* clane,
562  SUMOReal& pos, SUMOReal& length, bool frinedly_pos);
563 
564 
565 
568 
575  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
576  const std::string& detid);
577 
578 
585  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
586  const std::string& detid);
587 
588 
596  void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
598 
599 
600 protected:
603 
604 
605 private:
608 
609 
610 private:
613 
616 
617 };
618 
619 
620 #endif
621 
622 /****************************************************************************/
623 
SumoXMLTag
Numbers representing SUMO-XML - element names.
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:43
Storage for all programs of a single tls.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named 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.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval)
Constructor.
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
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.
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 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.
The simulated network and simulation perfomer.
Definition: MSNet.h:93
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
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)
Builds an e2 detector that lies on only one lane.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
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.
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.
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.
NLDetectorBuilder(MSNet &net)
Constructor.
A single mesoscopic segment (cell)
Definition: MESegment.h:57
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.
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.
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.
#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.
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.
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.
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.