00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NLDetectorBuilder_h
00020 #define NLDetectorBuilder_h
00021
00022
00023
00024
00025
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031
00032 #include <string>
00033 #include <utils/common/PhysicalTypeDefs.h>
00034 #include <microsim/MSNet.h>
00035 #include <microsim/output/MSE2Collector.h>
00036 #include <microsim/output/MSE3Collector.h>
00037 #include <microsim/traffic_lights/MSTLLogicControl.h>
00038
00039 #ifdef _MESSAGES
00040 #include <microsim/output/MSMsgInductLoop.h>
00041 #endif
00042
00043
00044
00045
00046
00047 class MSInductLoop;
00048 class MS_E2_ZS_CollectorOverLanes;
00049 class MSTrafficLightLogic;
00050 class MSDetectorControl;
00051 class MSLane;
00052
00053 #ifdef HAVE_MESOSIM
00054 class MEInductLoop;
00055 class MESegment;
00056 #endif
00057
00058
00059
00060
00061
00069 class NLDetectorBuilder {
00070 public:
00075 NLDetectorBuilder(MSNet &net) throw();
00076
00077
00079 virtual ~NLDetectorBuilder() throw();
00080
00081
00084
00085 #ifdef _MESSAGES
00086
00091 void
00092 buildMsgDetector(const std::string &id,
00093 const std::string &lane, SUMOReal pos, int splInterval,
00094 const std::string &msg,
00095 OutputDevice& device, bool friendlyPos) throw(InvalidArgument);
00096 #endif
00097
00117 void buildInductLoop(const std::string &id,
00118 const std::string &lane, SUMOReal pos, int splInterval,
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 MetersPerSecond 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 MetersPerSecond 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 MetersPerSecond haltingSpeedThreshold, SUMOReal jamDistThreshold,
00212 bool friendlyPos) throw(InvalidArgument);
00213
00214
00228 void beginE3Detector(const std::string &id, OutputDevice& device, int splInterval,
00229 MetersPerSecond 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
00328 #ifdef _MESSAGES
00329
00333 virtual MSMsgInductLoop *createMsgInductLoop(const std::string &id, const std::string &msg,
00334 MSLane *lane, SUMOReal pos) throw();
00335 #endif
00336
00345 virtual MSInductLoop *createInductLoop(const std::string &id,
00346 MSLane *lane, SUMOReal pos) throw();
00347
00348
00349 #ifdef HAVE_MESOSIM
00350
00359 virtual MEInductLoop *createMEInductLoop(const std::string &id,
00360 MESegment *s, SUMOReal pos) throw();
00361 #endif
00362
00363
00376 virtual MSE2Collector *createSingleLaneE2Detector(const std::string &id,
00377 DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length,
00378 SUMOTime haltingTimeThreshold,
00379 MetersPerSecond haltingSpeedThreshold,
00380 SUMOReal jamDistThreshold) throw();
00381
00382
00396 virtual MS_E2_ZS_CollectorOverLanes *createMultiLaneE2Detector(
00397 const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos,
00398 SUMOTime haltingTimeThreshold, MetersPerSecond haltingSpeedThreshold,
00399 SUMOReal jamDistThreshold) throw();
00400
00401
00412 virtual MSE3Collector *createE3Detector(const std::string &id,
00413 const CrossSectionVector &entries, const CrossSectionVector &exits,
00414 MetersPerSecond haltingSpeedThreshold, SUMOTime haltingTimeThreshold) throw();
00415
00416
00434 void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency,
00435 SUMOTime begin, SUMOTime end, const std::string &type,
00436 const bool useLanes, const bool withEmpty, const bool withInternal, const bool trackVehicles,
00437 const SUMOReal maxTravelTime, const SUMOReal minSamples,
00438 const SUMOReal haltSpeed, const std::string &vTypes,
00439 OutputDevice& device) throw(InvalidArgument);
00441
00442
00443
00456 MSE2Collector *buildSingleLaneE2Det(const std::string &id,
00457 DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length,
00458 SUMOTime haltingTimeThreshold, MetersPerSecond haltingSpeedThreshold,
00459 SUMOReal jamDistThreshold) throw();
00460
00461
00474 MS_E2_ZS_CollectorOverLanes *buildMultiLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length,
00475 SUMOTime haltingTimeThreshold, MetersPerSecond haltingSpeedThreshold,
00476 SUMOReal jamDistThreshold) throw();
00477
00478
00479
00480
00481 protected:
00486 class E3DetectorDefinition {
00487 public:
00495 E3DetectorDefinition(const std::string &id,
00496 OutputDevice& device, MetersPerSecond haltingSpeedThreshold,
00497 SUMOTime haltingTimeThreshold, int splInterval) throw();
00498
00500 ~E3DetectorDefinition() throw();
00501
00503 std::string myID;
00505 OutputDevice& myDevice;
00507 MetersPerSecond myHaltingSpeedThreshold;
00509 SUMOTime myHaltingTimeThreshold;
00511 CrossSectionVector myEntries;
00513 CrossSectionVector myExits;
00515 int mySampleInterval;
00517
00518 private:
00520 E3DetectorDefinition(const E3DetectorDefinition&);
00521
00523 E3DetectorDefinition& operator=(const E3DetectorDefinition&);
00524
00525 };
00526
00527
00528 protected:
00537 MSLane *getLaneChecking(const std::string &id,
00538 const std::string &detid) throw(InvalidArgument);
00539
00540
00557 SUMOReal getPositionChecking(SUMOReal pos, MSLane *lane, bool friendlyPos,
00558 const std::string &detid) throw(InvalidArgument);
00559
00560
00569 void convUncontE2PosLength(const std::string &id, MSLane *clane,
00570 SUMOReal &pos, SUMOReal &length, bool frinedly_pos) throw(InvalidArgument);
00571
00572
00581 void convContE2PosLength(const std::string &id, MSLane *clane,
00582 SUMOReal &pos, SUMOReal &length, bool frinedly_pos) throw(InvalidArgument);
00583
00584
00585 protected:
00587 MSNet &myNet;
00588
00589
00590 private:
00592 E3DetectorDefinition *myE3Definition;
00593
00594
00595 private:
00597 NLDetectorBuilder(const NLDetectorBuilder&);
00598
00600 NLDetectorBuilder& operator=(const NLDetectorBuilder&);
00601
00602 };
00603
00604
00605 #endif
00606
00607
00608