SUMO - Simulation of Urban MObility

NLDetectorBuilder.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Builds detectors for microsim
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef NLDetectorBuilder_h
00020 #define NLDetectorBuilder_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <microsim/MSNet.h>
00034 #include <microsim/traffic_lights/MSTLLogicControl.h>
00035 #include <microsim/output/MSE3Collector.h>
00036 
00037 
00038 // ===========================================================================
00039 // class declarations
00040 // ===========================================================================
00041 class MSDetectorFileOutput;
00042 class MSLane;
00043 class MSEdge;
00044 
00045 #ifdef HAVE_MESOSIM
00046 class MEInductLoop;
00047 class MESegment;
00048 #endif
00049 
00050 
00051 // ===========================================================================
00052 // class definitions
00053 // ===========================================================================
00061 class NLDetectorBuilder {
00062 public:
00067     NLDetectorBuilder(MSNet& net) throw();
00068 
00069 
00071     virtual ~NLDetectorBuilder() throw();
00072 
00073 
00076 
00097     void buildInductLoop(const std::string& id,
00098                          const std::string& lane, SUMOReal pos, int splInterval,
00099                          OutputDevice& device, bool friendlyPos, bool splitByType) throw(InvalidArgument);
00100 
00101 
00117     void buildInstantInductLoop(const std::string& id,
00118                                 const std::string& lane, SUMOReal pos,
00119                                 OutputDevice& device, bool friendlyPos) throw(InvalidArgument);
00120 
00121 
00146     void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
00147                          bool cont, int splInterval, OutputDevice& device, SUMOTime haltingTimeThreshold,
00148                          SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
00149                          bool friendlyPos) throw(InvalidArgument);
00150 
00151 
00176     void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
00177                          bool cont, MSTLLogicControl::TLSLogicVariants& tlls,
00178                          OutputDevice& device, SUMOTime haltingTimeThreshold,
00179                          SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
00180                          bool friendlyPos) throw(InvalidArgument);
00181 
00182 
00208     void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length,
00209                          bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& tolane,
00210                          OutputDevice& device, SUMOTime haltingTimeThreshold,
00211                          SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold,
00212                          bool friendlyPos) throw(InvalidArgument);
00213 
00214 
00228     void beginE3Detector(const std::string& id, OutputDevice& device, int splInterval,
00229                          SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold) throw(InvalidArgument);
00230 
00231 
00244     void addE3Entry(const std::string& lane, SUMOReal pos, bool friendlyPos) throw(InvalidArgument);
00245 
00246 
00259     void addE3Exit(const std::string& lane, SUMOReal pos, bool friendlyPos) throw(InvalidArgument);
00260 
00261 
00271     void endE3Detector() throw(InvalidArgument);
00272 
00273 
00281     std::string getCurrentE3ID() const throw();
00282 
00283 
00297     void buildVTypeProbe(const std::string& id,
00298                          const std::string& vtype, SUMOTime frequency,
00299                          OutputDevice& device) throw(InvalidArgument);
00300 
00301 
00316     void buildRouteProbe(const std::string& id, const std::string& edge,
00317                          SUMOTime frequency, SUMOTime begin,
00318                          OutputDevice& device) throw(InvalidArgument);
00320 
00321 
00322 
00327 
00337     virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
00338             MSLane* lane, SUMOReal pos, bool splitByType) throw();
00339 
00340 
00350     virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
00351             MSLane* lane, SUMOReal pos, OutputDevice& od) throw();
00352 
00353 #ifdef HAVE_MESOSIM
00354 
00363     virtual MEInductLoop* createMEInductLoop(const std::string& id,
00364             MESegment* s, SUMOReal pos) throw();
00365 #endif
00366 
00367 
00380     virtual MSDetectorFileOutput* createSingleLaneE2Detector(const std::string& id,
00381             DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
00382             SUMOTime haltingTimeThreshold,
00383             SUMOReal haltingSpeedThreshold,
00384             SUMOReal jamDistThreshold) throw();
00385 
00386 
00400     virtual MSDetectorFileOutput* createMultiLaneE2Detector(
00401         const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos,
00402         SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
00403         SUMOReal jamDistThreshold) throw();
00404 
00405 
00416     virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
00417             const CrossSectionVector& entries, const CrossSectionVector& exits,
00418             SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold) throw();
00419 
00420 
00438     void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
00439                                 SUMOTime begin, SUMOTime end, const std::string& type,
00440                                 const bool useLanes, const bool withEmpty, const bool withInternal, const bool trackVehicles,
00441                                 const SUMOReal maxTravelTime, const SUMOReal minSamples,
00442                                 const SUMOReal haltSpeed, const std::string& vTypes,
00443                                 OutputDevice& device) throw(InvalidArgument);
00445 
00446 
00447 
00460     MSDetectorFileOutput* buildSingleLaneE2Det(const std::string& id,
00461             DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
00462             SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
00463             SUMOReal jamDistThreshold) throw();
00464 
00465 
00478     MSDetectorFileOutput* buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length,
00479             SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold,
00480             SUMOReal jamDistThreshold) throw();
00481 
00482 
00483 
00484 
00485 protected:
00490     class E3DetectorDefinition {
00491     public:
00499         E3DetectorDefinition(const std::string& id,
00500                              OutputDevice& device, SUMOReal haltingSpeedThreshold,
00501                              SUMOTime haltingTimeThreshold, int splInterval) throw();
00502 
00504         ~E3DetectorDefinition() throw();
00505 
00507         std::string myID;
00509         OutputDevice& myDevice;
00511         SUMOReal myHaltingSpeedThreshold;
00513         SUMOTime myHaltingTimeThreshold;
00515         CrossSectionVector myEntries;
00517         CrossSectionVector myExits;
00519         int mySampleInterval;
00521 
00522     private:
00524         E3DetectorDefinition(const E3DetectorDefinition&);
00525 
00527         E3DetectorDefinition& operator=(const E3DetectorDefinition&);
00528 
00529     };
00530 
00531 
00532 protected:
00549     SUMOReal getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos,
00550                                  const std::string& detid) throw(InvalidArgument);
00551 
00552 
00561     void convUncontE2PosLength(const std::string& id, MSLane* clane,
00562                                SUMOReal& pos, SUMOReal& length, bool frinedly_pos) throw(InvalidArgument);
00563 
00564 
00573     void convContE2PosLength(const std::string& id, MSLane* clane,
00574                              SUMOReal& pos, SUMOReal& length, bool frinedly_pos) throw(InvalidArgument);
00575 
00576 
00577 
00580 
00587     MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
00588                             const std::string& detid) throw(InvalidArgument);
00589 
00590 
00597     MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
00598                             const std::string& detid) throw(InvalidArgument);
00599 
00600 
00608     void checkSampleInterval(int splInterval, SumoXMLTag type, const std::string& id) throw(InvalidArgument);
00610 
00611 
00612 protected:
00614     MSNet& myNet;
00615 
00616 
00617 private:
00619     E3DetectorDefinition* myE3Definition;
00620 
00621 
00622 private:
00624     NLDetectorBuilder(const NLDetectorBuilder&);
00625 
00627     NLDetectorBuilder& operator=(const NLDetectorBuilder&);
00628 
00629 };
00630 
00631 
00632 #endif
00633 
00634 /****************************************************************************/
00635 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines