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-sim.org/
13 // Copyright (C) 2001-2014 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>
37 #include <microsim/MSNet.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
46 class MSLane;
47 class MSEdge;
48 
49 #ifdef HAVE_INTERNAL
50 class MEInductLoop;
51 class MESegment;
52 #endif
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
66 public:
72 
73 
75  virtual ~NLDetectorBuilder();
76 
77 
80 
101  void buildInductLoop(const std::string& id,
102  const std::string& lane, SUMOReal pos, int splInterval,
103  const std::string& device, bool friendlyPos, bool splitByType);
104 
105 
121  void buildInstantInductLoop(const std::string& id,
122  const std::string& lane, SUMOReal pos,
123  const std::string& device, bool friendlyPos);
124 
125 
150  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
151  bool cont, int splInterval, const std::string& device, SUMOTime haltingTimeThreshold,
152  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
153  bool friendlyPos);
154 
155 
180  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
181  bool cont, MSTLLogicControl::TLSLogicVariants& tlls,
182  const std::string& device, SUMOTime haltingTimeThreshold,
183  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
184  bool friendlyPos);
185 
186 
212  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
213  bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& tolane,
214  const std::string& device, SUMOTime haltingTimeThreshold,
215  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
216  bool friendlyPos);
217 
218 
232  void beginE3Detector(const std::string& id, const std::string& device, int splInterval,
233  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold);
234 
235 
248  void addE3Entry(const std::string& lane, SUMOReal pos, bool friendlyPos);
249 
250 
263  void addE3Exit(const std::string& lane, SUMOReal pos, bool friendlyPos);
264 
265 
275  void endE3Detector();
276 
277 
285  std::string getCurrentE3ID() const;
286 
287 
301  void buildVTypeProbe(const std::string& id,
302  const std::string& vtype, SUMOTime frequency,
303  const std::string& device);
304 
305 
320  void buildRouteProbe(const std::string& id, const std::string& edge,
321  SUMOTime frequency, SUMOTime begin,
322  const std::string& device);
324 
325 
326 
331 
341  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
342  MSLane* lane, SUMOReal pos, bool splitByType);
343 
344 
354  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
355  MSLane* lane, SUMOReal pos, const std::string& od);
356 
357 #ifdef HAVE_INTERNAL
358 
367  virtual MEInductLoop* createMEInductLoop(const std::string& id,
368  MESegment* s, SUMOReal pos);
369 #endif
370 
371 
384  virtual MSDetectorFileOutput* createSingleLaneE2Detector(const std::string& id,
385  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
386  SUMOTime haltingTimeThreshold,
387  SUMOReal haltingSpeedThreshold,
388  SUMOReal jamDistThreshold);
389 
390 
405  const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos,
406  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
407  SUMOReal jamDistThreshold);
408 
409 
420  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
421  const CrossSectionVector& entries, const CrossSectionVector& exits,
422  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold);
423 
424 
442  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
443  SUMOTime begin, SUMOTime end, const std::string& type,
444  const bool useLanes, const bool withEmpty, const bool printDefaults,
445  const bool withInternal, const bool trackVehicles,
446  const SUMOReal maxTravelTime, const SUMOReal minSamples,
447  const SUMOReal haltSpeed, const std::string& vTypes,
448  const std::string& device);
450 
451 
452 
465  MSDetectorFileOutput* buildSingleLaneE2Det(const std::string& id,
466  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
467  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
468  SUMOReal jamDistThreshold);
469 
470 
483  MSDetectorFileOutput* buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
484  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
485  SUMOReal jamDistThreshold);
486 
487 
488 
489 
490 protected:
496  public:
504  E3DetectorDefinition(const std::string& id,
505  const std::string& device, SUMOReal haltingSpeedThreshold,
506  SUMOTime haltingTimeThreshold, int splInterval);
507 
510 
512  std::string myID;
514  const std::string myDevice;
526 
527  private:
530 
533 
534  };
535 
536 
537 protected:
554  SUMOReal getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos,
555  const std::string& detid);
556 
557 
566  void convUncontE2PosLength(const std::string& id, MSLane* clane,
567  SUMOReal& pos, SUMOReal& length, bool frinedly_pos);
568 
569 
578  void convContE2PosLength(const std::string& id, MSLane* clane,
579  SUMOReal& pos, SUMOReal& length, bool frinedly_pos);
580 
581 
582 
585 
592  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
593  const std::string& detid);
594 
595 
602  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
603  const std::string& detid);
604 
605 
613  void checkSampleInterval(int splInterval, SumoXMLTag type, const std::string& id);
615 
616 
617 protected:
620 
621 
622 private:
625 
626 
627 private:
630 
633 
634 };
635 
636 
637 #endif
638 
639 /****************************************************************************/
640 
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType)
Creates an instance of an e1 detector using the given values.
Builds detectors for microsim.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, int splInterval)
Constructor.
Storage for all programs of a single tls.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
NLDetectorBuilder & operator=(const NLDetectorBuilder &)
Invalidated assignment operator.
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
void addE3Exit(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an exit point of an e3 detector.
std::vector< MSCrossSection > CrossSectionVector
MSDetectorFileOutput * buildMultiLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Builds an e2 detector that continues on preceeding lanes.
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 SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
MSDetectorFileOutput * buildSingleLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Builds an e2 detector that lies on only one lane.
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.
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, int splInterval, const std::string &device, bool friendlyPos, bool splitByType)
Builds an e1 detector and adds it to the net.
void convUncontE2PosLength(const std::string &id, MSLane *clane, SUMOReal &pos, SUMOReal &length, bool frinedly_pos)
Converts the length and the position information for an e2 detector.
The simulated network and simulation perfomer.
Definition: MSNet.h:91
virtual MSDetectorFileOutput * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2 detector using the given values.
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
A road/street connecting two junctions.
Definition: MSEdge.h:74
Holds the incoming definitions of an e3 detector unless the detector is build.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
void beginE3Detector(const std::string &id, const std::string &device, int splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Stores temporary the initial information about an e3 detector to build.
SUMOReal myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device)
Builds a routeProbe and adds it to the net.
CrossSectionVector myExits
List of detector's exits.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Creates an instance of an e3 detector using the given values.
int mySampleInterval
The aggregation interval.
void convContE2PosLength(const std::string &id, MSLane *clane, SUMOReal &pos, SUMOReal &length, bool frinedly_pos)
Converts the length and the position information for an e2ol-detector.
NLDetectorBuilder(MSNet &net)
Constructor.
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od)
Creates an instance of an e1 detector using the given values.
virtual MSDetectorFileOutput * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2ol-detector using the given values.
void checkSampleInterval(int splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
#define SUMOReal
Definition: config.h:215
void buildInstantInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, const std::string &device, bool friendlyPos)
Builds an instantenous induction and adds it to the net.
virtual ~NLDetectorBuilder()
Destructor.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, int splInterval, const std::string &device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos)
Builds an e2 detector with a fixed interval and adds it to the net.
MSNet & myNet
The net to fill.
CrossSectionVector myEntries
List of detector's entries.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
SUMOReal getPositionChecking(SUMOReal pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
const std::string myDevice
The device the detector shall use.
std::string myID
The id of the detector.
Base of value-generating classes (detectors)
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.