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 /****************************************************************************/
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:52
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:306
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:178
double _engineRatedSpeed
Definition: PHEMCEP.h:294
bool _heavyVehicle
Definition: PHEMCEP.h:303
std::vector< double > _normedCepCurveFC
Definition: PHEMCEP.h:314
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:420
double _idlingFC
Definition: PHEMCEP.h:296
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
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:315
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:145
double _normalizingPower
Definition: PHEMCEP.h:301
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:277
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:265
std::string _vehicleFuelType
Definition: PHEMCEP.h:297
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:208
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
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
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:161
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:287
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:186
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:289
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:269
double _axleRatio
Definition: PHEMCEP.h:292
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:281
int _sizeOfPatternFC
Definition: PHEMCEP.h:298
std::vector< double > _gearTransmissionCurve
Definition: PHEMCEP.h:316
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:285
std::vector< double > _nNormTable
Definition: PHEMCEP.h:317
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:275
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:279
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:291
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:304
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
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
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:185
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition: PHEMCEP.cpp:279
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:271
int SUMOEmissionClass
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:200
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:129
double _engineIdlingSpeed
Definition: PHEMCEP.h:293
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:223
double _cdValue
Cw value.
Definition: PHEMCEP.h:273
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:263
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:216
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:153
std::vector< double > _normailzedPowerPatternPollutants
Definition: PHEMCEP.h:310
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:312
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition: PHEMCEP.h:320
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:300
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:137
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:308
std::vector< double > _normalizedPowerPatternFC
Definition: PHEMCEP.h:309
StringBijection< double > _idlingValuesPollutants
Definition: PHEMCEP.h:321
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
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:283
NormalizingType
Definition: PHEMCEP.h:39
double _drivingPower
Definition: PHEMCEP.h:302
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:319
double GetGearCoeffecient(double speed) const
Definition: PHEMCEP.cpp:332
double _effictiveWheelDiameter
Definition: PHEMCEP.h:295
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:169
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:260
double GetDragCoeffecient(double nNorm) const
Definition: PHEMCEP.cpp:345
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:193
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:319
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:267
NormalizingType _normalizingType
Definition: PHEMCEP.h:261
std::vector< double > _dragNormTable
Definition: PHEMCEP.h:318