#include <MSMeanData.h>
Definition at line 151 of file MSMeanData.h.
Collected values | |
| The number of sampled vehicle movements (in s) | |
| SUMOReal | sampleSeconds |
| SUMOReal | travelledDistance |
| The sum of the distances the vehicles travelled. | |
Public Member Functions | |
| void | addTo (MSMeanData::MeanDataValues &val) const throw () |
| Add the values of this to the given one and store them there. | |
| void | clearFirst () throw () |
| const MSLane *const | getLane () const throw () |
| Returns the lane the reminder works on. | |
| size_t | getNumReady () const throw () |
| SUMOReal | getSamples () const throw () |
| bool | isEmpty () const throw () |
| Returns whether any data was collected. | |
| MeanDataValueTracker (MSLane *const lane, const std::set< std::string > *const vTypes=0, const MSMeanData *const parent=0) throw () | |
| Constructor. | |
| void | reset () throw () |
| Resets values so they may be used for the next interval. | |
| virtual void | update () throw () |
| Called if a per timestep update is needed. Default does nothing. | |
| void | write (OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal length, const int numVehicles=-1) const throw (IOError) |
| Writes output values into the given stream. | |
| virtual | ~MeanDataValueTracker () throw () |
| Destructor. | |
Methods inherited from MSMoveReminder | |
| bool | isStillActive (MSVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) throw () |
| Computes current values and adds them to their sums. | |
| bool | notifyEnter (MSVehicle &veh, bool isEmit, bool isLaneChange) throw () |
| Computes current values and adds them to their sums. | |
| void | notifyLeave (MSVehicle &veh, bool isArrival, bool isLaneChange) throw () |
| Called if the vehicle leaves the reminder's lane. | |
Methods inherited from MSMoveReminder. | |
| bool | vehicleApplies (const SUMOVehicle &veh) const throw () |
| Tests whether the vehicles type is to be regarded. | |
Protected Attributes | |
| MSLane *const | myLane |
| Lane on which the reminder works. | |
Private Attributes | |
| std::list< TrackerEntry * > | myCurrentData |
| The currently active meandata "intervals". | |
| const MSMeanData * | myParent |
| The meandata parent. | |
| std::map< MSVehicle *, TrackerEntry * > | myTrackedData |
| The map of vehicles to data entries. | |
Data Structures | |
| class | TrackerEntry |
| MSMeanData::MeanDataValueTracker::MeanDataValueTracker | ( | MSLane *const | lane, | |
| const std::set< std::string > *const | vTypes = 0, |
|||
| const MSMeanData *const | parent = 0 | |||
| ) | throw () |
Constructor.
Definition at line 92 of file MSMeanData.cpp.
Referenced by MSMeanData::init().
00095 : MSMeanData::MeanDataValues(lane, true, vTypes), myParent(parent) { 00096 myCurrentData.push_back(new TrackerEntry(parent->createValues(lane, false))); 00097 }
| MSMeanData::MeanDataValueTracker::~MeanDataValueTracker | ( | ) | throw () [virtual] |
| void MSMeanData::MeanDataValueTracker::addTo | ( | MSMeanData::MeanDataValues & | val | ) | const throw () [virtual] |
Add the values of this to the given one and store them there.
| [in] | val | The meandata to add to |
Implements MSMeanData::MeanDataValues.
Definition at line 111 of file MSMeanData.cpp.
References myCurrentData.
00111 { 00112 myCurrentData.front()->myValues->addTo(val); 00113 }
| void MSMeanData::MeanDataValueTracker::clearFirst | ( | ) | throw () |
Definition at line 173 of file MSMeanData.cpp.
References myCurrentData.
00173 { 00174 if (myCurrentData.size() == 1) { 00175 myCurrentData.front()->reset(); 00176 } else { 00177 myCurrentData.pop_front(); 00178 } 00179 }
| const MSLane* const MSMoveReminder::getLane | ( | ) | const throw () [inline, inherited] |
Returns the lane the reminder works on.
Definition at line 80 of file MSMoveReminder.h.
References MSMoveReminder::myLane.
Referenced by GUIInductLoop::MyWrapper::getParameterWindow(), GUI_E2_ZS_Collector::MyWrapper::getParameterWindow(), GUINet::initDetectors(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSE2Collector::update(), and MSMeanData::writeEdge().
00080 { 00081 return myLane; 00082 }
| size_t MSMeanData::MeanDataValueTracker::getNumReady | ( | ) | const throw () |
Definition at line 159 of file MSMeanData.cpp.
References myCurrentData.
00159 { 00160 size_t result = 0; 00161 for (std::list<TrackerEntry*>::const_iterator it = myCurrentData.begin(); it != myCurrentData.end(); ++it) { 00162 if ((*it)->myNumVehicleEntered == (*it)->myNumVehicleLeft) { 00163 result++; 00164 } else { 00165 break; 00166 } 00167 } 00168 return result; 00169 }
| SUMOReal MSMeanData::MeanDataValueTracker::getSamples | ( | ) | const throw () [virtual] |
Reimplemented from MSMeanData::MeanDataValues.
Definition at line 183 of file MSMeanData.cpp.
References myCurrentData.
00183 { 00184 return myCurrentData.front()->myValues->getSamples(); 00185 }
| bool MSMeanData::MeanDataValueTracker::isEmpty | ( | ) | const throw () [virtual] |
Returns whether any data was collected.
Reimplemented from MSMeanData::MeanDataValues.
Definition at line 146 of file MSMeanData.cpp.
References myCurrentData.
00146 { 00147 return myCurrentData.front()->myValues->isEmpty(); 00148 }
| bool MSMeanData::MeanDataValueTracker::isStillActive | ( | MSVehicle & | veh, | |
| SUMOReal | oldPos, | |||
| SUMOReal | newPos, | |||
| SUMOReal | newSpeed | |||
| ) | throw () [virtual] |
Computes current values and adds them to their sums.
The fraction of time the vehicle is on the lane is computed and used as a weight for the vehicle's current values.
Additionally, if the vehicle has entered this lane, "nVehEnteredLane" is incremented, and if the vehicle has left the lane, "nVehLeftLane".
| [in] | veh | The regarded vehicle |
| [in] | oldPos | Position before the move-micro-timestep. |
| [in] | newPos | Position after the move-micro-timestep. |
| [in] | newSpeed | The vehicle's current speed |
Reimplemented from MSMoveReminder.
Definition at line 117 of file MSMeanData.cpp.
References myTrackedData, and MSMeanData::MeanDataValues::vehicleApplies().
00117 { 00118 if (vehicleApplies(veh)) { 00119 return myTrackedData[&veh]->myValues->isStillActive(veh, oldPos, newPos, newSpeed); 00120 } 00121 return false; 00122 }
| bool MSMeanData::MeanDataValueTracker::notifyEnter | ( | MSVehicle & | veh, | |
| bool | isEmit, | |||
| bool | isLaneChange | |||
| ) | throw () [virtual] |
Computes current values and adds them to their sums.
The fraction of time the vehicle is on the lane is computed and used as a weight for the vehicle's current values. The "emitted" field is incremented, additionally.
| [in] | veh | The vehicle that enters the lane |
| [in] | isEmit | whether the vehicle was just emitted into the net |
| [in] | isLaneChange | whether the vehicle changed to the lane |
Reimplemented from MSMoveReminder.
Definition at line 135 of file MSMeanData.cpp.
References myCurrentData, myTrackedData, and MSMeanData::MeanDataValues::vehicleApplies().
00135 { 00136 if (vehicleApplies(veh)) { 00137 myTrackedData[&veh] = myCurrentData.back(); 00138 myTrackedData[&veh]->myNumVehicleEntered++; 00139 return myTrackedData[&veh]->myValues->notifyEnter(veh, isEmit, isLaneChange); 00140 } 00141 return false; 00142 }
| void MSMeanData::MeanDataValueTracker::notifyLeave | ( | MSVehicle & | veh, | |
| bool | isArrival, | |||
| bool | isLaneChange | |||
| ) | throw () [virtual] |
Called if the vehicle leaves the reminder's lane.
| veh | The leaving vehicle. |
Reimplemented from MSMoveReminder.
Definition at line 126 of file MSMeanData.cpp.
References myTrackedData, and MSMeanData::MeanDataValues::vehicleApplies().
00126 { 00127 if (vehicleApplies(veh)) { 00128 myTrackedData[&veh]->myNumVehicleLeft++; 00129 myTrackedData[&veh]->myValues->notifyLeave(veh, isArrival, isLaneChange); 00130 } 00131 }
| void MSMeanData::MeanDataValueTracker::reset | ( | ) | throw () [virtual] |
Resets values so they may be used for the next interval.
Implements MSMeanData::MeanDataValues.
Definition at line 105 of file MSMeanData.cpp.
References MSMeanData::createValues(), myCurrentData, MSMoveReminder::myLane, and myParent.
00105 { 00106 myCurrentData.push_back(new TrackerEntry(myParent->createValues(myLane, false))); 00107 }
| void MSMeanData::MeanDataValues::update | ( | ) | throw () [virtual, inherited] |
Called if a per timestep update is needed. Default does nothing.
Reimplemented in MSMeanData_Harmonoise::MSLaneMeanDataValues.
Definition at line 79 of file MSMeanData.cpp.
| bool MSMeanData::MeanDataValues::vehicleApplies | ( | const SUMOVehicle & | veh | ) | const throw () [inherited] |
Tests whether the vehicles type is to be regarded.
| [in] | veh | The regarded vehicle |
Definition at line 66 of file MSMeanData.cpp.
References MSMeanData::MeanDataValues::myVehicleTypes.
Referenced by MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::notifyEnter(), MSMeanData_Harmonoise::MSLaneMeanDataValues::notifyEnter(), notifyEnter(), MSMeanData_Net::MSLaneMeanDataValues::notifyLeave(), and notifyLeave().
00066 { 00067 return myVehicleTypes == 0 || myVehicleTypes->empty() || 00068 myVehicleTypes->find(veh.getVehicleType().getID()) != myVehicleTypes->end(); 00069 }
| void MSMeanData::MeanDataValueTracker::write | ( | OutputDevice & | dev, | |
| const SUMOTime | period, | |||
| const SUMOReal | numLanes, | |||
| const SUMOReal | length, | |||
| const int | numVehicles = -1 | |||
| ) | const throw (IOError) [virtual] |
Writes output values into the given stream.
| [in] | dev | The output device to write the data into |
| [in] | period | Length of the period the data were gathered |
| [in] | numLanes | The total number of lanes for which the data was collected |
| [in] | length | The length of the object for which the data was collected |
| IOError | If an error on writing occurs (!!! not yet implemented) |
Implements MSMeanData::MeanDataValues.
Definition at line 152 of file MSMeanData.cpp.
References myCurrentData.
00153 { 00154 myCurrentData.front()->myValues->write(dev, period, numLanes, length, myCurrentData.front()->myNumVehicleEntered); 00155 }
std::list<TrackerEntry*> MSMeanData::MeanDataValueTracker::myCurrentData [private] |
The currently active meandata "intervals".
Definition at line 263 of file MSMeanData.h.
Referenced by addTo(), clearFirst(), getNumReady(), getSamples(), isEmpty(), notifyEnter(), reset(), and write().
MSLane* const MSMoveReminder::myLane [protected, inherited] |
Lane on which the reminder works.
Definition at line 141 of file MSMoveReminder.h.
Referenced by MSMoveReminder::getLane(), MSTriggeredRerouter::Setter::isStillActive(), MSTriggeredRerouter::Setter::notifyEnter(), and reset().
const MSMeanData* MSMeanData::MeanDataValueTracker::myParent [private] |
std::map<MSVehicle*, TrackerEntry*> MSMeanData::MeanDataValueTracker::myTrackedData [private] |
The map of vehicles to data entries.
Definition at line 260 of file MSMeanData.h.
Referenced by isStillActive(), notifyEnter(), and notifyLeave().
SUMOReal MSMeanData::MeanDataValues::sampleSeconds [protected, inherited] |
Definition at line 134 of file MSMeanData.h.
Referenced by MSMeanData_Net::MSLaneMeanDataValues::addTo(), MSMeanData_HBEFA::MSLaneMeanDataValues::addTo(), MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(), MSMeanData::MeanDataValues::getSamples(), MSMeanData_Net::MSLaneMeanDataValues::isEmpty(), MSMeanData::MeanDataValues::isEmpty(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::reset(), MSMeanData_HBEFA::MSLaneMeanDataValues::reset(), MSMeanData_Harmonoise::MSLaneMeanDataValues::reset(), MSMeanData_Net::MSLaneMeanDataValues::write(), MSMeanData_HBEFA::MSLaneMeanDataValues::write(), and MSMeanData_Harmonoise::MSLaneMeanDataValues::write().
SUMOReal MSMeanData::MeanDataValues::travelledDistance [inherited] |
The sum of the distances the vehicles travelled.
Definition at line 137 of file MSMeanData.h.
Referenced by MSMeanData_Net::MSLaneMeanDataValues::addTo(), MSMeanData_HBEFA::MSLaneMeanDataValues::addTo(), MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::reset(), MSMeanData_HBEFA::MSLaneMeanDataValues::reset(), MSMeanData_Harmonoise::MSLaneMeanDataValues::reset(), MSMeanData_Net::MSLaneMeanDataValues::write(), MSMeanData_HBEFA::MSLaneMeanDataValues::write(), and MSMeanData_Harmonoise::MSLaneMeanDataValues::write().
1.5.6