SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSE3Collector.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A detector of vehicles passing an area between entry/exit points
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSE3Collector_h
23 #define MSE3Collector_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <cassert>
37 #include <vector>
38 #include <limits>
41 #include <utils/common/Named.h>
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class SUMOVehicle;
50 class OutputDevice;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
66 public:
72  public:
78  MSE3EntryReminder(const MSCrossSection& crossSection, MSE3Collector& collector) ;
79 
80 
83 
99  bool notifyMove(SUMOVehicle& veh, SUMOReal , SUMOReal newPos, SUMOReal) ;
100 
101 
112  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) ;
114 
115 
116  private:
119 
122 
123  private:
126 
129 
130  };
131 
132 
133 
139  public:
145  MSE3LeaveReminder(const MSCrossSection& crossSection, MSE3Collector& collector) ;
146 
147 
149 
150 
166  bool notifyMove(SUMOVehicle& veh, SUMOReal , SUMOReal newPos, SUMOReal) ;
168 
169 
170  private:
173 
176 
177  private:
180 
183 
184  };
185 
186 
197  MSE3Collector(const std::string& id,
198  const CrossSectionVector& entries, const CrossSectionVector& exits,
199  SUMOReal haltingSpeedThreshold,
200  SUMOTime haltingTimeThreshold) ;
201 
202 
204  virtual ~MSE3Collector() ;
205 
206 
209  void reset() ;
210 
211 
219  void enter(SUMOVehicle& veh, SUMOReal entryTimestep) ;
220 
221 
229  void leave(SUMOVehicle& veh, SUMOReal leaveTimestep) ;
230 
231 
234 
241  SUMOReal getCurrentMeanSpeed() const ;
242 
243 
251 
252 
256  SUMOReal getVehiclesWithin() const ;
257 
258 
263  std::vector<std::string> getCurrentVehicleIDs() const ;
265 
266 
269 
278  void writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime);
279 
280 
289  void writeXMLDetectorProlog(OutputDevice& dev) const;
291 
292 
293 
302  void detectorUpdate(const SUMOTime step) ;
303 
304 
305 protected:
308 
311 
313  std::vector<MSE3EntryReminder*> myEntryReminders;
314 
316  std::vector<MSE3LeaveReminder*> myLeaveReminders;
317 
318 
319  // @brief Time-threshold to determine if a vehicle is halting.
321 
324 
333  struct E3Values {
341  unsigned haltings;
349  bool hadUpdate;
350  };
351 
353  std::map<SUMOVehicle*, E3Values> myEnteredContainer;
354 
356  std::map<SUMOVehicle*, E3Values> myLeftContainer;
357 
358 
361 
364 
367 
375 
376 
379 
380 
381 private:
384 
387 
388 
389 };
390 
391 
392 #endif
393 
394 /****************************************************************************/
395