SUMO - Simulation of Urban MObility
PHEMCEP.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
21 /****************************************************************************/
22 #ifndef PHEMCEP_h
23 #define PHEMCEP_h
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
37 #include "PHEMCEP.h"
38 #include "PHEMConstants.h"
39 
40 
41 
42 // ===========================================================================
43 // enumerations
44 // ===========================================================================
48 };
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
58 class PHEMCEP {
59 public:
60  /*** @brief Constructor
61  * @param[in] emissionClass PHEM emission class of vehicle
62  * @param[in] vehicleMass vehicle mass
63  * @param[in] vehicleLoading vehicle loading
64  * @param[in] vehicleMassRot rotational mass of vehicle
65  * @param[in] crossArea crosssectional area of vehicle
66  * @param[in] cWValue cw-value
67  * @param[in] f0 Rolling resistance f0
68  * @param[in] f1 Rolling resistance f1
69  * @param[in] f2 Rolling resistance f2
70  * @param[in] f3 Rolling resistance f3
71  * @param[in] f4 Rolling resistance f4
72  * @param[in] ratedPower rated power of vehicle
73  * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
74  * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
75  * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
76  * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
77  * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
78  * @param[in] matrixFC Coefficients of the fuel consumption
79  * @param[in] headerLine Definition of covered pollutants
80  * @param[in] headerLinePollutants Coefficients of the pollutants
81  * @param[in] matrixPollutants Coefficients of the pollutants
82  * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
83  */
84  PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier,
85  double vehicleMass, double vehicleLoading, double vehicleMassRot,
86  double crossArea, double cdValue,
87  double f0, double f1, double f2, double f3, double f4,
88  double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1,
89  double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter,
90  double idlingFC,
91  const std::string& vehicleFuelType,
92  const std::vector< std::vector<double> >& matrixFC,
93  const std::vector<std::string>& headerLinePollutants,
94  const std::vector< std::vector<double> >& matrixPollutants,
95  const std::vector< std::vector<double> >& matrixSpeedRotational,
96  const std::vector< std::vector<double> >& normedDragTable,
97  const std::vector<double>& idlingValuesPollutants);
98 
100  ~PHEMCEP();
101 
110  double CalcPower(double v, double a, double slope, double vehicleLoading = 0) const;
111 
112 
121  double GetMaxAccel(double v, double a, double gradient, double vehicleLoading = 0) const;
122 
128  double GetEmission(const std::string& pollutantIdentifier, double power, double speed, bool normalized = false) const;
129  double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const;
130 
131 
136  return _emissionClass;
137  }
138 
139 
143  double GetResistanceF0() const {
144  return _resistanceF0;
145  }
146 
147 
151  double GetResistanceF1() const {
152  return _resistanceF1;
153  }
154 
155 
159  double GetResistanceF2() const {
160  return _resistanceF2;
161  }
162 
163 
167  double GetResistanceF3() const {
168  return _resistanceF3;
169  }
170 
171 
175  double GetResistanceF4() const {
176  return _resistanceF4;
177  }
178 
179 
184  double GetCdValue() const {
185  return _cdValue;
186  }
187 
191  double GetCrossSectionalArea() const {
192  return _crossSectionalArea;
193  }
194 
195 
199  double GetMassVehicle() const {
200  return _massVehicle;
201  }
202 
206  double GetVehicleLoading() const {
207  return _vehicleLoading;
208  }
209 
210 
214  double GetMassRot() const {
215  return _massRot;
216  }
217 
218 
222  double GetRatedPower() const {
223  return _ratedPower;
224  }
225 
229  const std::string& GetVehicleFuelType() const {
230  return _vehicleFuelType;
231  }
232 
233 private:
242  double Interpolate(double px, double p1, double p2, double e1, double e2) const;
243 
250  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, const std::vector<double>& pattern, double value) const;
251 
255  double GetRotationalCoeffecient(double speed) const;
256  double GetGearCoeffecient(double speed) const;
257  double GetDragCoeffecient(double nNorm) const;
258 
262  double GetPMaxNorm(double speed) const;
263 
264 private:
279  double _cdValue;
283  double _massVehicle;
287  double _massRot;
289  double _ratedPower;
291  double _pNormV0;
293  double _pNormP0;
295  double _pNormV1;
297  double _pNormP1;
298  double _axleRatio;
302  double _idlingFC;
303  std::string _vehicleFuelType;
310  std::vector<double> _speedPatternRotational;
312  std::vector<double> _powerPatternFC;
314  std::vector<double> _powerPatternPollutants;
315  std::vector<double> _normalizedPowerPatternFC;
318  std::vector<double> _cepCurveFC;
320  std::vector<double> _normedCepCurveFC;
321  std::vector<double> _speedCurveRotational;
322  std::vector<double> _gearTransmissionCurve;
323  std::vector<double> _nNormTable;
324  std::vector<double> _dragNormTable;
328 
329 };
330 
331 #endif
332 
333 /****************************************************************************/
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:58
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:312
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:184
double _engineRatedSpeed
Definition: PHEMCEP.h:300
bool _heavyVehicle
Definition: PHEMCEP.h:309
std::vector< double > _normedCepCurveFC
Definition: PHEMCEP.h:320
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:426
double _idlingFC
Definition: PHEMCEP.h:302
PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string &emissionClassIdentifier, double vehicleMass, double vehicleLoading, double vehicleMassRot, double crossArea, double cdValue, double f0, double f1, double f2, double f3, double f4, double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1, double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter, double idlingFC, const std::string &vehicleFuelType, const std::vector< std::vector< double > > &matrixFC, const std::vector< std::string > &headerLinePollutants, const std::vector< std::vector< double > > &matrixPollutants, const std::vector< std::vector< double > > &matrixSpeedRotational, const std::vector< std::vector< double > > &normedDragTable, const std::vector< double > &idlingValuesPollutants)
Definition: PHEMCEP.cpp:44
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:321
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:151
double _normalizingPower
Definition: PHEMCEP.h:307
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:283
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:271
std::string _vehicleFuelType
Definition: PHEMCEP.h:303
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:214
double CalcPower(double v, double a, double slope, double vehicleLoading=0) const
Returns the power of used for a vehicle at state v,a, slope and loading.
Definition: PHEMCEP.cpp:406
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, const std::vector< double > &pattern, double value) const
Finds bounding upper and lower index in pattern for value.
Definition: PHEMCEP.cpp:364
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:167
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:293
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:192
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:295
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:275
double _axleRatio
Definition: PHEMCEP.h:298
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:287
int _sizeOfPatternFC
Definition: PHEMCEP.h:304
std::vector< double > _gearTransmissionCurve
Definition: PHEMCEP.h:322
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:291
std::vector< double > _nNormTable
Definition: PHEMCEP.h:323
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:281
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:285
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:297
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:310
double GetMaxAccel(double v, double a, double gradient, double vehicleLoading=0) const
Returns the maximum accelaration for a vehicle at state v,a, slope and loading.
Definition: PHEMCEP.cpp:417
double GetEmission(const std::string &pollutantIdentifier, double power, double speed, bool normalized=false) const
Returns a emission measure for power[kW] level.
Definition: PHEMCEP.cpp:203
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:191
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition: PHEMCEP.cpp:285
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:277
int SUMOEmissionClass
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:206
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:135
double _engineIdlingSpeed
Definition: PHEMCEP.h:299
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:229
double _cdValue
Cw value.
Definition: PHEMCEP.h:279
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:269
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:222
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:159
std::vector< double > _normailzedPowerPatternPollutants
Definition: PHEMCEP.h:316
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:318
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition: PHEMCEP.h:326
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:306
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:143
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:314
std::vector< double > _normalizedPowerPatternFC
Definition: PHEMCEP.h:315
StringBijection< double > _idlingValuesPollutants
Definition: PHEMCEP.h:327
double Interpolate(double px, double p1, double p2, double e1, double e2) const
Interpolates emission linearly between two known power-emission pairs.
Definition: PHEMCEP.cpp:277
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:289
NormalizingType
Definition: PHEMCEP.h:45
double _drivingPower
Definition: PHEMCEP.h:308
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:325
double GetGearCoeffecient(double speed) const
Definition: PHEMCEP.cpp:338
double _effictiveWheelDiameter
Definition: PHEMCEP.h:301
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:175
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:266
double GetDragCoeffecient(double nNorm) const
Definition: PHEMCEP.cpp:351
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:199
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:325
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:273
NormalizingType _normalizingType
Definition: PHEMCEP.h:267
std::vector< double > _dragNormTable
Definition: PHEMCEP.h:324