#include <MSMeanData_Net.h>

Structure holding values that describe the flow and other physical properties aggregated over some seconds.
Definition at line 75 of file MSMeanData_Net.h.
Collected values | |
| The number of vehicles that were emitted on the lane | |
| unsigned | nVehArrived |
| The number of vehicles that finished on the lane. | |
| unsigned | nVehDeparted |
| unsigned | nVehEntered |
| The number of vehicles that entered this lane within the sample intervall. | |
| unsigned | nVehLeft |
| The number of vehicles that left this lane within the sample intervall. | |
| unsigned | nVehLaneChangeFrom |
| The number of vehicles that changed from this lane. | |
| unsigned | nVehLaneChangeTo |
| The number of vehicles that changed to this lane. | |
| SUMOReal | vehLengthSum |
| The sum of the lengths the vehicles had. | |
| SUMOReal | waitSeconds |
| The number of vehicle probes with small speed. | |
Collected values | |
| The number of sampled vehicle movements (in s) | |
| SUMOReal | travelledDistance |
| The sum of the distances the vehicles travelled. | |
| SUMOReal | sampleSeconds |
Public Member Functions | |
| void | addTo (MSMeanData::MeanDataValues &val) const throw () |
| Add the values of this to the given one and store them there. | |
| const MSLane *const | getLane () const throw () |
| Returns the lane the reminder works on. | |
| virtual SUMOReal | getSamples () const throw () |
| bool | isEmpty () const throw () |
| Returns whether any data was collected. | |
| MSLaneMeanDataValues (MSLane *const lane, const bool doAdd, const std::set< std::string > *const vTypes=0, const MSMeanData_Net *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 | ~MSLaneMeanDataValues () 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 | |
| const MSMeanData_Net * | myParent |
| The meandata parent. | |
| MSMeanData_Net::MSLaneMeanDataValues::MSLaneMeanDataValues | ( | MSLane *const | lane, | |
| const bool | doAdd, | |||
| const std::set< std::string > *const | vTypes = 0, |
|||
| const MSMeanData_Net * | parent = 0 | |||
| ) | throw () |
Constructor.
Definition at line 57 of file MSMeanData_Net.cpp.
00060 : MSMeanData::MeanDataValues(lane, doAdd, vTypes), myParent(parent), 00061 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0), 00062 nVehLaneChangeFrom(0), nVehLaneChangeTo(0), waitSeconds(0), vehLengthSum(0) {}
| MSMeanData_Net::MSLaneMeanDataValues::~MSLaneMeanDataValues | ( | ) | throw () [virtual] |
| void MSMeanData_Net::MSLaneMeanDataValues::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 85 of file MSMeanData_Net.cpp.
References nVehArrived, nVehDeparted, nVehEntered, nVehLaneChangeFrom, nVehLaneChangeTo, nVehLeft, MSMeanData::MeanDataValues::sampleSeconds, MSMeanData::MeanDataValues::travelledDistance, vehLengthSum, and waitSeconds.
Referenced by MSMeanData_Net::writeEdge().
00085 { 00086 MSLaneMeanDataValues& v = (MSLaneMeanDataValues&) val; 00087 v.nVehDeparted += nVehDeparted; 00088 v.nVehArrived += nVehArrived; 00089 v.nVehEntered += nVehEntered; 00090 v.nVehLeft += nVehLeft; 00091 v.nVehLaneChangeFrom += nVehLaneChangeFrom; 00092 v.nVehLaneChangeTo += nVehLaneChangeTo; 00093 v.sampleSeconds += sampleSeconds; 00094 v.travelledDistance += travelledDistance; 00095 v.waitSeconds += waitSeconds; 00096 v.vehLengthSum += vehLengthSum; 00097 }
| 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(), isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSE2Collector::update(), and MSMeanData::writeEdge().
00080 { 00081 return myLane; 00082 }
| SUMOReal MSMeanData::MeanDataValues::getSamples | ( | ) | const throw () [virtual, inherited] |
Reimplemented in MSMeanData::MeanDataValueTracker.
Definition at line 84 of file MSMeanData.cpp.
References MSMeanData::MeanDataValues::sampleSeconds.
00084 { 00085 return sampleSeconds; 00086 }
| bool MSMeanData_Net::MSLaneMeanDataValues::isEmpty | ( | ) | const throw () [virtual] |
Returns whether any data was collected.
Reimplemented from MSMeanData::MeanDataValues.
Definition at line 162 of file MSMeanData_Net.cpp.
References nVehArrived, nVehDeparted, nVehEntered, nVehLaneChangeFrom, nVehLaneChangeTo, nVehLeft, and MSMeanData::MeanDataValues::sampleSeconds.
00162 { 00163 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0 && nVehLeft == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0; 00164 }
| bool MSMeanData_Net::MSLaneMeanDataValues::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 101 of file MSMeanData_Net.cpp.
References DELTA_T, MsgHandler::getErrorInstance(), MSMoveReminder::getLane(), MSLane::getLength(), MsgHandler::inform(), MSMeanData_Net::myHaltSpeed, MSMeanData::MeanDataValues::sampleSeconds, SPEED2DIST, SUMOReal, MSMeanData::MeanDataValues::travelledDistance, MSMeanData::MeanDataValues::vehicleApplies(), vehLengthSum, and waitSeconds.
00101 { 00102 if (!vehicleApplies(veh)) { 00103 return false; 00104 } 00105 bool ret = true; 00106 SUMOReal timeOnLane = (SUMOReal) DELTA_T / 1000.; 00107 if (oldPos<0&&newSpeed!=0) { 00108 timeOnLane = (oldPos+SPEED2DIST(newSpeed)) / newSpeed; 00109 } 00110 if (getLane() != 0 && oldPos+SPEED2DIST(newSpeed)>getLane()->getLength() && newSpeed != 0) { 00111 timeOnLane -= (oldPos+SPEED2DIST(newSpeed) - getLane()->getLength()) / newSpeed; 00112 ret = false; 00113 } 00114 if (timeOnLane<0) { 00115 MsgHandler::getErrorInstance()->inform("Negative vehicle step fraction on lane '" + getLane()->getID() + "'."); 00116 return false; 00117 } 00118 if (timeOnLane==0) { 00119 return false; 00120 } 00121 sampleSeconds += timeOnLane; 00122 travelledDistance += newSpeed * timeOnLane; 00123 vehLengthSum += veh.getVehicleType().getLength() * timeOnLane; 00124 if (newSpeed<myParent->myHaltSpeed) { 00125 waitSeconds += timeOnLane; 00126 } 00127 return ret; 00128 }
| bool MSMeanData_Net::MSLaneMeanDataValues::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 146 of file MSMeanData_Net.cpp.
References nVehDeparted, nVehEntered, nVehLaneChangeTo, and MSMeanData::MeanDataValues::vehicleApplies().
00146 { 00147 if (vehicleApplies(veh)) { 00148 if (isEmit) { 00149 ++nVehDeparted; 00150 } else if (isLaneChange) { 00151 ++nVehLaneChangeTo; 00152 } else { 00153 ++nVehEntered; 00154 } 00155 return true; 00156 } 00157 return false; 00158 }
| void MSMeanData_Net::MSLaneMeanDataValues::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 132 of file MSMeanData_Net.cpp.
References nVehArrived, nVehLaneChangeFrom, nVehLeft, and MSMeanData::MeanDataValues::vehicleApplies().
00132 { 00133 if (vehicleApplies(veh)) { 00134 if (isArrival) { 00135 ++nVehArrived; 00136 } else if (isLaneChange) { 00137 ++nVehLaneChangeFrom; 00138 } else { 00139 ++nVehLeft; 00140 } 00141 } 00142 }
| void MSMeanData_Net::MSLaneMeanDataValues::reset | ( | ) | throw () [virtual] |
Resets values so they may be used for the next interval.
Implements MSMeanData::MeanDataValues.
Definition at line 70 of file MSMeanData_Net.cpp.
References nVehArrived, nVehDeparted, nVehEntered, nVehLaneChangeFrom, nVehLaneChangeTo, nVehLeft, MSMeanData::MeanDataValues::sampleSeconds, MSMeanData::MeanDataValues::travelledDistance, vehLengthSum, and waitSeconds.
Referenced by MSMeanData_Net::writeEdge().
00070 { 00071 nVehDeparted = 0; 00072 nVehArrived = 0; 00073 nVehEntered = 0; 00074 nVehLeft = 0; 00075 nVehLaneChangeFrom = 0; 00076 nVehLaneChangeTo = 0; 00077 sampleSeconds = 0.; 00078 travelledDistance = 0; 00079 waitSeconds = 0; 00080 vehLengthSum = 0; 00081 }
| 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 isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSMeanData::MeanDataValueTracker::isStillActive(), notifyEnter(), MSMeanData_Harmonoise::MSLaneMeanDataValues::notifyEnter(), MSMeanData::MeanDataValueTracker::notifyEnter(), notifyLeave(), and MSMeanData::MeanDataValueTracker::notifyLeave().
00066 { 00067 return myVehicleTypes == 0 || myVehicleTypes->empty() || 00068 myVehicleTypes->find(veh.getVehicleType().getID()) != myVehicleTypes->end(); 00069 }
| void MSMeanData_Net::MSLaneMeanDataValues::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 168 of file MSMeanData_Net.cpp.
References MIN2(), MSMeanData::myMaxTravelTime, MSMeanData::myMinSamples, myParent, nVehArrived, nVehDeparted, nVehEntered, nVehLaneChangeFrom, nVehLaneChangeTo, nVehLeft, MSMeanData::MeanDataValues::sampleSeconds, STEPS2TIME, SUMOReal, MSMeanData::MeanDataValues::travelledDistance, vehLengthSum, and waitSeconds.
Referenced by MSMeanData_Net::writeEdge().
00169 { 00170 if (myParent == 0) { 00171 if (sampleSeconds > 0) { 00172 dev << "\" density=\"" << sampleSeconds / STEPS2TIME(period) *(SUMOReal) 1000 / length << 00173 "\" occupancy=\"" << vehLengthSum / STEPS2TIME(period) / length / numLanes *(SUMOReal) 100 << 00174 "\" waitingTime=\"" << waitSeconds << 00175 "\" speed=\"" << travelledDistance / sampleSeconds; 00176 } 00177 dev<<"\" departed=\""<<nVehDeparted<< 00178 "\" arrived=\""<<nVehArrived<< 00179 "\" entered=\""<<nVehEntered<< 00180 "\" left=\""<<nVehLeft<< 00181 "\"/>\n"; 00182 return; 00183 } 00184 if (sampleSeconds > myParent->myMinSamples) { 00185 SUMOReal traveltime = myParent->myMaxTravelTime; 00186 if (travelledDistance > 0.f) { 00187 traveltime = MIN2(traveltime, length * sampleSeconds / travelledDistance); 00188 } 00189 if (numVehicles > 0) { 00190 dev << "\" traveltime=\"" << sampleSeconds / numVehicles << 00191 "\" waitingTime=\"" << waitSeconds << 00192 "\" speed=\"" << travelledDistance / sampleSeconds; 00193 } else { 00194 dev << "\" traveltime=\"" << traveltime << 00195 "\" density=\"" << sampleSeconds / STEPS2TIME(period) *(SUMOReal) 1000 / length << 00196 "\" occupancy=\"" << vehLengthSum / STEPS2TIME(period) / length / numLanes *(SUMOReal) 100 << 00197 "\" waitingTime=\"" << waitSeconds << 00198 "\" speed=\"" << travelledDistance / sampleSeconds; 00199 } 00200 } 00201 dev<<"\" departed=\""<<nVehDeparted<< 00202 "\" arrived=\""<<nVehArrived<< 00203 "\" entered=\""<<nVehEntered<< 00204 "\" left=\""<<nVehLeft<< 00205 "\" laneChangedFrom=\""<<nVehLaneChangeFrom<< 00206 "\" laneChangedTo=\""<<nVehLaneChangeTo<< 00207 "\"/>\n"; 00208 }
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 MSMeanData::MeanDataValueTracker::reset().
const MSMeanData_Net* MSMeanData_Net::MSLaneMeanDataValues::myParent [private] |
The number of vehicles that finished on the lane.
Definition at line 167 of file MSMeanData_Net.h.
Referenced by addTo(), isEmpty(), notifyLeave(), reset(), and write().
Definition at line 164 of file MSMeanData_Net.h.
Referenced by addTo(), isEmpty(), notifyEnter(), reset(), and write().
The number of vehicles that entered this lane within the sample intervall.
Definition at line 170 of file MSMeanData_Net.h.
Referenced by addTo(), isEmpty(), notifyEnter(), reset(), write(), and MSMeanData_Net::writeEdge().
unsigned MSMeanData_Net::MSLaneMeanDataValues::nVehLaneChangeFrom [private] |
The number of vehicles that changed from this lane.
Definition at line 177 of file MSMeanData_Net.h.
Referenced by addTo(), isEmpty(), notifyLeave(), reset(), and write().
unsigned MSMeanData_Net::MSLaneMeanDataValues::nVehLaneChangeTo [private] |
The number of vehicles that changed to this lane.
Definition at line 180 of file MSMeanData_Net.h.
Referenced by addTo(), isEmpty(), notifyEnter(), reset(), and write().
The number of vehicles that left this lane within the sample intervall.
Definition at line 173 of file MSMeanData_Net.h.
Referenced by addTo(), isEmpty(), notifyLeave(), reset(), write(), and MSMeanData_Net::writeEdge().
SUMOReal MSMeanData::MeanDataValues::sampleSeconds [protected, inherited] |
Definition at line 134 of file MSMeanData.h.
Referenced by addTo(), MSMeanData_HBEFA::MSLaneMeanDataValues::addTo(), MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(), MSMeanData::MeanDataValues::getSamples(), isEmpty(), MSMeanData::MeanDataValues::isEmpty(), isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), reset(), MSMeanData_HBEFA::MSLaneMeanDataValues::reset(), MSMeanData_Harmonoise::MSLaneMeanDataValues::reset(), 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 addTo(), MSMeanData_HBEFA::MSLaneMeanDataValues::addTo(), MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(), isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), reset(), MSMeanData_HBEFA::MSLaneMeanDataValues::reset(), MSMeanData_Harmonoise::MSLaneMeanDataValues::reset(), write(), MSMeanData_HBEFA::MSLaneMeanDataValues::write(), and MSMeanData_Harmonoise::MSLaneMeanDataValues::write().
SUMOReal MSMeanData_Net::MSLaneMeanDataValues::vehLengthSum [private] |
The sum of the lengths the vehicles had.
Definition at line 186 of file MSMeanData_Net.h.
Referenced by addTo(), isStillActive(), reset(), and write().
SUMOReal MSMeanData_Net::MSLaneMeanDataValues::waitSeconds [private] |
The number of vehicle probes with small speed.
Definition at line 183 of file MSMeanData_Net.h.
Referenced by addTo(), isStillActive(), reset(), and write().
1.5.6