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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <vector>
29 #include "PHEMCEP.h"
30 #include "PHEMConstants.h"
31 
32 
33 
34 // ===========================================================================
35 // enumerations
36 // ===========================================================================
40 };
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 class PHEMCEP {
51 public:
52  /*** @brief Constructor
53  * @param[in] emissionClass PHEM emission class of vehicle
54  * @param[in] vehicleMass vehicle mass
55  * @param[in] vehicleLoading vehicle loading
56  * @param[in] vehicleMassRot rotational mass of vehicle
57  * @param[in] crossArea crosssectional area of vehicle
58  * @param[in] cWValue cw-value
59  * @param[in] f0 Rolling resistance f0
60  * @param[in] f1 Rolling resistance f1
61  * @param[in] f2 Rolling resistance f2
62  * @param[in] f3 Rolling resistance f3
63  * @param[in] f4 Rolling resistance f4
64  * @param[in] ratedPower rated power of vehicle
65  * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
66  * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
67  * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
68  * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
69  * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
70  * @param[in] matrixFC Coefficients of the fuel consumption
71  * @param[in] headerLine Definition of covered pollutants
72  * @param[in] headerLinePollutants Coefficients of the pollutants
73  * @param[in] matrixPollutants Coefficients of the pollutants
74  * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
75  */
76  PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier,
77  double vehicleMass, double vehicleLoading, double vehicleMassRot,
78  double crossArea, double cdValue,
79  double f0, double f1, double f2, double f3, double f4,
80  double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1,
81  double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter,
82  double idlingFC,
83  const std::string& vehicleFuelType,
84  const std::vector< std::vector<double> >& matrixFC,
85  const std::vector<std::string>& headerLinePollutants,
86  const std::vector< std::vector<double> >& matrixPollutants,
87  const std::vector< std::vector<double> >& matrixSpeedRotational,
88  const std::vector< std::vector<double> >& normedDragTable,
89  const std::vector<double>& idlingValuesPollutants);
90 
92  ~PHEMCEP();
93 
102  double CalcPower(double v, double a, double slope, double vehicleLoading = 0) const;
103 
104 
113  double GetMaxAccel(double v, double a, double gradient, double vehicleLoading = 0) const;
114 
120  double GetEmission(const std::string& pollutantIdentifier, double power, double speed, bool normalized = false) const;
121  double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const;
122 
123 
128  return _emissionClass;
129  }
130 
131 
135  double GetResistanceF0() const {
136  return _resistanceF0;
137  }
138 
139 
143  double GetResistanceF1() const {
144  return _resistanceF1;
145  }
146 
147 
151  double GetResistanceF2() const {
152  return _resistanceF2;
153  }
154 
155 
159  double GetResistanceF3() const {
160  return _resistanceF3;
161  }
162 
163 
167  double GetResistanceF4() const {
168  return _resistanceF4;
169  }
170 
171 
176  double GetCdValue() const {
177  return _cdValue;
178  }
179 
183  double GetCrossSectionalArea() const {
184  return _crossSectionalArea;
185  }
186 
187 
191  double GetMassVehicle() const {
192  return _massVehicle;
193  }
194 
198  double GetVehicleLoading() const {
199  return _vehicleLoading;
200  }
201 
202 
206  double GetMassRot() const {
207  return _massRot;
208  }
209 
210 
214  double GetRatedPower() const {
215  return _ratedPower;
216  }
217 
221  const std::string& GetVehicleFuelType() const {
222  return _vehicleFuelType;
223  }
224 
225 private:
234  double Interpolate(double px, double p1, double p2, double e1, double e2) const;
235 
242  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, const std::vector<double>& pattern, double value) const;
243 
247  double GetRotationalCoeffecient(double speed) const;
248  double GetGearCoeffecient(double speed) const;
249  double GetDragCoeffecient(double nNorm) const;
250 
254  double GetPMaxNorm(double speed) const;
255 
256 private:
271  double _cdValue;
275  double _massVehicle;
279  double _massRot;
281  double _ratedPower;
283  double _pNormV0;
285  double _pNormP0;
287  double _pNormV1;
289  double _pNormP1;
290  double _axleRatio;
294  double _idlingFC;
295  std::string _vehicleFuelType;
302  std::vector<double> _speedPatternRotational;
304  std::vector<double> _powerPatternFC;
306  std::vector<double> _powerPatternPollutants;
307  std::vector<double> _normalizedPowerPatternFC;
310  std::vector<double> _cepCurveFC;
312  std::vector<double> _normedCepCurveFC;
313  std::vector<double> _speedCurveRotational;
314  std::vector<double> _gearTransmissionCurve;
315  std::vector<double> _nNormTable;
316  std::vector<double> _dragNormTable;
320 
321 };
NormalizingType
Definition: PHEMCEP.h:37
@ RatedPower
Definition: PHEMCEP.h:38
@ DrivingPower
Definition: PHEMCEP.h:39
int SUMOEmissionClass
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:50
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:135
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:267
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:283
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
double _effictiveWheelDiameter
Definition: PHEMCEP.h:293
double _idlingFC
Definition: PHEMCEP.h:294
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:313
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:317
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:143
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:277
int _sizeOfPatternFC
Definition: PHEMCEP.h:296
std::string _vehicleFuelType
Definition: PHEMCEP.h:295
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:167
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
double GetDragCoeffecient(double nNorm) const
Definition: PHEMCEP.cpp:344
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:151
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:287
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:289
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:198
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:265
std::vector< double > _nNormTable
Definition: PHEMCEP.h:315
double _engineIdlingSpeed
Definition: PHEMCEP.h:291
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:127
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:191
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:183
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:269
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:263
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
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:261
std::vector< double > _normedCepCurveFC
Definition: PHEMCEP.h:312
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:310
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition: PHEMCEP.cpp:278
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:306
std::vector< double > _normailzedPowerPatternPollutants
Definition: PHEMCEP.h:308
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:275
double _axleRatio
Definition: PHEMCEP.h:290
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:185
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:285
double _drivingPower
Definition: PHEMCEP.h:300
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:258
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
std::vector< double > _dragNormTable
Definition: PHEMCEP.h:316
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:206
NormalizingType _normalizingType
Definition: PHEMCEP.h:259
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:302
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
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:304
StringBijection< double > _idlingValuesPollutants
Definition: PHEMCEP.h:319
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:318
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:298
double GetGearCoeffecient(double speed) const
Definition: PHEMCEP.cpp:331
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:214
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:281
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:279
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:159
std::vector< double > _gearTransmissionCurve
Definition: PHEMCEP.h:314
double _normalizingPower
Definition: PHEMCEP.h:299
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition: PHEMCEP.h:318
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:176
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:419
std::vector< double > _normalizedPowerPatternFC
Definition: PHEMCEP.h:307
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
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:273
double _cdValue
Cw value.
Definition: PHEMCEP.h:271
bool _heavyVehicle
Definition: PHEMCEP.h:301
double _engineRatedSpeed
Definition: PHEMCEP.h:292
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:221