#include <MSMeanData_HBEFA.h>

Structure holding values that describe the emissions aggregated over some seconds.
Definition at line 69 of file MSMeanData_HBEFA.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. | |
| 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_HBEFA *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 emission values and adds them to their sums. | |
Interface methods, to be derived by subclasses | |
| virtual bool | notifyEnter (MSVehicle &veh, bool isEmit, bool isLaneChange) throw () |
| Checks whether the reminder is activated by the vehicle's emission on lane change. | |
| 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. | |
Protected Attributes | |
| MSLane *const | myLane |
| Lane on which the reminder works. | |
Private Attributes | |
| const MSMeanData_HBEFA * | myParent |
| The meandata parent. | |
Collected values | |
Sum of CO2 emissions | |
| SUMOReal | CO |
| Sum of CO emissions. | |
| SUMOReal | CO2 |
| SUMOReal | fuel |
| Sum of consumed fuel. | |
| SUMOReal | HC |
| Sum of HC emissions. | |
| SUMOReal | NOx |
| Sum of NOx emissions. | |
| SUMOReal | PMx |
| Sum of PMx emissions. | |
| MSMeanData_HBEFA::MSLaneMeanDataValues::MSLaneMeanDataValues | ( | MSLane *const | lane, | |
| const bool | doAdd, | |||
| const std::set< std::string > *const | vTypes = 0, |
|||
| const MSMeanData_HBEFA * | parent = 0 | |||
| ) | throw () |
Constructor.
Definition at line 50 of file MSMeanData_HBEFA.cpp.
00053 : MSMeanData::MeanDataValues(lane, doAdd, vTypes), myParent(parent), CO2(0), CO(0), HC(0), NOx(0), PMx(0), fuel(0) {}
| MSMeanData_HBEFA::MSLaneMeanDataValues::~MSLaneMeanDataValues | ( | ) | throw () [virtual] |
| void MSMeanData_HBEFA::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 74 of file MSMeanData_HBEFA.cpp.
References CO, CO2, fuel, HC, NOx, PMx, MSMeanData::MeanDataValues::sampleSeconds, and MSMeanData::MeanDataValues::travelledDistance.
00074 { 00075 MSLaneMeanDataValues& v = (MSLaneMeanDataValues&) val; 00076 v.sampleSeconds += sampleSeconds; 00077 v.travelledDistance += travelledDistance; 00078 v.CO2 += CO2; 00079 v.CO += CO; 00080 v.HC += HC; 00081 v.NOx += NOx; 00082 v.PMx += PMx; 00083 v.fuel += fuel; 00084 }
| 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(), 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::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_HBEFA::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 88 of file MSMeanData_HBEFA.cpp.
References CO, CO2, HelpersHBEFA::computeCO(), HelpersHBEFA::computeCO2(), HelpersHBEFA::computeFuel(), HelpersHBEFA::computeHC(), HelpersHBEFA::computeNOx(), HelpersHBEFA::computePMx(), DELTA_T, fuel, MsgHandler::getErrorInstance(), MSMoveReminder::getLane(), MSLane::getLength(), HC, MsgHandler::inform(), NOx, PMx, MSMeanData::MeanDataValues::sampleSeconds, SPEED2DIST, SUMOReal, MSMeanData::MeanDataValues::travelledDistance, and MSMeanData::MeanDataValues::vehicleApplies().
00088 { 00089 if (!vehicleApplies(veh)) { 00090 return false; 00091 } 00092 bool ret = true; 00093 SUMOReal timeOnLane = (SUMOReal) DELTA_T / 1000.; 00094 if (oldPos<0&&newSpeed!=0) { 00095 timeOnLane = (oldPos+SPEED2DIST(newSpeed)) / newSpeed; 00096 } 00097 if (oldPos+SPEED2DIST(newSpeed)>getLane()->getLength()&&newSpeed!=0) { 00098 timeOnLane -= (oldPos+SPEED2DIST(newSpeed) - getLane()->getLength()) / newSpeed; 00099 ret = false; 00100 } 00101 if (timeOnLane<0) { 00102 MsgHandler::getErrorInstance()->inform("Negative vehicle step fraction on lane '" + getLane()->getID() + "'."); 00103 return false; 00104 } 00105 if (timeOnLane==0) { 00106 return false; 00107 } 00108 sampleSeconds += timeOnLane; 00109 travelledDistance += newSpeed * timeOnLane; 00110 SUMOReal a = veh.getPreDawdleAcceleration(); 00111 CO += (timeOnLane * HelpersHBEFA::computeCO(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a)); 00112 CO2 += (timeOnLane * HelpersHBEFA::computeCO2(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a)); 00113 HC += (timeOnLane * HelpersHBEFA::computeHC(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a)); 00114 NOx += (timeOnLane * HelpersHBEFA::computeNOx(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a)); 00115 PMx += (timeOnLane * HelpersHBEFA::computePMx(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a)); 00116 fuel += (timeOnLane * HelpersHBEFA::computeFuel(veh.getVehicleType().getEmissionClass(), (double) newSpeed, (double) a)); 00117 return ret; 00118 }
| virtual bool MSMoveReminder::notifyEnter | ( | MSVehicle & | veh, | |
| bool | isEmit, | |||
| bool | isLaneChange | |||
| ) | throw () [inline, virtual, inherited] |
Checks whether the reminder is activated by the vehicle's emission on lane change.
Lane change means in this case that the vehicle changes to the lane the reminder is placed at.
| [in] | veh | The entering vehicle. |
| [in] | isEmit | whether the vehicle was just emitted into the net |
| [in] | isLaneChange | whether the vehicle changed to the lane |
Reimplemented in MSE2Collector, MSE3Collector::MSE3EntryReminder, MSE3Collector::MSE3LeaveReminder, MSInductLoop, MSMeanData::MeanDataValueTracker, MSMeanData_Harmonoise::MSLaneMeanDataValues, MSMeanData_Net::MSLaneMeanDataValues, MSRouteProbe::EntryReminder, and MSTriggeredRerouter::Setter.
Definition at line 133 of file MSMoveReminder.h.
| 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_HBEFA::MSLaneMeanDataValues::reset | ( | ) | throw () [virtual] |
Resets values so they may be used for the next interval.
Implements MSMeanData::MeanDataValues.
Definition at line 61 of file MSMeanData_HBEFA.cpp.
References CO, CO2, fuel, HC, NOx, PMx, MSMeanData::MeanDataValues::sampleSeconds, and MSMeanData::MeanDataValues::travelledDistance.
00061 { 00062 sampleSeconds = 0.; 00063 travelledDistance = 0.; 00064 CO2 = 0; 00065 CO = 0; 00066 HC = 0; 00067 NOx = 0; 00068 PMx = 0; 00069 fuel = 0; 00070 }
| 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(), isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSMeanData::MeanDataValueTracker::isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::notifyEnter(), MSMeanData_Harmonoise::MSLaneMeanDataValues::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_HBEFA::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] | prefix | The xml prefix to write (mostly the lane / edge id) |
| [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 122 of file MSMeanData_HBEFA.cpp.
References CO, CO2, fuel, HC, MIN2(), MSMeanData::myMaxTravelTime, MSMeanData::myMinSamples, myParent, NOx, PMx, MSMeanData::MeanDataValues::sampleSeconds, STEPS2TIME, SUMOReal, and MSMeanData::MeanDataValues::travelledDistance.
00123 { 00124 dev<<std::resetiosflags(std::ios::floatfield); 00125 const SUMOReal normFactor = SUMOReal(3600. * 1000. / STEPS2TIME(period) / length); 00126 dev << "\" CO_abs=\""<<SUMOReal(CO*1000.) << 00127 "\" CO2_abs=\""<<SUMOReal(CO2*1000.) << 00128 "\" HC_abs=\""<<SUMOReal(HC*1000.) << 00129 "\" PMx_abs=\""<<SUMOReal(PMx*1000.) << 00130 "\" NOx_abs=\""<<SUMOReal(NOx*1000.) << 00131 "\" fuel_abs=\""<<SUMOReal(fuel*1000.) << 00132 "\"\n CO_normed=\""<<normFactor * CO << 00133 "\" CO2_normed=\""<<normFactor * CO2<< 00134 "\" HC_normed=\""<<normFactor * HC << 00135 "\" PMx_normed=\""<<normFactor * PMx << 00136 "\" NOx_normed=\""<<normFactor * NOx << 00137 "\" fuel_normed=\""<<normFactor * fuel; 00138 if (sampleSeconds > myParent->myMinSamples) { 00139 SUMOReal vehFactor = myParent->myMaxTravelTime / sampleSeconds; 00140 SUMOReal traveltime = myParent->myMaxTravelTime; 00141 if (travelledDistance > 0.f) { 00142 vehFactor = MIN2(vehFactor, length / travelledDistance); 00143 traveltime = MIN2(traveltime, length * sampleSeconds / travelledDistance); 00144 } 00145 dev<<"\"\n traveltime=\"" << traveltime<< 00146 "\" CO_perVeh=\""<<CO*vehFactor<< 00147 "\" CO2_perVeh=\""<<CO2*vehFactor<< 00148 "\" HC_perVeh=\""<<HC*vehFactor<< 00149 "\" PMx_perVeh=\""<<PMx*vehFactor<< 00150 "\" NOx_perVeh=\""<<NOx*vehFactor<< 00151 "\" fuel_perVeh=\""<<fuel*vehFactor; 00152 } 00153 dev<<"\"/>\n"; 00154 dev<<std::setiosflags(std::ios::fixed); // use decimal format 00155 }
SUMOReal MSMeanData_HBEFA::MSLaneMeanDataValues::CO [private] |
Sum of CO emissions.
Definition at line 129 of file MSMeanData_HBEFA.h.
Referenced by addTo(), isStillActive(), reset(), and write().
SUMOReal MSMeanData_HBEFA::MSLaneMeanDataValues::CO2 [private] |
Definition at line 127 of file MSMeanData_HBEFA.h.
Referenced by addTo(), isStillActive(), reset(), and write().
SUMOReal MSMeanData_HBEFA::MSLaneMeanDataValues::fuel [private] |
Sum of consumed fuel.
Definition at line 137 of file MSMeanData_HBEFA.h.
Referenced by addTo(), isStillActive(), reset(), and write().
SUMOReal MSMeanData_HBEFA::MSLaneMeanDataValues::HC [private] |
Sum of HC emissions.
Definition at line 131 of file MSMeanData_HBEFA.h.
Referenced by addTo(), isStillActive(), 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 MSMeanData::MeanDataValueTracker::reset().
const MSMeanData_HBEFA* MSMeanData_HBEFA::MSLaneMeanDataValues::myParent [private] |
SUMOReal MSMeanData_HBEFA::MSLaneMeanDataValues::NOx [private] |
Sum of NOx emissions.
Definition at line 133 of file MSMeanData_HBEFA.h.
Referenced by addTo(), isStillActive(), reset(), and write().
SUMOReal MSMeanData_HBEFA::MSLaneMeanDataValues::PMx [private] |
Sum of PMx emissions.
Definition at line 135 of file MSMeanData_HBEFA.h.
Referenced by addTo(), isStillActive(), reset(), and write().
SUMOReal MSMeanData::MeanDataValues::sampleSeconds [protected, inherited] |
Definition at line 134 of file MSMeanData.h.
Referenced by MSMeanData_Net::MSLaneMeanDataValues::addTo(), addTo(), MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(), MSMeanData::MeanDataValues::getSamples(), MSMeanData_Net::MSLaneMeanDataValues::isEmpty(), MSMeanData::MeanDataValues::isEmpty(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::reset(), reset(), MSMeanData_Harmonoise::MSLaneMeanDataValues::reset(), MSMeanData_Net::MSLaneMeanDataValues::write(), 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(), addTo(), MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSMeanData_Net::MSLaneMeanDataValues::reset(), reset(), MSMeanData_Harmonoise::MSLaneMeanDataValues::reset(), MSMeanData_Net::MSLaneMeanDataValues::write(), write(), and MSMeanData_Harmonoise::MSLaneMeanDataValues::write().
1.5.6