SUMO - Simulation of Urban MObility
NLDetectorBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
20 // Builds detectors for microsim
21 /****************************************************************************/
22 #ifndef NLDetectorBuilder_h
23 #define NLDetectorBuilder_h
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>
39 // #include <microsim/output/MSMultiLaneE2Collector.h>
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, double pos, SUMOTime splInterval,
100  const std::string& device, bool friendlyPos,
101  const std::string& vTypes);
102 
103 
119  void buildInstantInductLoop(const std::string& id,
120  const std::string& lane, double pos,
121  const std::string& device, bool friendlyPos,
122  const std::string& vTypes);
123 
124 
125 
126 
138  void buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
139  const std::string& device, SUMOTime frequency,
140  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
141  const std::string& vTypes, bool friendlyPos, bool showDetector,
142  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
143 
144  void buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
145  const std::string& device, SUMOTime frequency,
146  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
147  const std::string& vTypes, bool friendlyPos, bool showDetector,
148  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
149 
150 
164  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
165  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
166  const std::string& vTypes);
167 
168 
181  void addE3Entry(const std::string& lane, double pos, bool friendlyPos);
182 
183 
196  void addE3Exit(const std::string& lane, double pos, bool friendlyPos);
197 
198 
208  void endE3Detector();
209 
210 
218  std::string getCurrentE3ID() const;
219 
220 
234  void buildVTypeProbe(const std::string& id,
235  const std::string& vtype, SUMOTime frequency,
236  const std::string& device);
237 
238 
253  void buildRouteProbe(const std::string& id, const std::string& edge,
254  SUMOTime frequency, SUMOTime begin,
255  const std::string& device,
256  const std::string& vTypes);
258 
259 
260 
265 
276  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
277  MSLane* lane, double pos,
278  const std::string& vTypes, bool show = true);
279 
280 
290  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
291  MSLane* lane, double pos, const std::string& od,
292  const std::string& vTypes);
293 
294 
301  virtual MSE2Collector* createE2Detector(const std::string& id,
302  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
303  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
304  const std::string& vTypes, bool showDetector = true);
305 
306  virtual MSE2Collector* createE2Detector(const std::string& id,
307  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
308  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
309  const std::string& vTypes, bool showDetector = true);
310 
321  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
322  const CrossSectionVector& entries, const CrossSectionVector& exits,
323  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
324  const std::string& vTypes);
325 
326 
344  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
345  SUMOTime begin, SUMOTime end, const std::string& type,
346  const bool useLanes, const bool withEmpty, const bool printDefaults,
347  const bool withInternal, const bool trackVehicles,
348  const double maxTravelTime, const double minSamples,
349  const double haltSpeed, const std::string& vTypes,
350  const std::string& device);
352 
353 
354 
367  MSE2Collector* buildSingleLaneE2Det(const std::string& id,
368  DetectorUsage usage, MSLane* lane, double pos, double length,
369  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold,
370  double jamDistThreshold,
371  const std::string& vTypes);
372 
373 
374 protected:
380  public:
388  E3DetectorDefinition(const std::string& id,
389  const std::string& device, double haltingSpeedThreshold,
390  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
391  const std::string& vTypes);
392 
395 
397  const std::string myID;
399  const std::string myDevice;
411  const std::string myVehicleTypes;
413 
414  private:
417 
420 
421  };
422 
423 
424 protected:
441  double getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
442  const std::string& detid);
443 
444 
447 
454  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
455  const std::string& detid);
456 
457 public:
464  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
465  const std::string& detid);
466 
467 protected:
475  void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
477 
478 
479 protected:
482 
483 
484 private:
487 
488 
489 private:
492 
495 
496 };
497 
498 
499 #endif
500 
501 /****************************************************************************/
502 
double getPositionChecking(double pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
SumoXMLTag
Numbers representing SUMO-XML - element names.
Builds detectors for microsim.
MSE2Collector * buildSingleLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, double pos, double length, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes)
Builds an e2 detector that lies on only one lane.
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.
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
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
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.
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes)
Constructor.
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.
The simulated network and simulation perfomer.
Definition: MSNet.h:90
void addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
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.
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.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
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.
double myHaltingSpeedThreshold
The speed a vehicle&#39;s speed must be below to be assigned as jammed.
NLDetectorBuilder(MSNet &net)
Constructor.
A single mesoscopic segment (cell)
Definition: MESegment.h:56
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, 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...
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.
CrossSectionVector myEntries
List of detector&#39;s entries.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
const std::string myDevice
The device the detector shall use.
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:54
Base of value-generating classes (detectors)
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.