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-2016 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>
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
45 class MSLane;
46 class MSEdge;
47 
48 class MEInductLoop;
49 class MESegment;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
63 public:
69 
70 
72  virtual ~NLDetectorBuilder();
73 
74 
77 
98  void buildInductLoop(const std::string& id,
99  const std::string& lane, SUMOReal pos, SUMOTime splInterval,
100  const std::string& device, bool friendlyPos,
101  const std::string& vTypes);
102 
103 
119  void buildInstantInductLoop(const std::string& id,
120  const std::string& lane, SUMOReal pos,
121  const std::string& device, bool friendlyPos,
122  const std::string& vTypes);
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  const std::string& vTypes);
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  const std::string& vTypes);
186 
187 
213  void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
214  bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& tolane,
215  const std::string& device, SUMOTime haltingTimeThreshold,
216  SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
217  bool friendlyPos,
218  const std::string& vTypes);
219 
220 
234  void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
235  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
236  const std::string& vTypes);
237 
238 
251  void addE3Entry(const std::string& lane, SUMOReal pos, bool friendlyPos);
252 
253 
266  void addE3Exit(const std::string& lane, SUMOReal pos, bool friendlyPos);
267 
268 
278  void endE3Detector();
279 
280 
288  std::string getCurrentE3ID() const;
289 
290 
304  void buildVTypeProbe(const std::string& id,
305  const std::string& vtype, SUMOTime frequency,
306  const std::string& device);
307 
308 
323  void buildRouteProbe(const std::string& id, const std::string& edge,
324  SUMOTime frequency, SUMOTime begin,
325  const std::string& device,
326  const std::string& vTypes);
328 
329 
330 
335 
346  virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
347  MSLane* lane, SUMOReal pos,
348  const std::string& vTypes, bool show = true);
349 
350 
360  virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
361  MSLane* lane, SUMOReal pos, const std::string& od,
362  const std::string& vTypes);
363 
376  virtual MSE2Collector* createSingleLaneE2Detector(const std::string& id,
377  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
378  SUMOTime haltingTimeThreshold,
379  SUMOReal haltingSpeedThreshold,
380  SUMOReal jamDistThreshold,
381  const std::string& vTypes);
382 
383 
398  const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos,
399  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
400  SUMOReal jamDistThreshold,
401  const std::string& vTypes);
402 
403 
414  virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
415  const CrossSectionVector& entries, const CrossSectionVector& exits,
416  SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
417  const std::string& vTypes);
418 
419 
437  void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
438  SUMOTime begin, SUMOTime end, const std::string& type,
439  const bool useLanes, const bool withEmpty, const bool printDefaults,
440  const bool withInternal, const bool trackVehicles,
441  const SUMOReal maxTravelTime, const SUMOReal minSamples,
442  const SUMOReal haltSpeed, const std::string& vTypes,
443  const std::string& device);
445 
446 
447 
460  MSE2Collector* buildSingleLaneE2Det(const std::string& id,
461  DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
462  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
463  SUMOReal jamDistThreshold,
464  const std::string& vTypes);
465 
466 
479  MSDetectorFileOutput* buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
480  SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
481  SUMOReal jamDistThreshold,
482  const std::string& vTypes);
483 
484 
485 
486 
487 protected:
493  public:
501  E3DetectorDefinition(const std::string& id,
502  const std::string& device, SUMOReal haltingSpeedThreshold,
503  SUMOTime haltingTimeThreshold, SUMOTime splInterval,
504  const std::string& vTypes);
505 
508 
510  const std::string myID;
512  const std::string myDevice;
524  const std::string myVehicleTypes;
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(SUMOTime 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.
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:43
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od, const std::string &vTypes)
Creates an instance of an e1 detector using the given values.
Storage for all programs of a single tls.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
An areal (along a single lane) detector.
Definition: MSE2Collector.h:83
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
const std::string myID
The id of the detector.
MSDetectorFileOutput * buildMultiLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Builds an e2 detector that continues on preceeding lanes.
void addE3Exit(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an exit point of an e3 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.
void buildInstantInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an instantenous induction and adds it to the net.
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.
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an e1 detector and adds it to the net.
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:93
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes)
Creates an instance of an e3 detector using the given values.
const std::string myVehicleTypes
The device the detector shall use.
A road/street connecting two junctions.
Definition: MSEdge.h:80
Holds the incoming definitions of an e3 detector unless the detector is build.
MSE2Collector * buildSingleLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Builds an e2 detector that lies on only one lane.
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, const std::string &vTypes)
Builds an e2 detector with a fixed interval and adds it to the net.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
SUMOReal myHaltingSpeedThreshold
The speed a vehicle&#39;s speed must be below to be assigned as jammed.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
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 * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Creates an instance of an e2ol-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.
A single mesoscopic segment (cell)
Definition: MESegment.h:57
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
virtual MSE2Collector * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, const std::string &vTypes)
Creates an instance of an e2 detector using the given values.
#define SUMOReal
Definition: config.h:213
virtual ~NLDetectorBuilder()
Destructor.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes)
Stores temporary the initial information about an e3 detector to build.
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:79
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.
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:55
Base of value-generating classes (detectors)
SUMOTime myHaltingTimeThreshold
The time a vehicle&#39;s speed must be below haltingSpeedThreshold to be assigned as jammed.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes)
Constructor.