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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Builds detectors for microsim
19 /****************************************************************************/
20 #ifndef NLDetectorBuilder_h
21 #define NLDetectorBuilder_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
33 // #include <microsim/output/MSMultiLaneE2Collector.h>
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
39 class MSLane;
40 class MSEdge;
41 
42 class MEInductLoop;
43 class MESegment;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
57 public:
63 
64 
66  virtual ~NLDetectorBuilder();
67 
68 
71 
92  void buildInductLoop(const std::string& id,
93  const std::string& lane, double pos, SUMOTime splInterval,
94  const std::string& device, bool friendlyPos,
95  const std::string& vTypes);
96 
97 
113  void buildInstantInductLoop(const std::string& id,
114  const std::string& lane, double pos,
115  const std::string& device, bool friendlyPos,
116  const std::string& vTypes);
117 
118 
119 
120 
132  void buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
133  const std::string& device, SUMOTime frequency,
134  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
135  const std::string& vTypes, bool friendlyPos, bool showDetector,
136  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
137 
138  void buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
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 
158  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
159  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
160  const std::string& vTypes, bool openEntry);
161 
162 
175  void addE3Entry(const std::string& lane, double pos, bool friendlyPos);
176 
177 
190  void addE3Exit(const std::string& lane, double pos, bool friendlyPos);
191 
192 
202  void endE3Detector();
203 
204 
212  std::string getCurrentE3ID() const;
213 
214 
228  void buildVTypeProbe(const std::string& id,
229  const std::string& vtype, SUMOTime frequency,
230  const std::string& device);
231 
232 
247  void buildRouteProbe(const std::string& id, const std::string& edge,
248  SUMOTime frequency, SUMOTime begin,
249  const std::string& device,
250  const std::string& vTypes);
252 
253 
254 
259 
270  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
271  MSLane* lane, double pos,
272  const std::string& vTypes, bool show = true);
273 
274 
284  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
285  MSLane* lane, double pos, const std::string& od,
286  const std::string& vTypes);
287 
288 
295  virtual MSE2Collector* createE2Detector(const std::string& id,
296  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
297  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
298  const std::string& vTypes, bool showDetector = true);
299 
300  virtual MSE2Collector* createE2Detector(const std::string& id,
301  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
302  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
303  const std::string& vTypes, bool showDetector = true);
304 
315  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
316  const CrossSectionVector& entries, const CrossSectionVector& exits,
317  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
318  const std::string& vTypes, bool openEntry);
319 
320 
338  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
339  SUMOTime begin, SUMOTime end, const std::string& type,
340  const bool useLanes, const bool withEmpty, const bool printDefaults,
341  const bool withInternal, const bool trackVehicles,
342  const double maxTravelTime, const double minSamples,
343  const double haltSpeed, const std::string& vTypes,
344  const std::string& device);
346 
347 
348 
361  MSE2Collector* buildSingleLaneE2Det(const std::string& id,
362  DetectorUsage usage, MSLane* lane, double pos, double length,
363  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold,
364  double jamDistThreshold,
365  const std::string& vTypes);
366 
367 
368 protected:
374  public:
382  E3DetectorDefinition(const std::string& id,
383  const std::string& device, double haltingSpeedThreshold,
384  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
385  const std::string& vTypes, bool openEntry);
386 
389 
391  const std::string myID;
393  const std::string myDevice;
405  const std::string myVehicleTypes;
409 
410  private:
413 
416 
417  };
418 
419 
420 protected:
437  double getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
438  const std::string& detid);
439 
440 
443 
450  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
451  const std::string& detid);
452 
453 public:
460  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
461  const std::string& detid);
462 
463 protected:
471  void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
473 
474 
475 protected:
478 
479 
480 private:
483 
484 
485 private:
488 
491 
492 };
493 
494 
495 #endif
496 
497 /****************************************************************************/
498 
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.
long long int SUMOTime
Definition: SUMOTime.h:36
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:80
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.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Creates an instance of an e3 detector using the given values.
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.
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes, bool openEntry)
Constructor.
The simulated network and simulation perfomer.
Definition: MSNet.h:84
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:75
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.
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Stores temporary the initial information about an e3 detector to build.
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:50
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...
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:78
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
const std::string myDevice
The device the detector shall use.
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:48
Base of value-generating classes (detectors)
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.