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 /****************************************************************************/
18 // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
19 /****************************************************************************/
20 #ifndef PHEMCEP_h
21 #define PHEMCEP_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
31 #include "PHEMCEP.h"
32 #include "PHEMConstants.h"
33 
34 
35 
36 // ===========================================================================
37 // enumerations
38 // ===========================================================================
42 };
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 class PHEMCEP {
53 public:
54  /*** @brief Constructor
55  * @param[in] emissionClass PHEM emission class of vehicle
56  * @param[in] vehicleMass vehicle mass
57  * @param[in] vehicleLoading vehicle loading
58  * @param[in] vehicleMassRot rotational mass of vehicle
59  * @param[in] crossArea crosssectional area of vehicle
60  * @param[in] cWValue cw-value
61  * @param[in] f0 Rolling resistance f0
62  * @param[in] f1 Rolling resistance f1
63  * @param[in] f2 Rolling resistance f2
64  * @param[in] f3 Rolling resistance f3
65  * @param[in] f4 Rolling resistance f4
66  * @param[in] ratedPower rated power of vehicle
67  * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
68  * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
69  * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
70  * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
71  * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
72  * @param[in] matrixFC Coefficients of the fuel consumption
73  * @param[in] headerLine Definition of covered pollutants
74  * @param[in] headerLinePollutants Coefficients of the pollutants
75  * @param[in] matrixPollutants Coefficients of the pollutants
76  * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
77  */
78  PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier,
79  double vehicleMass, double vehicleLoading, double vehicleMassRot,
80  double crossArea, double cdValue,
81  double f0, double f1, double f2, double f3, double f4,
82  double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1,
83  double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter,
84  double idlingFC,
85  const std::string& vehicleFuelType,
86  const std::vector< std::vector<double> >& matrixFC,
87  const std::vector<std::string>& headerLinePollutants,
88  const std::vector< std::vector<double> >& matrixPollutants,
89  const std::vector< std::vector<double> >& matrixSpeedRotational,
90  const std::vector< std::vector<double> >& normedDragTable,
91  const std::vector<double>& idlingValuesPollutants);
92 
94  ~PHEMCEP();
95 
104  double CalcPower(double v, double a, double slope, double vehicleLoading = 0) const;
105 
106 
115  double GetMaxAccel(double v, double a, double gradient, double vehicleLoading = 0) const;
116 
122  double GetEmission(const std::string& pollutantIdentifier, double power, double speed, bool normalized = false) const;
123  double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const;
124 
125 
130  return _emissionClass;
131  }
132 
133 
137  double GetResistanceF0() const {
138  return _resistanceF0;
139  }
140 
141 
145  double GetResistanceF1() const {
146  return _resistanceF1;
147  }
148 
149 
153  double GetResistanceF2() const {
154  return _resistanceF2;
155  }
156 
157 
161  double GetResistanceF3() const {
162  return _resistanceF3;
163  }
164 
165 
169  double GetResistanceF4() const {
170  return _resistanceF4;
171  }
172 
173 
178  double GetCdValue() const {
179  return _cdValue;
180  }
181 
185  double GetCrossSectionalArea() const {
186  return _crossSectionalArea;
187  }
188 
189 
193  double GetMassVehicle() const {
194  return _massVehicle;
195  }
196 
200  double GetVehicleLoading() const {
201  return _vehicleLoading;
202  }
203 
204 
208  double GetMassRot() const {
209  return _massRot;
210  }
211 
212 
216  double GetRatedPower() const {
217  return _ratedPower;
218  }
219 
223  const std::string& GetVehicleFuelType() const {
224  return _vehicleFuelType;
225  }
226 
227 private:
236  double Interpolate(double px, double p1, double p2, double e1, double e2) const;
237 
244  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, const std::vector<double>& pattern, double value) const;
245 
249  double GetRotationalCoeffecient(double speed) const;
250  double GetGearCoeffecient(double speed) const;
251  double GetDragCoeffecient(double nNorm) const;
252 
256  double GetPMaxNorm(double speed) const;
257 
258 private:
273  double _cdValue;
277  double _massVehicle;
281  double _massRot;
283  double _ratedPower;
285  double _pNormV0;
287  double _pNormP0;
289  double _pNormV1;
291  double _pNormP1;
292  double _axleRatio;
296  double _idlingFC;
297  std::string _vehicleFuelType;
304  std::vector<double> _speedPatternRotational;
306  std::vector<double> _powerPatternFC;
308  std::vector<double> _powerPatternPollutants;
309  std::vector<double> _normalizedPowerPatternFC;
312  std::vector<double> _cepCurveFC;
314  std::vector<double> _normedCepCurveFC;
315  std::vector<double> _speedCurveRotational;
316  std::vector<double> _gearTransmissionCurve;
317  std::vector<double> _nNormTable;
318  std::vector<double> _dragNormTable;
322 
323 };
324 
325 #endif
326 
327 /****************************************************************************/
PHEMCEP::_speedCurveRotational
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:315
PHEMCEP::GetRotationalCoeffecient
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:319
PHEMCEP::_crossSectionalArea
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:275
PHEMCEP
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:52
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:400
PHEMCEP::_normalizingPower
double _normalizingPower
Definition: PHEMCEP.h:301
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:197
PHEMCEP::GetDecelCoast
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition: PHEMCEP.cpp:279
PHEMCEP::_normedCepCurveFC
std::vector< double > _normedCepCurveFC
Definition: PHEMCEP.h:314
StringBijection.h
PHEMCEP::_gearTransmissionCurve
std::vector< double > _gearTransmissionCurve
Definition: PHEMCEP.h:316
PHEMCEP::_resistanceF1
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:265
PHEMCEP::_sizeOfPatternFC
int _sizeOfPatternFC
Definition: PHEMCEP.h:298
PHEMCEP::GetGearCoeffecient
double GetGearCoeffecient(double speed) const
Definition: PHEMCEP.cpp:332
PHEMCEP::_powerPatternFC
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:306
PHEMCEP::GetVehicleLoading
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:200
SUMOEmissionClass
int SUMOEmissionClass
Definition: SUMOVehicleClass.h:232
PHEMCEP::_idlingFC
double _idlingFC
Definition: PHEMCEP.h:296
PHEMConstants.h
PHEMCEP::GetMassVehicle
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:193
PHEMCEP::_normalizedCepCurvePollutants
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition: PHEMCEP.h:320
PHEMCEP::~PHEMCEP
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:186
PHEMCEP::GetResistanceF4
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:169
NormalizingType
NormalizingType
Definition: PHEMCEP.h:39
PHEMCEP::GetDragCoeffecient
double GetDragCoeffecient(double nNorm) const
Definition: PHEMCEP.cpp:345
PHEMCEP::_sizeOfPatternPollutants
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:300
PHEMCEP::_powerPatternPollutants
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:308
PHEMCEP::GetEmissionClass
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:129
PHEMCEP::GetMassRot
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:208
PHEMCEP::_massRot
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:281
PHEMCEP::GetResistanceF1
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:145
PHEMCEP::GetRatedPower
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:216
StringBijection
Definition: StringBijection.h:44
PHEMCEP::_resistanceF2
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:267
DrivingPower
Definition: PHEMCEP.h:41
PHEMCEP::_engineRatedSpeed
double _engineRatedSpeed
Definition: PHEMCEP.h:294
PHEMCEP::_effictiveWheelDiameter
double _effictiveWheelDiameter
Definition: PHEMCEP.h:295
SUMOVehicleClass.h
PHEMCEP::_axleRatio
double _axleRatio
Definition: PHEMCEP.h:292
RatedPower
Definition: PHEMCEP.h:40
PHEMCEP::GetPMaxNorm
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:420
PHEMCEP::GetVehicleFuelType
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:223
PHEMCEP::_normailzedPowerPatternPollutants
std::vector< double > _normailzedPowerPatternPollutants
Definition: PHEMCEP.h:310
PHEMCEP::_vehicleLoading
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:279
PHEMCEP::_idlingValuesPollutants
StringBijection< double > _idlingValuesPollutants
Definition: PHEMCEP.h:321
PHEMCEP::_cepCurvePollutants
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:319
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:358
PHEMCEP::_normalizedPowerPatternFC
std::vector< double > _normalizedPowerPatternFC
Definition: PHEMCEP.h:309
PHEMCEP::GetCrossSectionalArea
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:185
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:411
PHEMCEP::_emissionClass
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:260
PHEMCEP::_pNormV0
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:285
PHEMCEP::_nNormTable
std::vector< double > _nNormTable
Definition: PHEMCEP.h:317
PHEMCEP::_heavyVehicle
bool _heavyVehicle
Definition: PHEMCEP.h:303
PHEMCEP::_drivingPower
double _drivingPower
Definition: PHEMCEP.h:302
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:271
PHEMCEP::_resistanceF4
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:271
PHEMCEP::_ratedPower
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:283
PHEMCEP::GetCdValue
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:178
PHEMCEP::_pNormP0
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:287
PHEMCEP::_vehicleFuelType
std::string _vehicleFuelType
Definition: PHEMCEP.h:297
PHEMCEP::_resistanceF3
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:269
config.h
PHEMCEP::_resistanceF0
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:263
PHEMCEP::_pNormV1
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:289
PHEMCEP::_massVehicle
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:277
PHEMCEP::GetResistanceF2
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:153
PHEMCEP::GetResistanceF0
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:137
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:38
PHEMCEP::GetResistanceF3
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:161
PHEMCEP::_normalizingType
NormalizingType _normalizingType
Definition: PHEMCEP.h:261
PHEMCEP::_engineIdlingSpeed
double _engineIdlingSpeed
Definition: PHEMCEP.h:293
PHEMCEP::_pNormP1
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:291
PHEMCEP::_cdValue
double _cdValue
Cw value.
Definition: PHEMCEP.h:273
PHEMCEP::_dragNormTable
std::vector< double > _dragNormTable
Definition: PHEMCEP.h:318
PHEMCEP.h
PHEMCEP::_speedPatternRotational
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:304
PHEMCEP::_cepCurveFC
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:312