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-2017 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 // #include <microsim/output/MSMultiLaneE2Collector.h>
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
46 class MSLane;
47 class MSEdge;
48 
49 class MEInductLoop;
50 class MESegment;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
64 public:
70 
71 
73  virtual ~NLDetectorBuilder();
74 
75 
78 
99  void buildInductLoop(const std::string& id,
100  const std::string& lane, double pos, SUMOTime splInterval,
101  const std::string& device, bool friendlyPos,
102  const std::string& vTypes);
103 
104 
120  void buildInstantInductLoop(const std::string& id,
121  const std::string& lane, double pos,
122  const std::string& device, bool friendlyPos,
123  const std::string& vTypes);
124 
125 
126 
127 
139  void buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
140  const std::string& device, SUMOTime frequency,
141  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
142  const std::string& vTypes, bool friendlyPos, bool showDetector,
143  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
144 
145  void buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
146  const std::string& device, SUMOTime frequency,
147  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
148  const std::string& vTypes, bool friendlyPos, bool showDetector,
149  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
150 
151 
165  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
166  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
167  const std::string& vTypes);
168 
169 
182  void addE3Entry(const std::string& lane, double pos, bool friendlyPos);
183 
184 
197  void addE3Exit(const std::string& lane, double pos, bool friendlyPos);
198 
199 
209  void endE3Detector();
210 
211 
219  std::string getCurrentE3ID() const;
220 
221 
235  void buildVTypeProbe(const std::string& id,
236  const std::string& vtype, SUMOTime frequency,
237  const std::string& device);
238 
239 
254  void buildRouteProbe(const std::string& id, const std::string& edge,
255  SUMOTime frequency, SUMOTime begin,
256  const std::string& device,
257  const std::string& vTypes);
259 
260 
261 
266 
277  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
278  MSLane* lane, double pos,
279  const std::string& vTypes, bool show = true);
280 
281 
291  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
292  MSLane* lane, double pos, const std::string& od,
293  const std::string& vTypes);
294 
295 
302  virtual MSE2Collector* createE2Detector(const std::string& id,
303  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
304  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
305  const std::string& vTypes, bool showDetector = true);
306 
307  virtual MSE2Collector* createE2Detector(const std::string& id,
308  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
309  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
310  const std::string& vTypes, bool showDetector = true);
311 
322  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
323  const CrossSectionVector& entries, const CrossSectionVector& exits,
324  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
325  const std::string& vTypes);
326 
327 
345  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
346  SUMOTime begin, SUMOTime end, const std::string& type,
347  const bool useLanes, const bool withEmpty, const bool printDefaults,
348  const bool withInternal, const bool trackVehicles,
349  const double maxTravelTime, const double minSamples,
350  const double haltSpeed, const std::string& vTypes,
351  const std::string& device);
353 
354 
355 
368  MSE2Collector* buildSingleLaneE2Det(const std::string& id,
369  DetectorUsage usage, MSLane* lane, double pos, double length,
370  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold,
371  double jamDistThreshold,
372  const std::string& vTypes);
373 
374 
375 protected:
381  public:
389  E3DetectorDefinition(const std::string& id,
390  const std::string& device, double haltingSpeedThreshold,
391  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
392  const std::string& vTypes);
393 
396 
398  const std::string myID;
400  const std::string myDevice;
412  const std::string myVehicleTypes;
414 
415  private:
418 
421 
422  };
423 
424 
425 protected:
442  double getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
443  const std::string& detid);
444 
445 
448 
455  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
456  const std::string& detid);
457 
458 public:
465  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
466  const std::string& detid);
467 
468 protected:
476  void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
478 
479 
480 protected:
483 
484 
485 private:
488 
489 
490 private:
493 
496 
497 };
498 
499 
500 #endif
501 
502 /****************************************************************************/
503 
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:87
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:94
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:57
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:52
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:79
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)
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.