42 #ifdef CHECK_MEMORY_LEAKS
44 #endif // CHECK_MEMORY_LEAKS
54 const SUMOReal length,
const bool doAdd,
55 const std::set<std::string>*
const vTypes,
58 CO2(0), CO(0), HC(0), NOx(0), PMx(0), fuel(0), myParent(parent) {}
68 travelledDistance = 0.;
94 sampleSeconds += timeOnLane;
95 travelledDistance += speed * timeOnLane;
122 if (sampleSeconds > myParent->myMinSamples) {
123 SUMOReal vehFactor = myParent->myMaxTravelTime / sampleSeconds;
124 SUMOReal traveltime = myParent->myMaxTravelTime;
125 if (travelledDistance > 0.f) {
126 vehFactor =
MIN2(vehFactor, myLaneLength / travelledDistance);
127 traveltime =
MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance);
136 }
else if (defaultTravelTime >= 0.) {
159 const bool useLanes,
const bool withEmpty,
160 const bool printDefaults,
161 const bool withInternal,
162 const bool trackVehicles,
165 const std::set<std::string> vTypes)
166 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
167 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes) {
static SUMOReal computeDefaultCO2(SUMOEmissionClass c, double v, double a, double slope, SUMOReal tt)
Returns the amount of emitted CO2 given the vehicle type and default values for the state (in mg) ...
Data collector for edges/lanes.
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
MSMeanData_Emissions(const std::string &id, const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const SUMOReal minSamples, const SUMOReal maxTravelTime, const std::set< std::string > vTypes)
Constructor.
SUMOReal travelledDistance
The sum of the distances the vehicles travelled.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID)
Returns the named vehicle type or a sample from the named distribution.
static SUMOReal computeDefaultHC(SUMOEmissionClass c, double v, double a, double slope, SUMOReal tt)
Returns the amount of emitted HC given the vehicle type and default values for the state (in mg) ...
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const std::set< std::string > myVehicleTypes
The vehicle types to look for (empty means all)
The car-following model and parameter.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
static SUMOReal computeDefaultNOx(SUMOEmissionClass c, double v, double a, double slope, SUMOReal tt)
Returns the amount of emitted NOx given the vehicle type and default values for the state (in mg) ...
static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of consumed fuel given the vehicle type and state (in ml/s)
static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO2 given the vehicle type and state (in mg/s)
static SUMOReal computeDefaultPMx(SUMOEmissionClass c, double v, double a, double slope, SUMOReal tt)
Returns the amount of emitted PMx given the vehicle type and default values for the state (in mg) ...
SUMOReal CO
Sum of CO emissions in mg.
Representation of a vehicle.
Data structure for mean (aggregated) edge/lane values.
static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted NOx given the vehicle type and state (in mg/s)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
static SUMOReal computeHC(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted HC given the vehicle type and state (in mg/s)
SUMOReal fuel
Sum of consumed fuel in ml.
static SUMOReal computeDefaultFuel(SUMOEmissionClass c, double v, double a, double slope, SUMOReal tt)
Returns the amount of fuel given the vehicle type and default values for the state (in ml) ...
SUMOReal NOx
Sum of NOx emissions in mg.
Emission data collector for edges/lanes.
SUMOReal HC
Sum of HC emissions in mg.
static SUMOReal computeDefaultCO(SUMOEmissionClass c, double v, double a, double slope, SUMOReal tt)
Returns the amount of emitted CO given the vehicle type and default values for the state (in mg) ...
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
static SUMOReal computeCO(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO given the vehicle type and state (in mg/s)
virtual SUMOReal getAcceleration() const =0
Returns the vehicle's acceleration.
SUMOReal PMx
Sum of PMx emissions in mg.
static std::string realString(const SUMOReal v, const int precision=OUTPUT_ACCURACY)
Helper method for string formatting.
void notifyMoveInternal(SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
Internal notification about the vehicle moves.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
virtual ~MSMeanData_Emissions()
Destructor.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
virtual SUMOReal getSlope() const =0
Returns the slope of the road at vehicle's position.
virtual ~MSLaneMeanDataValues()
Destructor.
MSLaneMeanDataValues(MSLane *const lane, const SUMOReal length, const bool doAdd, const std::set< std::string > *const vTypes=0, const MSMeanData_Emissions *parent=0)
Constructor.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const SUMOReal length, const bool doAdd) const
Create an instance of MeanDataValues.
Representation of a lane in the micro simulation.
void write(OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
static SUMOReal computePMx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted PMx given the vehicle type and state (in mg/s)
Data structure for mean (aggregated) edge/lane values.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.