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-2015 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>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
45 class MSLane;
46 class MSEdge;
47 
48 #ifdef HAVE_INTERNAL
49 class MEInductLoop;
50 class MESegment;
51 #endif
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
65 public:
71 
72 
74  virtual ~NLDetectorBuilder();
75 
76 
79 
100  void buildInductLoop(const std::string& id,
101  const std::string& lane, SUMOReal pos, SUMOTime splInterval,
102  const std::string& device, bool friendlyPos, bool splitByType);
103 
104 
120  void buildInstantInductLoop(const std::string& id,
121  const std::string& lane, SUMOReal pos,
122  const std::string& device, bool friendlyPos);
123 
124 
149  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
150  bool cont, SUMOTime splInterval, const std::string& device, SUMOTime haltingTimeThreshold,
151  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
152  bool friendlyPos);
153 
154 
179  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
180  bool cont, MSTLLogicControl::TLSLogicVariants& tlls,
181  const std::string& device, SUMOTime haltingTimeThreshold,
182  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
183  bool friendlyPos);
184 
185 
211  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
212  bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& tolane,
213  const std::string& device, SUMOTime haltingTimeThreshold,
214  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
215  bool friendlyPos);
216 
217 
231  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
232  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold);
233 
234 
247  void addE3Entry(const std::string& lane, SUMOReal pos, bool friendlyPos);
248 
249 
262  void addE3Exit(const std::string& lane, SUMOReal pos, bool friendlyPos);
263 
264 
274  void endE3Detector();
275 
276 
284  std::string getCurrentE3ID() const;
285 
286 
300  void buildVTypeProbe(const std::string& id,
301  const std::string& vtype, SUMOTime frequency,
302  const std::string& device);
303 
304 
319  void buildRouteProbe(const std::string& id, const std::string& edge,
320  SUMOTime frequency, SUMOTime begin,
321  const std::string& device);
323 
324 
325 
330 
341  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
342  MSLane* lane, SUMOReal pos, bool splitByType, bool show = true);
343 
344 
354  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
355  MSLane* lane, SUMOReal pos, const std::string& od);
356 
369  virtual MSDetectorFileOutput* createSingleLaneE2Detector(const std::string& id,
370  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
371  SUMOTime haltingTimeThreshold,
372  SUMOReal haltingSpeedThreshold,
373  SUMOReal jamDistThreshold);
374 
375 
390  const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos,
391  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
392  SUMOReal jamDistThreshold);
393 
394 
405  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
406  const CrossSectionVector& entries, const CrossSectionVector& exits,
407  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold);
408 
409 
427  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
428  SUMOTime begin, SUMOTime end, const std::string& type,
429  const bool useLanes, const bool withEmpty, const bool printDefaults,
430  const bool withInternal, const bool trackVehicles,
431  const SUMOReal maxTravelTime, const SUMOReal minSamples,
432  const SUMOReal haltSpeed, const std::string& vTypes,
433  const std::string& device);
435 
436 
437 
450  MSDetectorFileOutput* buildSingleLaneE2Det(const std::string& id,
451  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
452  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
453  SUMOReal jamDistThreshold);
454 
455 
468  MSDetectorFileOutput* buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
469  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
470  SUMOReal jamDistThreshold);
471 
472 
473 
474 
475 protected:
481  public:
489  E3DetectorDefinition(const std::string& id,
490  const std::string& device, SUMOReal haltingSpeedThreshold,
491  SUMOTime haltingTimeThreshold, SUMOTime splInterval);
492 
495 
497  std::string myID;
499  const std::string myDevice;
511 
512  private:
515 
518 
519  };
520 
521 
522 protected:
539  SUMOReal getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos,
540  const std::string& detid);
541 
542 
551  void convUncontE2PosLength(const std::string& id, MSLane* clane,
552  SUMOReal& pos, SUMOReal& length, bool frinedly_pos);
553 
554 
563  void convContE2PosLength(const std::string& id, MSLane* clane,
564  SUMOReal& pos, SUMOReal& length, bool frinedly_pos);
565 
566 
567 
570 
577  MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
578  const std::string& detid);
579 
580 
587  MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
588  const std::string& detid);
589 
590 
598  void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
600 
601 
602 protected:
605 
606 
607 private:
610 
611 
612 private:
615 
618 
619 };
620 
621 
622 #endif
623 
624 /****************************************************************************/
625 
SumoXMLTag
Numbers representing SUMO-XML - element names.
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:43
Storage for all programs of a single tls.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval)
Constructor.
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, bool splitByType)
Builds an e1 detector and adds it to the net.
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 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:94
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:81
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.
SUMOReal myHaltingSpeedThreshold
The speed a vehicle&#39;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&#39;s exits.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
SUMOTime mySampleInterval
The aggregation interval.
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.
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(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, SUMOTime 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.
#define SUMOReal
Definition: config.h:214
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
MSNet & myNet
The net to fill.
CrossSectionVector myEntries
List of detector&#39;s entries.
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Stores temporary the initial information about an e3 detector to build.
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)
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType, bool show=true)
Creates an instance of an e1 detector using the given values.
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.