 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
22 #ifndef MSE2Collector_h
23 #define MSE2Collector_h
162 MoveNotificationInfo(std::string _vehID,
double _oldPos,
double _newPos,
double _speed,
double _accel,
double _distToDetectorEnd,
double _timeOnDetector,
double _lengthOnDetector,
double _timeLoss,
bool _onDetector) :
236 SUMOTime haltingTimeThreshold,
double haltingSpeedThreshold,
double jamDistThreshold,
237 const std::string& vTypes);
253 DetectorUsage usage, std::vector<MSLane*> lanes,
double startPos,
double endPos,
254 SUMOTime haltingTimeThreshold,
double haltingSpeedThreshold,
double jamDistThreshold,
255 const std::string& vTypes);
410 virtual void reset();
527 bool checkJam(std::vector<MoveNotificationInfo*>::const_iterator mni, std::map<std::string, SUMOTime>& haltingVehicles, std::map<std::string, SUMOTime>& intervalHaltingVehicles);
537 void buildJam(
bool isInJam, std::vector<MoveNotificationInfo*>::const_iterator mni, JamInfo*& currentJam, std::vector<JamInfo*>& jams);
544 void processJams(std::vector<JamInfo*>& jams, JamInfo* currentJam);
569 static double snap(
double value,
double snapPoint,
double snapDist);
587 std::vector<MSLane*>
selectLanes(
MSLane* endLane,
double length, std::string dir);
MSE2Collector(const std::string &id, DetectorUsage usage, MSLane *lane, double startPos, double endPos, double length, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes)
Constructor with given end position and detector length.
Representation of a vehicle or person.
double getEstimateQueueLength() const
Returns an estimate of the length of the queue of vehicles currently stopped on the detector.
double newPos
Position after the last integration step (relative to the vehicle's entry lane on the detector)
double myMaxOccupancy
The maximum occupancy [%].
double myTotalTimeLoss
The total amount of all time losses [time x vehicle] since the last reset.
int getCurrentJamLengthInVehicles() const
Returns the length of all jams in vehicles.
Internal representation of a jam.
Base of value-generating classes (detectors)
bool checkJam(std::vector< MoveNotificationInfo * >::const_iterator mni, std::map< std::string, SUMOTime > &haltingVehicles, std::map< std::string, SUMOTime > &intervalHaltingVehicles)
checks whether the vehicle stands in a jam
double getCurrentMeanLength() const
Returns the mean vehicle length of vehicles currently on the detector.
Representation of a lane in the micro simulation.
double getCurrentOccupancy() const
Returns the current detector occupancy.
bool onDetector
whether the vehicle is on the detector at the end of the current timestep
Static storage of an output device and its base (abstract) implementation.
double lastAccel
Last value of the acceleration.
int myNumberOfEnteredVehicles
double getEndPos() const
Returns the end position of the detector.
int myMeanVehicleNumber
The mean number of vehicles [#veh].
std::vector< MoveNotificationInfo * >::const_iterator lastStandingVehicle
The last standing vehicle.
int myCurrentStartedHalts
The number of started halts in the last step.
std::vector< MoveNotificationInfo * > myMoveNotifications
Temporal storage for notifications from vehicles that did call the detector's notifyMove() in the las...
std::size_t currentOffsetIndex
Index of currentLane in the detector's myLanes vector.
virtual bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Removes a known vehicle due to its lane-change.
Values collected in notifyMove and needed in detectorUpdate() to calculate the accumulated quantities...
int myMeanMaxJamInVehicles
The mean jam length [#veh].
Representation of a vehicle.
std::string id
Vehicle's id.
double totalTimeOnDetector
Accumulated time that this vehicle has spent on the detector since its last entry.
void checkPositioning(bool posGiven=false, double desiredLength=0.)
Adjusts positioning if the detector length is less than POSITION_EPS and tests some assertions.
double lastSpeed
Last value of the speed.
void recalculateDetectorLength()
Updates the detector length after myStartPos and myEndPos have been modified.
double minGap
vehicle's minGap
An areal detector corresponding to a sequence of consecutive lanes.
int myTimeSamples
The current aggregation duration [#steps].
static bool compareMoveNotification(MoveNotificationInfo *mni1, MoveNotificationInfo *mni2)
std::vector< VehicleInfo * > getCurrentVehicles() const
Returns the VehicleInfos for the vehicles currently on the detector.
virtual ~MSE2Collector()
Destructor.
double myCurrentMeanLength
The current mean length.
std::vector< MoveNotificationInfo * >::const_iterator firstStandingVehicle
The first standing vehicle.
double getLength() const
Returns the length of the detector.
static double snap(double value, double snapPoint, double snapDist)
Snaps value to snpPoint if they are closer than snapDist.
int myCurrentJamLengthInVehicles
The overall jam length in vehicles.
double myJamHaltingSpeedThreshold
A vehicle must driver slower than this to be counted as a part of a jam.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
std::vector< SUMOTime > myPastStandingDurations
Halting durations of ended halts [s].
std::vector< std::string > myLanes
VehicleInfo * makeVehicleInfo(const SUMOVehicle &veh, const MSLane *enteredLane) const
Creates and returns a VehicleInfo (called at the vehicle's entry)
double getStartPos() const
Returns the begin position of the detector.
double mySpeedSum
The sum of collected vehicle speeds [m/s].
int myCurrentMaxJamLengthInVehicles
The current maximum jam length in vehicles.
VehicleInfo(std::string id, std::string type, double length, double minGap, const MSLane *entryLane, double entryOffset, std::size_t currentOffsetIndex, double exitOffset, double distToDetectorEnd, bool onDetector)
Something on a lane to be noticed about vehicle movement.
double lengthOnDetector
The length of the part of the vehicle on the detector at the end of the last time step.
double timeOnDetector
Time spent on the detector during the last integration step.
double getCurrentMeanSpeed() const
Returns the mean vehicle speed of vehicles currently on the detector.
std::string id
vehicle's ID
double myCurrentMeanSpeed
The current mean speed.
MSE2Collector & operator=(const MSE2Collector &)
Invalidated assignment operator.
void processJams(std::vector< JamInfo * > &jams, JamInfo *currentJam)
Calculates aggregated values from the given jam structure, deletes all jam-pointers.
void aggregateOutputValues()
Aggregates and normalize some values for the detector output during detectorUpdate()
std::map< std::string, VehicleInfo * > VehicleInfoMap
int myNumberOfSeenVehicles
The number of vehicles, present on the detector at the last reset.
int myJamLengthInVehiclesSum
The sum of jam lengths [#veh].
double myJamDistanceThreshold
Two standing vehicles must be closer than this to be counted into the same jam.
double myMaxJamInMeters
The max jam length [m].
int getCurrentJamNumber() const
Returns the current number of jams.
double myDetectorLength
The total detector length.
A VehicleInfo stores values that are tracked for the individual vehicles on the detector,...
void initAuxiliaries(std::vector< MSLane * > &lanes)
Checks integrity of myLanes, adds internal-lane information, inits myLength, myFirstLane,...
double oldPos
Position before the last integration step (relative to the vehicle's entry lane on the detector)
double myStartedHalts
The number of started halts [#].
int getCurrentHaltingNumber() const
Returns the number of current haltings within the area.
double myStartPos
The position the detector starts at on the first lane.
virtual bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Adds/removes vehicles from the list of vehicles to regard.
std::vector< MSLane * > selectLanes(MSLane *endLane, double length, std::string dir)
This is called if no lane sequence is given to the constructor. Builds myLanes from the given informa...
double myJamLengthInMetersSum
The sum of jam lengths [m].
bool hasEntered
Whether the vehicle has already entered the detector (don't count twice!)
double timeLoss
timeloss during the last integration step
double accumulatedTimeLoss
Accumulated time loss that this vehicle suffered since it entered the detector.
double distToDetectorEnd
Distance left till the detector end after the last integration step (may become negative if the vehic...
int getCurrentMaxJamLengthInVehicles() const
Returns the length in vehicles of the currently largest jam.
DetectorUsage myUsage
Information about how this detector is used.
void buildJam(bool isInJam, std::vector< MoveNotificationInfo * >::const_iterator mni, JamInfo *¤tJam, std::vector< JamInfo * > &jams)
Either adds the vehicle to the end of an existing jam, or closes the last jam, and/or creates a new j...
int myCurrentJamNo
The current jam number.
virtual void reset()
Resets all values.
void calculateTimeLossAndTimeOnDetector(const SUMOVehicle &veh, double oldPos, double newPos, const VehicleInfo &vi, double &timeOnDetector, double &timeLoss) const
Calculates the time spent on the detector in the last step and the timeloss suffered in the last step...
std::map< std::string, SUMOTime > myHaltingVehicleDurations
Storage for halting durations of known vehicles (for halting vehicles)
VehicleInfoMap myVehicleInfos
MSE2Collector(const MSE2Collector &)
Invalidated copy constructor.
int myNumberOfLeftVehicles
The number of vehicles, which have left the detector since the last reset.
const MSLane * currentLane
Lane, on which the vehicle currently resides (always the one for which the last notifyEnter was recei...
double myCurrentMaxJamLengthInMeters
the current maximum jam length in meters
MSLane * myFirstLane
The first lane of the detector's lane sequence.
double myEndPos
The position the detector ends at on the last lane.
MSLane * myLastLane
The last lane of the detector's lane sequence.
std::vector< MSLane * > getLanes()
Returns a vector containing pointers to the lanes covered by the detector ordered from its first to i...
std::string entryLaneID
ID of the lane, on which the vehicle entered the detector.
double speed
Speed after the last integration step.
void integrateMoveNotification(VehicleInfo *vi, const MoveNotificationInfo *mni)
This updates the detector values and the VehicleInfo of a vehicle on the detector with the given Move...
int myCurrentHaltingsNumber
The number of halted vehicles [#].
void addDetectorToLanes(std::vector< MSLane * > &lanes)
This adds the detector as a MoveReminder to the associated lanes.
virtual void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Write the generated output to the given device.
MoveNotificationInfo(std::string _vehID, double _oldPos, double _newPos, double _speed, double _accel, double _distToDetectorEnd, double _timeOnDetector, double _lengthOnDetector, double _timeLoss, bool _onDetector)
virtual DetectorUsage getUsageType() const
Returns the detector's usage type.
std::map< std::string, SUMOTime > myIntervalHaltingVehicleDurations
Storage for halting durations of known vehicles (current interval)
MSLane * getLastLane() const
Returns the id of the detector's last lane.
void subtractPassedVeh(int passed)
Subtract the number of vehicles indicated from passed from the sensor count.
SUMOTime myJamHaltingTimeThreshold
A vehicle must be that long beyond myJamHaltingSpeedThreshold to be counted as a part of a jam.
double getCurrentJamLengthInMeters() const
Returns the length of all jams in meters.
virtual ~MoveNotificationInfo()
double getCurrentMaxJamLengthInMeters() const
Returns the length in meters of the currently largest jam.
int getPassedVeh()
Returns the number of vehicles passed over the sensor (i.e. entered the sensor)
int getCurrentStartedHalts() const
Returns the length of all jams in meters.
double accel
Acceleration in the last integration step.
int getCurrentVehicleNumber() const
Returns the number of vehicles currently on the detector.
virtual void detectorUpdate(const SUMOTime step)
Computes the detector values in each time step.
std::vector< double > myOffsets
The distances of the lane-beginnings from the detector start-point.
MoveNotificationInfo * makeMoveNotification(const SUMOVehicle &veh, double oldPos, double newPos, double newSpeed, const VehicleInfo &vehInfo) const
Creates and returns a MoveNotificationInfo containing detector specific information on the vehicle's ...
std::string type
vehicle's type
int getEstimatedCurrentVehicleNumber(double speedThreshold) const
Returns an estimate of the number of vehicles currently on the detector.
double length
vehicle's length
std::vector< SUMOTime > myPastIntervalStandingDurations
Halting durations of ended halts for the current interval [s].
double myMeanMaxJamInMeters
The mean jam length [m].
double distToDetectorEnd
Distance left till the detector end after the last integration step (may become negative if the vehic...
const std::string & getID() const
Returns the id.
Notification
Definition of a vehicle state.
static double calculateSegmentTimeLoss(double timespan, double initialSpeed, double accel, double vmax)
Calculates the time loss for a segment with constant vmax.
std::vector< std::string > getCurrentVehicleIDs() const
Returns the IDs of the vehicles within the area.
int myMaxJamInVehicles
The max jam length [#veh].
double myCurrentOccupancy
The current occupancy.
int myMaxVehicleNumber
The maximal number of vehicles located on the detector simultaneously since the last reset.
bool onDetector
whether the vehicle is on the detector at the end of the current timestep
virtual bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane)
Adds the vehicle to known vehicles if not beyond the dector.
std::set< std::string > myLeftVehicles
Keep track of vehicles that left the detector by a regular move along a junction (not lanechange,...
double myOccupancySum
The sum of occupancies [%].
double myCurrentJamLengthInMeters
The overall jam length in meters.