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-sim.org/
12 // Copyright (C) 2001-2013 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 <vector>
37 #include <limits>
40 #include <utils/common/Named.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class SUMOVehicle;
49 class OutputDevice;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
65 public:
71  public:
77  MSE3EntryReminder(const MSCrossSection& crossSection, MSE3Collector& collector);
78 
79 
82 
98  bool notifyMove(SUMOVehicle& veh, SUMOReal , SUMOReal newPos, SUMOReal);
99 
100 
111  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason);
113 
114 
115  private:
118 
121 
122  private:
125 
128 
129  };
130 
131 
132 
138  public:
144  MSE3LeaveReminder(const MSCrossSection& crossSection, MSE3Collector& collector);
145 
146 
148 
149 
165  bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal);
166 
176  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason);
178 
179 
180  private:
183 
186 
187  private:
190 
193 
194  };
195 
196 
207  MSE3Collector(const std::string& id,
208  const CrossSectionVector& entries, const CrossSectionVector& exits,
209  SUMOReal haltingSpeedThreshold,
210  SUMOTime haltingTimeThreshold);
211 
212 
214  virtual ~MSE3Collector();
215 
216 
219  void reset();
220 
221 
229  void enter(SUMOVehicle& veh, SUMOReal entryTimestep);
230 
231 
239  void leave(SUMOVehicle& veh, SUMOReal leaveTimestep);
240 
241 
244 
252 
253 
261 
262 
266  SUMOReal getVehiclesWithin() const;
267 
268 
273  std::vector<std::string> getCurrentVehicleIDs() const;
275 
276 
279 
288  void writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime);
289 
290 
299  void writeXMLDetectorProlog(OutputDevice& dev) const;
301 
302 
303 
312  void detectorUpdate(const SUMOTime step);
313 
314 
315 protected:
318 
321 
323  std::vector<MSE3EntryReminder*> myEntryReminders;
324 
326  std::vector<MSE3LeaveReminder*> myLeaveReminders;
327 
328 
329  // @brief Time-threshold to determine if a vehicle is halting.
331 
334 
343  struct E3Values {
351  unsigned haltings;
359  bool hadUpdate;
360  };
361 
363  std::map<SUMOVehicle*, E3Values> myEnteredContainer;
364 
366  std::map<SUMOVehicle*, E3Values> myLeftContainer;
367 
368 
371 
374 
377 
385 
386 
389 
390 
391 private:
394 
397 
398 
399 };
400 
401 
402 #endif
403 
404 /****************************************************************************/
405 
SUMOReal getCurrentHaltingNumber() const
Returns the number of current haltings within the area.
MSE3LeaveReminder & operator=(const MSE3LeaveReminder &)
Invalidated assignment operator.
std::map< SUMOVehicle *, E3Values > myLeftContainer
Container for vehicles that have left the area.
virtual ~MSE3Collector()
Destructor.
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Processes state changes of a vehicle.
A simple description of a position on a lane (crossing of a lane)
std::vector< MSE3EntryReminder * > myEntryReminders
The detector&#39;s built entry reminder.
SUMOReal entryTime
The vehicle&#39;s entry time.
bool hadUpdate
An internal information whether the update step was performed.
A place on the road net (at a certain lane and position on it) where the E3 area ends.
MSE3EntryReminder(const MSCrossSection &crossSection, MSE3Collector &collector)
Constructor.
A place on the road net (at a certain lane and position on it) where the E3 area begins.
Definition: MSE3Collector.h:70
SUMOReal myCurrentHaltingsNumber
The current number of haltings (inside)
SUMOReal myPosition
The position on the lane.
Notification
Definition of a vehicle state.
std::vector< MSCrossSection > CrossSectionVector
void enter(SUMOVehicle &veh, SUMOReal entryTimestep)
Called if a vehicle touches an entry-cross-section.
SUMOTime myLastResetTime
Information when the last reset has been done.
std::vector< MSE3LeaveReminder * > myLeaveReminders
The detector&#39;s built exit reminder.
SUMOReal haltingBegin
Begin time of last halt begin.
SUMOReal myPosition
The position on the lane.
SUMOReal leaveTime
The vehicle&#39;s leaving time.
MSE3EntryReminder & operator=(const MSE3EntryReminder &)
Invalidated assignment operator.
Representation of a vehicle.
Definition: SUMOVehicle.h:63
Internal storage for values from a vehicle.
void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using &quot;e3Detector&quot; as root element.
SUMOTime myHaltingTimeThreshold
MSE3Collector & operator=(const MSE3Collector &)
Invalidated assignment operator.
void leave(SUMOVehicle &veh, SUMOReal leaveTimestep)
Called if a vehicle passes a leave-cross-section.
MSE3Collector & myCollector
The parent collector.
SUMOReal myHaltingSpeedThreshold
Speed-threshold to determine if a vehicle is halting.
Something on a lane to be noticed about vehicle movement.
MSE3LeaveReminder(const MSCrossSection &crossSection, MSE3Collector &collector)
Constructor.
CrossSectionVector myEntries
The detector&#39;s entries.
SUMOReal myCurrentTouchedVehicles
The current number of vehicles inside;.
unsigned haltings
The sum of haltings the vehicle has/had within the area.
void reset()
Resets all generated values to allow computation of next interval.
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:64
bool notifyMove(SUMOVehicle &veh, SUMOReal, SUMOReal newPos, SUMOReal)
Checks whether the vehicle enters.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
#define SUMOReal
Definition: config.h:215
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Processes state changes of a vehicle.
SUMOReal speedSum
The sum of registered speeds the vehicle has/had inside the area.
SUMOReal getCurrentMeanSpeed() const
Returns the mean speed within the area.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal)
Checks whether the vehicle leaves.
SUMOReal getVehiclesWithin() const
Returns the number of vehicles within the area.
unsigned intervalHaltings
The sum of haltings the vehicle has/had within the area during the current interval.
void detectorUpdate(const SUMOTime step)
Computes the detector values in each time step.
std::map< SUMOVehicle *, E3Values > myEnteredContainer
Container for vehicles that have entered the area.
MSE3Collector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Constructor.
SUMOReal intervalSpeedSum
The sum of registered speeds the vehicle has/had inside the area during the current interval...
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes collected values into the given stream.
MSE3Collector & myCollector
The parent collector.
Base of value-generating classes (detectors)
std::vector< std::string > getCurrentVehicleIDs() const
Returns the number of vehicles within the area.
CrossSectionVector myExits
The detector&#39;s exits.
SUMOReal myCurrentMeanSpeed
The current mean speed of known vehicles (inside)