Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
18 /****************************************************************************/
19 #ifndef PHEMCEP_h
20 #define PHEMCEP_h
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
30 #include "PHEMCEP.h"
31 #include "PHEMConstants.h"
32 
33 
34 
35 // ===========================================================================
36 // enumerations
37 // ===========================================================================
41 };
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class PHEMCEP {
52 public:
53  /*** @brief Constructor
54  * @param[in] emissionClass PHEM emission class of vehicle
55  * @param[in] vehicleMass vehicle mass
56  * @param[in] vehicleLoading vehicle loading
57  * @param[in] vehicleMassRot rotational mass of vehicle
58  * @param[in] crossArea crosssectional area of vehicle
59  * @param[in] cWValue cw-value
60  * @param[in] f0 Rolling resistance f0
61  * @param[in] f1 Rolling resistance f1
62  * @param[in] f2 Rolling resistance f2
63  * @param[in] f3 Rolling resistance f3
64  * @param[in] f4 Rolling resistance f4
65  * @param[in] ratedPower rated power of vehicle
66  * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
67  * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
68  * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
69  * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
70  * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
71  * @param[in] matrixFC Coefficients of the fuel consumption
72  * @param[in] headerLine Definition of covered pollutants
73  * @param[in] headerLinePollutants Coefficients of the pollutants
74  * @param[in] matrixPollutants Coefficients of the pollutants
75  * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
76  */
77  PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier,
78  double vehicleMass, double vehicleLoading, double vehicleMassRot,
79  double crossArea, double cdValue,
80  double f0, double f1, double f2, double f3, double f4,
81  double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1,
82  double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter,
83  double idlingFC,
84  const std::string& vehicleFuelType,
85  const std::vector< std::vector<double> >& matrixFC,
86  const std::vector<std::string>& headerLinePollutants,
87  const std::vector< std::vector<double> >& matrixPollutants,
88  const std::vector< std::vector<double> >& matrixSpeedRotational,
89  const std::vector< std::vector<double> >& normedDragTable,
90  const std::vector<double>& idlingValuesPollutants);
91 
93  ~PHEMCEP();
94 
103  double CalcPower(double v, double a, double slope, double vehicleLoading = 0) const;
104 
105 
114  double GetMaxAccel(double v, double a, double gradient, double vehicleLoading = 0) const;
115 
121  double GetEmission(const std::string& pollutantIdentifier, double power, double speed, bool normalized = false) const;
122  double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const;
123 
124 
129  return _emissionClass;
130  }
131 
132 
136  double GetResistanceF0() const {
137  return _resistanceF0;
138  }
139 
140 
144  double GetResistanceF1() const {
145  return _resistanceF1;
146  }
147 
148 
152  double GetResistanceF2() const {
153  return _resistanceF2;
154  }
155 
156 
160  double GetResistanceF3() const {
161  return _resistanceF3;
162  }
163 
164 
168  double GetResistanceF4() const {
169  return _resistanceF4;
170  }
171 
172 
177  double GetCdValue() const {
178  return _cdValue;
179  }
180 
184  double GetCrossSectionalArea() const {
185  return _crossSectionalArea;
186  }
187 
188 
192  double GetMassVehicle() const {
193  return _massVehicle;
194  }
195 
199  double GetVehicleLoading() const {
200  return _vehicleLoading;
201  }
202 
203 
207  double GetMassRot() const {
208  return _massRot;
209  }
210 
211 
215  double GetRatedPower() const {
216  return _ratedPower;
217  }
218 
222  const std::string& GetVehicleFuelType() const {
223  return _vehicleFuelType;
224  }
225 
226 private:
235  double Interpolate(double px, double p1, double p2, double e1, double e2) const;
236 
243  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, const std::vector<double>& pattern, double value) const;
244 
248  double GetRotationalCoeffecient(double speed) const;
249  double GetGearCoeffecient(double speed) const;
250  double GetDragCoeffecient(double nNorm) const;
251 
255  double GetPMaxNorm(double speed) const;
256 
257 private:
272  double _cdValue;
276  double _massVehicle;
280  double _massRot;
282  double _ratedPower;
284  double _pNormV0;
286  double _pNormP0;
288  double _pNormV1;
290  double _pNormP1;
291  double _axleRatio;
295  double _idlingFC;
296  std::string _vehicleFuelType;
303  std::vector<double> _speedPatternRotational;
305  std::vector<double> _powerPatternFC;
307  std::vector<double> _powerPatternPollutants;
308  std::vector<double> _normalizedPowerPatternFC;
311  std::vector<double> _cepCurveFC;
313  std::vector<double> _normedCepCurveFC;
314  std::vector<double> _speedCurveRotational;
315  std::vector<double> _gearTransmissionCurve;
316  std::vector<double> _nNormTable;
317  std::vector<double> _dragNormTable;
321 
322 };
323 
324 #endif
325 
326 /****************************************************************************/
PHEMCEP::_speedCurveRotational
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:314
PHEMCEP::GetRotationalCoeffecient
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:318
PHEMCEP::_crossSectionalArea
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:274
PHEMCEP
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:51
PHEMCEP::CalcPower
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:399
PHEMCEP::_normalizingPower
double _normalizingPower
Definition: PHEMCEP.h:300
PHEMCEP::GetEmission
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:196
PHEMCEP::GetDecelCoast
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition: PHEMCEP.cpp:278
PHEMCEP::_normedCepCurveFC
std::vector< double > _normedCepCurveFC
Definition: PHEMCEP.h:313
StringBijection.h
PHEMCEP::_gearTransmissionCurve
std::vector< double > _gearTransmissionCurve
Definition: PHEMCEP.h:315
PHEMCEP::_resistanceF1
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:264
PHEMCEP::_sizeOfPatternFC
int _sizeOfPatternFC
Definition: PHEMCEP.h:297
PHEMCEP::GetGearCoeffecient
double GetGearCoeffecient(double speed) const
Definition: PHEMCEP.cpp:331
PHEMCEP::_powerPatternFC
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:305
PHEMCEP::GetVehicleLoading
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:199
SUMOEmissionClass
int SUMOEmissionClass
Definition: SUMOVehicleClass.h:231
PHEMCEP::_idlingFC
double _idlingFC
Definition: PHEMCEP.h:295
PHEMConstants.h
PHEMCEP::GetMassVehicle
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:192
PHEMCEP::_normalizedCepCurvePollutants
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition: PHEMCEP.h:319
PHEMCEP::~PHEMCEP
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:185
PHEMCEP::GetResistanceF4
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:168
NormalizingType
NormalizingType
Definition: PHEMCEP.h:38
PHEMCEP::GetDragCoeffecient
double GetDragCoeffecient(double nNorm) const
Definition: PHEMCEP.cpp:344
PHEMCEP::_sizeOfPatternPollutants
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:299
PHEMCEP::_powerPatternPollutants
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:307
PHEMCEP::GetEmissionClass
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:128
PHEMCEP::GetMassRot
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:207
PHEMCEP::_massRot
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:280
PHEMCEP::GetResistanceF1
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:144
PHEMCEP::GetRatedPower
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:215
StringBijection
Definition: StringBijection.h:43
PHEMCEP::_resistanceF2
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:266
DrivingPower
Definition: PHEMCEP.h:40
PHEMCEP::_engineRatedSpeed
double _engineRatedSpeed
Definition: PHEMCEP.h:293
PHEMCEP::_effictiveWheelDiameter
double _effictiveWheelDiameter
Definition: PHEMCEP.h:294
SUMOVehicleClass.h
PHEMCEP::_axleRatio
double _axleRatio
Definition: PHEMCEP.h:291
RatedPower
Definition: PHEMCEP.h:39
PHEMCEP::GetPMaxNorm
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:419
PHEMCEP::GetVehicleFuelType
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:222
PHEMCEP::_normailzedPowerPatternPollutants
std::vector< double > _normailzedPowerPatternPollutants
Definition: PHEMCEP.h:309
PHEMCEP::_vehicleLoading
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:278
PHEMCEP::_idlingValuesPollutants
StringBijection< double > _idlingValuesPollutants
Definition: PHEMCEP.h:320
PHEMCEP::_cepCurvePollutants
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:318
PHEMCEP::FindLowerUpperInPattern
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:357
PHEMCEP::_normalizedPowerPatternFC
std::vector< double > _normalizedPowerPatternFC
Definition: PHEMCEP.h:308
PHEMCEP::GetCrossSectionalArea
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:184
PHEMCEP::GetMaxAccel
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:410
PHEMCEP::_emissionClass
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:259
PHEMCEP::_pNormV0
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:284
PHEMCEP::_nNormTable
std::vector< double > _nNormTable
Definition: PHEMCEP.h:316
PHEMCEP::_heavyVehicle
bool _heavyVehicle
Definition: PHEMCEP.h:302
PHEMCEP::_drivingPower
double _drivingPower
Definition: PHEMCEP.h:301
PHEMCEP::Interpolate
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:270
PHEMCEP::_resistanceF4
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:270
PHEMCEP::_ratedPower
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:282
PHEMCEP::GetCdValue
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:177
PHEMCEP::_pNormP0
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:286
PHEMCEP::_vehicleFuelType
std::string _vehicleFuelType
Definition: PHEMCEP.h:296
PHEMCEP::_resistanceF3
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:268
config.h
PHEMCEP::_resistanceF0
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:262
PHEMCEP::_pNormV1
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:288
PHEMCEP::_massVehicle
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:276
PHEMCEP::GetResistanceF2
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:152
PHEMCEP::GetResistanceF0
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:136
PHEMCEP::PHEMCEP
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:37
PHEMCEP::GetResistanceF3
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:160
PHEMCEP::_normalizingType
NormalizingType _normalizingType
Definition: PHEMCEP.h:260
PHEMCEP::_engineIdlingSpeed
double _engineIdlingSpeed
Definition: PHEMCEP.h:292
PHEMCEP::_pNormP1
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:290
PHEMCEP::_cdValue
double _cdValue
Cw value.
Definition: PHEMCEP.h:272
PHEMCEP::_dragNormTable
std::vector< double > _dragNormTable
Definition: PHEMCEP.h:317
PHEMCEP.h
PHEMCEP::_speedPatternRotational
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:303
PHEMCEP::_cepCurveFC
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:311