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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // Builds detectors for microsim
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <string>
30 // #include <microsim/output/MSMultiLaneE2Collector.h>
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
36 class MSLane;
37 class MSEdge;
38 
39 class MEInductLoop;
40 class MESegment;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
54 public:
60 
61 
63  virtual ~NLDetectorBuilder();
64 
65 
68 
89  void buildInductLoop(const std::string& id,
90  const std::string& lane, double pos, SUMOTime splInterval,
91  const std::string& device, bool friendlyPos,
92  const std::string& vTypes);
93 
94 
110  void buildInstantInductLoop(const std::string& id,
111  const std::string& lane, double pos,
112  const std::string& device, bool friendlyPos,
113  const std::string& vTypes);
114 
115 
116 
117 
129  void buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
130  const std::string& device, SUMOTime frequency,
131  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
132  const std::string& vTypes, bool friendlyPos, bool showDetector,
133  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
134 
135  void buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
136  const std::string& device, SUMOTime frequency,
137  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
138  const std::string& vTypes, bool friendlyPos, bool showDetector,
139  MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
140 
141 
155  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
156  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
157  const std::string& vTypes, bool openEntry);
158 
159 
172  void addE3Entry(const std::string& lane, double pos, bool friendlyPos);
173 
174 
187  void addE3Exit(const std::string& lane, double pos, bool friendlyPos);
188 
189 
199  void endE3Detector();
200 
201 
209  std::string getCurrentE3ID() const;
210 
211 
225  void buildVTypeProbe(const std::string& id,
226  const std::string& vtype, SUMOTime frequency,
227  const std::string& device);
228 
229 
244  void buildRouteProbe(const std::string& id, const std::string& edge,
245  SUMOTime frequency, SUMOTime begin,
246  const std::string& device,
247  const std::string& vTypes);
249 
250 
251 
256 
267  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
268  MSLane* lane, double pos,
269  const std::string& vTypes, bool show = true);
270 
271 
281  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
282  MSLane* lane, double pos, const std::string& od,
283  const std::string& vTypes);
284 
285 
292  virtual MSE2Collector* createE2Detector(const std::string& id,
293  DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
294  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
295  const std::string& vTypes, bool showDetector = true);
296 
297  virtual MSE2Collector* createE2Detector(const std::string& id,
298  DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
299  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
300  const std::string& vTypes, bool showDetector = true);
301 
312  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
313  const CrossSectionVector& entries, const CrossSectionVector& exits,
314  double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
315  const std::string& vTypes, bool openEntry);
316 
317 
336  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
337  SUMOTime begin, SUMOTime end, const std::string& type,
338  const bool useLanes, const bool withEmpty, const bool printDefaults,
339  const bool withInternal, const bool trackVehicles, const int detectPersons,
340  const double maxTravelTime, const double minSamples,
341  const double haltSpeed, const std::string& vTypes,
342  const std::string& writeAttributes,
343  const std::string& device);
345 
346 
347 
360  MSE2Collector* buildSingleLaneE2Det(const std::string& id,
361  DetectorUsage usage, MSLane* lane, double pos, double length,
362  SUMOTime haltingTimeThreshold, double haltingSpeedThreshold,
363  double jamDistThreshold,
364  const std::string& vTypes);
365 
366 
367 protected:
373  public:
381  E3DetectorDefinition(const std::string& id,
382  const std::string& device, double haltingSpeedThreshold,
383  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
384  const std::string& vTypes, bool openEntry);
385 
388 
390  const std::string myID;
392  const std::string myDevice;
404  const std::string myVehicleTypes;
408 
409  private:
412 
415 
416  };
417 
418 
419 protected:
436  double getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
437  const std::string& detid);
438 
439 
442 
449  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
450  const std::string& detid);
451 
452 public:
459  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
460  const std::string& detid);
461 
462 protected:
470  void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
472 
473 
474 protected:
477 
478 
479 private:
482 
483 
484 private:
487 
490 
491 };
std::vector< MSCrossSection > CrossSectionVector
long long int SUMOTime
Definition: SUMOTime.h:31
SumoXMLTag
Numbers representing SUMO-XML - element names.
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:45
A single mesoscopic segment (cell)
Definition: MESegment.h:47
Base of value-generating classes (detectors)
An areal detector corresponding to a sequence of consecutive lanes.
Definition: MSE2Collector.h:79
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
The simulated network and simulation perfomer.
Definition: MSNet.h:89
Storage for all programs of a single tls.
Holds the incoming definitions of an e3 detector unless the detector is build.
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
const std::string myVehicleTypes
The device the detector shall use.
CrossSectionVector myEntries
List of detector's entries.
const std::string myID
The id of the detector.
SUMOTime mySampleInterval
The aggregation interval.
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
E3DetectorDefinition(const E3DetectorDefinition &)
Invalidated copy constructor.
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes, bool openEntry)
Constructor.
double myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
const std::string myDevice
The device the detector shall use.
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.
CrossSectionVector myExits
List of detector's exits.
Builds detectors for microsim.
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
void endE3Detector()
Builds of an e3 detector using collected values.
MSNet & myNet
The net to fill.
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.
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.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
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()
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.
NLDetectorBuilder & operator=(const NLDetectorBuilder &)
Invalidated assignment operator.
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 addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
virtual ~NLDetectorBuilder()
Destructor.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
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 &writeAttributes, const std::string &device)
Creates edge based mean data collector using the given specification.
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.
double getPositionChecking(double pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
void addE3Entry(const std::string &lane, double pos, bool friendlyPos)
Builds an entry point of an e3 detector.
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.
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.
NLDetectorBuilder(const NLDetectorBuilder &)
Invalidated copy constructor.
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.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
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...
NLDetectorBuilder(MSNet &net)
Constructor.
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.