Eclipse 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-2019 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 /****************************************************************************/
17 // Builds detectors for microsim
18 /****************************************************************************/
19 #ifndef NLDetectorBuilder_h
20 #define NLDetectorBuilder_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
32 // #include <microsim/output/MSMultiLaneE2Collector.h>
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
38 class MSLane;
39 class MSEdge;
40 
41 class MEInductLoop;
42 class MESegment;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
56 public:
62 
63 
65  virtual ~NLDetectorBuilder();
66 
67 
70 
91  void buildInductLoop(const std::string& id,
92  const std::string& lane, double pos, SUMOTime splInterval,
93  const std::string& device, bool friendlyPos,
94  const std::string& vTypes);
95 
96 
112  void buildInstantInductLoop(const std::string& id,
113  const std::string& lane, double pos,
114  const std::string& device, bool friendlyPos,
115  const std::string& vTypes);
116 
117 
118 
119 
131  void buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
132  const std::string& device, SUMOTime frequency,
133  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
134  const std::string& vTypes, bool friendlyPos, bool showDetector,
135  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
136 
137  void buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
138  const std::string& device, SUMOTime frequency,
139  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
140  const std::string& vTypes, bool friendlyPos, bool showDetector,
141  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
142 
143 
157  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
158  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
159  const std::string& vTypes, bool openEntry);
160 
161 
174  void addE3Entry(const std::string& lane, double pos, bool friendlyPos);
175 
176 
189  void addE3Exit(const std::string& lane, double pos, bool friendlyPos);
190 
191 
201  void endE3Detector();
202 
203 
211  std::string getCurrentE3ID() const;
212 
213 
227  void buildVTypeProbe(const std::string& id,
228  const std::string& vtype, SUMOTime frequency,
229  const std::string& device);
230 
231 
246  void buildRouteProbe(const std::string& id, const std::string& edge,
247  SUMOTime frequency, SUMOTime begin,
248  const std::string& device,
249  const std::string& vTypes);
251 
252 
253 
258 
269  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
270  MSLane* lane, double pos,
271  const std::string& vTypes, bool show = true);
272 
273 
283  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
284  MSLane* lane, double pos, const std::string& od,
285  const std::string& vTypes);
286 
287 
294  virtual MSE2Collector* createE2Detector(const std::string& id,
295  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
296  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
297  const std::string& vTypes, bool showDetector = true);
298 
299  virtual MSE2Collector* createE2Detector(const std::string& id,
300  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
301  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
302  const std::string& vTypes, bool showDetector = true);
303 
314  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
315  const CrossSectionVector& entries, const CrossSectionVector& exits,
316  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
317  const std::string& vTypes, bool openEntry);
318 
319 
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, const int detectPersons,
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 
NLDetectorBuilder::createE2Detector
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()
Definition: NLDetectorBuilder.cpp:397
NLDetectorBuilder::E3DetectorDefinition::myHaltingTimeThreshold
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.
Definition: NLDetectorBuilder.h:397
NLDetectorBuilder::getLaneChecking
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
Definition: NLDetectorBuilder.cpp:514
MSTLLogicControl.h
MSDetectorFileOutput
Base of value-generating classes (detectors)
Definition: MSDetectorFileOutput.h:63
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
NLDetectorBuilder::getPositionChecking
double getPositionChecking(double pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
Definition: NLDetectorBuilder.cpp:425
NLDetectorBuilder::E3DetectorDefinition::myEntries
CrossSectionVector myEntries
List of detector's entries.
Definition: NLDetectorBuilder.h:399
NLDetectorBuilder::buildSingleLaneE2Det
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.
NLDetectorBuilder::buildInductLoop
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.
Definition: NLDetectorBuilder.cpp:94
MESegment
A single mesoscopic segment (cell)
Definition: MESegment.h:49
NLDetectorBuilder::addE3Entry
void addE3Entry(const std::string &lane, double pos, bool friendlyPos)
Builds an entry point of an e3 detector.
Definition: NLDetectorBuilder.cpp:297
NLDetectorBuilder::createInductLoop
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.
Definition: NLDetectorBuilder.cpp:378
NLDetectorBuilder::getEdgeChecking
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
Definition: NLDetectorBuilder.cpp:502
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
NLDetectorBuilder::E3DetectorDefinition::E3DetectorDefinition
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes, bool openEntry)
Constructor.
Definition: NLDetectorBuilder.cpp:65
NLDetectorBuilder::E3DetectorDefinition::myID
const std::string myID
The id of the detector.
Definition: NLDetectorBuilder.h:391
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
NLDetectorBuilder::E3DetectorDefinition
Holds the incoming definitions of an e3 detector unless the detector is build.
Definition: NLDetectorBuilder.h:373
MEInductLoop
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:47
MSE2Collector
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:81
MSE2Collector.h
NLDetectorBuilder::E3DetectorDefinition::mySampleInterval
SUMOTime mySampleInterval
The aggregation interval.
Definition: NLDetectorBuilder.h:403
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
NLDetectorBuilder::createEdgeLaneMeanData
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 int detectPersons, 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.
Definition: NLDetectorBuilder.cpp:451
NLDetectorBuilder::operator=
NLDetectorBuilder & operator=(const NLDetectorBuilder &)
Invalidated assignment operator.
NLDetectorBuilder::E3DetectorDefinition::myExits
CrossSectionVector myExits
List of detector's exits.
Definition: NLDetectorBuilder.h:401
NLDetectorBuilder::myNet
MSNet & myNet
The net to fill.
Definition: NLDetectorBuilder.h:477
NLDetectorBuilder::E3DetectorDefinition::myVehicleTypes
const std::string myVehicleTypes
The device the detector shall use.
Definition: NLDetectorBuilder.h:405
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
NLDetectorBuilder::E3DetectorDefinition::operator=
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
NLDetectorBuilder::buildInstantInductLoop
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.
Definition: NLDetectorBuilder.cpp:111
NLDetectorBuilder::beginE3Detector
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.
Definition: NLDetectorBuilder.cpp:286
NLDetectorBuilder::endE3Detector
void endE3Detector()
Builds of an e3 detector using collected values.
Definition: NLDetectorBuilder.cpp:334
DetectorUsage
DetectorUsage
Definition: MSDetectorFileOutput.h:50
NLDetectorBuilder::buildE2Detector
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's detector control. Also performs some consistency ch...
Definition: NLDetectorBuilder.cpp:127
NLDetectorBuilder::E3DetectorDefinition::~E3DetectorDefinition
~E3DetectorDefinition()
Destructor.
Definition: NLDetectorBuilder.cpp:78
NLDetectorBuilder::~NLDetectorBuilder
virtual ~NLDetectorBuilder()
Destructor.
Definition: NLDetectorBuilder.cpp:88
NLDetectorBuilder::myE3Definition
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
Definition: NLDetectorBuilder.h:482
NLDetectorBuilder::E3DetectorDefinition::myOpenEntry
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
Definition: NLDetectorBuilder.h:407
NLDetectorBuilder::getCurrentE3ID
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
Definition: NLDetectorBuilder.cpp:325
NLDetectorBuilder::NLDetectorBuilder
NLDetectorBuilder(MSNet &net)
Constructor.
Definition: NLDetectorBuilder.cpp:84
NLDetectorBuilder::E3DetectorDefinition::myHaltingSpeedThreshold
double myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
Definition: NLDetectorBuilder.h:395
NLDetectorBuilder::createInstantInductLoop
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.
Definition: NLDetectorBuilder.cpp:389
MSTLLogicControl::TLSLogicVariants
Storage for all programs of a single tls.
Definition: MSTLLogicControl.h:85
MSCrossSection.h
config.h
NLDetectorBuilder::buildVTypeProbe
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.
Definition: NLDetectorBuilder.cpp:357
NLDetectorBuilder::checkSampleInterval
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
Definition: NLDetectorBuilder.cpp:526
NLDetectorBuilder::addE3Exit
void addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
Definition: NLDetectorBuilder.cpp:311
NLDetectorBuilder::createE3Detector
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.
Definition: NLDetectorBuilder.cpp:413
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:55
CrossSectionVector
std::vector< MSCrossSection > CrossSectionVector
Definition: MSCrossSection.h:63
NLDetectorBuilder::buildRouteProbe
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.
Definition: NLDetectorBuilder.cpp:366
NLDetectorBuilder::E3DetectorDefinition::myDevice
const std::string myDevice
The device the detector shall use.
Definition: NLDetectorBuilder.h:393