#include <MSMeanData_Harmonoise.h>

Structure holding values that describe the noise aggregated over some seconds.
Definition at line 68 of file MSMeanData_Harmonoise.h.
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 to this meanData. | |
| const MSLane *const | getLane () const throw () |
| Returns the lane the reminder works on. | |
| virtual SUMOReal | getSamples () const throw () |
| virtual 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_Harmonoise *parent=0) throw () | |
| Constructor. | |
| void | reset () throw () |
| Resets values so they may be used for the next interval. | |
| void | update () throw () |
| Computes the noise in the last time step. | |
| 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 emission values and adds them to their sums. | |
| bool | notifyEnter (MSVehicle &veh, bool isEmit, bool isLaneChange) throw () |
| Computes current emission values and adds them to their sums. | |
Interface methods, to be derived by subclasses | |
| virtual 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. | |
Data Fields | |
| const MSMeanData_Harmonoise * | myParent |
| The meandata parent. | |
Collected values | |
| SUMOReal | currentTimeN |
| Sum of produced noise at this time step(pow(10, (<NOISE>/10.))). | |
| SUMOReal | meanNTemp |
| Sum of produced noise over time (pow(10, (<NOISE>/10.))). | |
Protected Attributes | |
| MSLane *const | myLane |
| Lane on which the reminder works. | |
| MSMeanData_Harmonoise::MSLaneMeanDataValues::MSLaneMeanDataValues | ( | MSLane *const | lane, | |
| const bool | doAdd, | |||
| const std::set< std::string > *const | vTypes = 0, |
|||
| const MSMeanData_Harmonoise * | parent = 0 | |||
| ) | throw () |
Constructor.
Definition at line 51 of file MSMeanData_Harmonoise.cpp.
00053 : MSMeanData::MeanDataValues(lane, doAdd, vTypes), 00054 currentTimeN(0), meanNTemp(0), myParent(parent) {}
| MSMeanData_Harmonoise::MSLaneMeanDataValues::~MSLaneMeanDataValues | ( | ) | throw () [virtual] |
| void MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo | ( | MSMeanData::MeanDataValues & | val | ) | const throw () [virtual] |
Add the values to this meanData.
Implements MSMeanData::MeanDataValues.
Definition at line 71 of file MSMeanData_Harmonoise.cpp.
References meanNTemp, MSMeanData::MeanDataValues::sampleSeconds, HelpersHarmonoise::sum(), SUMOReal, and MSMeanData::MeanDataValues::travelledDistance.
00071 { 00072 MSLaneMeanDataValues& v = (MSLaneMeanDataValues&) val; 00073 v.sampleSeconds += sampleSeconds; 00074 v.meanNTemp += (SUMOReal) pow(10., HelpersHarmonoise::sum(meanNTemp)/10.); 00075 v.travelledDistance += travelledDistance; 00076 }
| 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(), 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::MeanDataValues::isEmpty | ( | ) | const throw () [virtual, inherited] |
Returns whether any data was collected.
Reimplemented in MSMeanData::MeanDataValueTracker, and MSMeanData_Net::MSLaneMeanDataValues.
Definition at line 73 of file MSMeanData.cpp.
References MSMeanData::MeanDataValues::sampleSeconds.
00073 { 00074 return sampleSeconds == 0; 00075 }
| bool MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive | ( | MSVehicle & | veh, | |
| SUMOReal | oldPos, | |||
| SUMOReal | newPos, | |||
| SUMOReal | newSpeed | |||
| ) | throw () [virtual] |
Computes current emission 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 emission values which are computed using the current velocity and acceleration.
| [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 87 of file MSMeanData_Harmonoise.cpp.
References HelpersHarmonoise::computeNoise(), currentTimeN, MsgHandler::getErrorInstance(), MSMoveReminder::getLane(), MSLane::getLength(), MsgHandler::inform(), MSMeanData::MeanDataValues::sampleSeconds, SPEED2DIST, SUMOReal, MSMeanData::MeanDataValues::travelledDistance, TS, and MSMeanData::MeanDataValues::vehicleApplies().
00087 { 00088 if (!vehicleApplies(veh)) { 00089 return false; 00090 } 00091 bool ret = true; 00092 SUMOReal timeOnLane = TS; 00093 if (oldPos<0&&newSpeed!=0) { 00094 timeOnLane = (oldPos+SPEED2DIST(newSpeed)) / newSpeed; 00095 } 00096 if (oldPos+SPEED2DIST(newSpeed)>getLane()->getLength()&&newSpeed!=0) { 00097 timeOnLane -= (oldPos+SPEED2DIST(newSpeed) - getLane()->getLength()) / newSpeed; 00098 ret = false; 00099 } 00100 if (timeOnLane<0) { 00101 MsgHandler::getErrorInstance()->inform("Negative vehicle step fraction on lane '" + getLane()->getID() + "'."); 00102 return false; 00103 } 00104 if (timeOnLane==0) { 00105 return false; 00106 } 00107 SUMOReal a = veh.getPreDawdleAcceleration(); 00108 SUMOReal sn = HelpersHarmonoise::computeNoise(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a); 00109 currentTimeN += (SUMOReal) pow(10., (sn/10.)); 00110 sampleSeconds += timeOnLane; 00111 travelledDistance += newSpeed * timeOnLane; 00112 return ret; 00113 }
| bool MSMeanData_Harmonoise::MSLaneMeanDataValues::notifyEnter | ( | MSVehicle & | veh, | |
| bool | isEmit, | |||
| bool | isLaneChange | |||
| ) | throw () [virtual] |
Computes current emission 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 emission values which are computed using the current velocity and acceleration.
| [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 117 of file MSMeanData_Harmonoise.cpp.
References MSMeanData::MeanDataValues::vehicleApplies().
00117 { 00118 return vehicleApplies(veh); 00119 }
| virtual void MSMoveReminder::notifyLeave | ( | MSVehicle & | veh, | |
| bool | isArrival, | |||
| bool | isLaneChange | |||
| ) | throw () [inline, virtual, inherited] |
Called if the vehicle leaves the reminder's lane.
Informs if vehicle leaves reminder lane (due to lane change, removal from the network, or leaving to the next lane). The default is to do nothing.
| [in] | veh | The leaving vehicle. |
| [in] | isArrival | whether the vehicle arrived at its destination |
| [in] | isLaneChange | whether the vehicle changed from the lane |
Reimplemented in MSE2Collector, MSInductLoop, MSMeanData::MeanDataValueTracker, and MSMeanData_Net::MSLaneMeanDataValues.
Definition at line 119 of file MSMoveReminder.h.
| void MSMeanData_Harmonoise::MSLaneMeanDataValues::reset | ( | ) | throw () [virtual] |
Resets values so they may be used for the next interval.
Implements MSMeanData::MeanDataValues.
Definition at line 62 of file MSMeanData_Harmonoise.cpp.
References currentTimeN, meanNTemp, MSMeanData::MeanDataValues::sampleSeconds, and MSMeanData::MeanDataValues::travelledDistance.
00062 { 00063 sampleSeconds = 0; 00064 currentTimeN = 0; 00065 meanNTemp = 0; 00066 travelledDistance = 0; 00067 }
| void MSMeanData_Harmonoise::MSLaneMeanDataValues::update | ( | ) | throw () [virtual] |
Computes the noise in the last time step.
The sum of noises collected so far (in the last seen step) is built, and added to meanNTemp; currentTimeN is resetted.
Reimplemented from MSMeanData::MeanDataValues.
Definition at line 80 of file MSMeanData_Harmonoise.cpp.
References currentTimeN, meanNTemp, HelpersHarmonoise::sum(), and SUMOReal.
00080 { 00081 meanNTemp += (SUMOReal) pow(10., HelpersHarmonoise::sum(currentTimeN)/10.); 00082 currentTimeN = 0; 00083 }
| 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(), isStillActive(), MSMeanData::MeanDataValueTracker::isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::notifyEnter(), notifyEnter(), MSMeanData::MeanDataValueTracker::notifyEnter(), MSMeanData_Net::MSLaneMeanDataValues::notifyLeave(), and MSMeanData::MeanDataValueTracker::notifyLeave().
00066 { 00067 return myVehicleTypes == 0 || myVehicleTypes->empty() || 00068 myVehicleTypes->find(veh.getVehicleType().getID()) != myVehicleTypes->end(); 00069 }
| void MSMeanData_Harmonoise::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 123 of file MSMeanData_Harmonoise.cpp.
References meanNTemp, MIN2(), MSMeanData::myMaxTravelTime, MSMeanData::myMinSamples, myParent, MSMeanData::MeanDataValues::sampleSeconds, STEPS2TIME, SUMOReal, MSMeanData::MeanDataValues::travelledDistance, and TS.
00124 { 00125 dev << "\" noise=\"" << (meanNTemp!=0 ? (SUMOReal)(10. * log10(meanNTemp*TS/STEPS2TIME(period))) : (SUMOReal) 0.); 00126 if (sampleSeconds > myParent->myMinSamples) { 00127 SUMOReal traveltime = myParent->myMaxTravelTime; 00128 if (travelledDistance > 0.f) { 00129 traveltime = MIN2(traveltime, length * sampleSeconds / travelledDistance); 00130 } 00131 dev << "\" traveltime=\"" << traveltime; 00132 } 00133 dev << "\"/>\n"; 00134 }
Sum of produced noise at this time step(pow(10, (<NOISE>/10.))).
Definition at line 149 of file MSMeanData_Harmonoise.h.
Referenced by isStillActive(), reset(), and update().
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().
SUMOReal MSMeanData::MeanDataValues::sampleSeconds [protected, inherited] |
Definition at line 134 of file MSMeanData.h.
Referenced by MSMeanData_Net::MSLaneMeanDataValues::addTo(), MSMeanData_HBEFA::MSLaneMeanDataValues::addTo(), addTo(), MSMeanData::MeanDataValues::getSamples(), MSMeanData_Net::MSLaneMeanDataValues::isEmpty(), MSMeanData::MeanDataValues::isEmpty(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::reset(), MSMeanData_HBEFA::MSLaneMeanDataValues::reset(), reset(), MSMeanData_Net::MSLaneMeanDataValues::write(), MSMeanData_HBEFA::MSLaneMeanDataValues::write(), and 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(), addTo(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::reset(), MSMeanData_HBEFA::MSLaneMeanDataValues::reset(), reset(), MSMeanData_Net::MSLaneMeanDataValues::write(), MSMeanData_HBEFA::MSLaneMeanDataValues::write(), and write().
1.5.6