SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PHEMCEP.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2013-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef PHEMCEP_h
24 #define PHEMCEP_h
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
38 #include "PHEMCEP.h"
39 #include "PHEMConstants.h"
40 
41 
42 
43 // ===========================================================================
44 // enumerations
45 // ===========================================================================
49 };
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
59 class PHEMCEP {
60 public:
61  /*** @brief Constructor
62  * @param[in] emissionClass PHEM emission class of vehicle
63  * @param[in] vehicleMass vehicle mass
64  * @param[in] vehicleLoading vehicle loading
65  * @param[in] vehicleMassRot rotational mass of vehicle
66  * @param[in] crossArea crosssectional area of vehicle
67  * @param[in] cWValue cw-value
68  * @param[in] f0 Rolling resistance f0
69  * @param[in] f1 Rolling resistance f1
70  * @param[in] f2 Rolling resistance f2
71  * @param[in] f3 Rolling resistance f3
72  * @param[in] f4 Rolling resistance f4
73  * @param[in] ratedPower rated power of vehicle
74  * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
75  * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
76  * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
77  * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
78  * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
79  * @param[in] matrixFC Coefficients of the fuel consumption
80  * @param[in] headerLine Definition of covered pollutants
81  * @param[in] headerLinePollutants Coefficients of the pollutants
82  * @param[in] matrixPollutants Coefficients of the pollutants
83  * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
84  */
85  PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier,
86  double vehicleMass, double vehicleLoading, double vehicleMassRot,
87  double crossArea, double cdValue,
88  double f0, double f1, double f2, double f3, double f4,
89  double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1,
90  double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter,
91  double idlingFC,
92  const std::string& vehicleFuelType,
93  const std::vector< std::vector<double> >& matrixFC,
94  const std::vector<std::string>& headerLinePollutants,
95  const std::vector< std::vector<double> >& matrixPollutants,
96  const std::vector< std::vector<double> >& matrixSpeedRotational,
97  const std::vector< std::vector<double> >& normedDragTable,
98  const std::vector<double>& idlingValuesPollutants);
99 
101  ~PHEMCEP();
102 
111  double CalcPower(double v, double a, double slope, double vehicleLoading = 0) const;
112 
113 
122  double GetMaxAccel(double v, double a, double gradient, double vehicleLoading = 0) const;
123 
129  double GetEmission(const std::string& pollutantIdentifier, double power, double speed, bool normalized = false) const;
130  double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const;
131 
132 
137  return _emissionClass;
138  }
139 
140 
144  double GetResistanceF0() const {
145  return _resistanceF0;
146  }
147 
148 
152  double GetResistanceF1() const {
153  return _resistanceF1;
154  }
155 
156 
160  double GetResistanceF2() const {
161  return _resistanceF2;
162  }
163 
164 
168  double GetResistanceF3() const {
169  return _resistanceF3;
170  }
171 
172 
176  double GetResistanceF4() const {
177  return _resistanceF4;
178  }
179 
180 
185  double GetCdValue() const {
186  return _cdValue;
187  }
188 
192  double GetCrossSectionalArea() const {
193  return _crossSectionalArea;
194  }
195 
196 
200  double GetMassVehicle() const {
201  return _massVehicle;
202  }
203 
207  double GetVehicleLoading() const {
208  return _vehicleLoading;
209  }
210 
211 
215  double GetMassRot() const {
216  return _massRot;
217  }
218 
219 
223  double GetRatedPower() const {
224  return _ratedPower;
225  }
226 
230  std::string GetVehicleFuelType() const {
231  return _vehicleFuelType;
232  }
233 
234 private:
243  double Interpolate(double px, double p1, double p2, double e1, double e2) const;
244 
251  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, const std::vector<double>& pattern, double value) const;
252 
256  double GetRotationalCoeffecient(double speed) const;
257  double GetGearCoeffecient(double speed) const;
258  double GetDragCoeffecient(double nNorm) const;
259 
263  double GetPMaxNorm(double speed) const;
264 
265 private:
280  double _cdValue;
284  double _massVehicle;
288  double _massRot;
290  double _ratedPower;
292  double _pNormV0;
294  double _pNormP0;
296  double _pNormV1;
298  double _pNormP1;
299  double _axleRatio;
303  double _idlingFC;
304  std::string _vehicleFuelType;
311  std::vector<double> _speedPatternRotational;
313  std::vector<double> _powerPatternFC;
315  std::vector<double> _powerPatternPollutants;
316  std::vector<double> _normalizedPowerPatternFC;
319  std::vector<double> _cepCurveFC;
321  std::vector<double> _normedCepCurveFC;
322  std::vector<double> _speedCurveRotational;
323  std::vector<double> _gearTransmissionCurve;
324  std::vector<double> _nNormTable;
325  std::vector<double> _dragNormTable;
329 
330 };
331 
332 #endif
333 
334 /****************************************************************************/
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:223
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:59
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:207
std::vector< double > _powerPatternFC
Definition: PHEMCEP.h:313
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:369
double _engineRatedSpeed
Definition: PHEMCEP.h:301
bool _heavyVehicle
Definition: PHEMCEP.h:310
std::vector< double > _normedCepCurveFC
Definition: PHEMCEP.h:321
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:185
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:168
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:136
double _idlingFC
Definition: PHEMCEP.h:303
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:49
std::vector< double > _speedCurveRotational
Definition: PHEMCEP.h:322
double _normalizingPower
Definition: PHEMCEP.h:308
double _massVehicle
vehicle mass
Definition: PHEMCEP.h:284
double _resistanceF1
Rolling resistance f1.
Definition: PHEMCEP.h:272
double GetGearCoeffecient(double speed) const
Definition: PHEMCEP.cpp:343
std::string _vehicleFuelType
Definition: PHEMCEP.h:304
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:200
std::string GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:230
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:192
double _pNormP0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:294
~PHEMCEP()
Destructor.
Definition: PHEMCEP.cpp:197
double _pNormV1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:296
double _resistanceF3
Rolling resistance f3.
Definition: PHEMCEP.h:276
double _axleRatio
Definition: PHEMCEP.h:299
double _massRot
rotational mass of vehicle
Definition: PHEMCEP.h:288
int _sizeOfPatternFC
Definition: PHEMCEP.h:305
std::vector< double > _gearTransmissionCurve
Definition: PHEMCEP.h:323
double _pNormV0
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:292
std::vector< double > _nNormTable
Definition: PHEMCEP.h:324
double _crossSectionalArea
crosssectional area of vehicle
Definition: PHEMCEP.h:282
double _vehicleLoading
vehicle loading
Definition: PHEMCEP.h:286
double _pNormP1
Step functions parameter for maximum rated power.
Definition: PHEMCEP.h:298
std::vector< double > _speedPatternRotational
Definition: PHEMCEP.h:311
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition: PHEMCEP.cpp:330
double _resistanceF4
Rolling resistance f4.
Definition: PHEMCEP.h:278
int SUMOEmissionClass
double _engineIdlingSpeed
Definition: PHEMCEP.h:300
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:152
double _cdValue
Cw value.
Definition: PHEMCEP.h:280
double _resistanceF0
Rolling resistance f0.
Definition: PHEMCEP.h:270
std::vector< double > _normailzedPowerPatternPollutants
Definition: PHEMCEP.h:317
std::vector< double > _cepCurveFC
Definition: PHEMCEP.h:319
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition: PHEMCEP.cpp:431
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition: PHEMCEP.h:327
int _sizeOfPatternPollutants
Definition: PHEMCEP.h:307
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:144
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:422
std::vector< double > _powerPatternPollutants
Definition: PHEMCEP.h:315
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:411
std::vector< double > _normalizedPowerPatternFC
Definition: PHEMCEP.h:316
StringBijection< double > _idlingValuesPollutants
Definition: PHEMCEP.h:328
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:282
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:160
double _ratedPower
rated power of vehicle
Definition: PHEMCEP.h:290
NormalizingType
Definition: PHEMCEP.h:46
double _drivingPower
Definition: PHEMCEP.h:309
StringBijection< std::vector< double > > _cepCurvePollutants
Definition: PHEMCEP.h:326
double _effictiveWheelDiameter
Definition: PHEMCEP.h:302
double GetDragCoeffecient(double nNorm) const
Definition: PHEMCEP.cpp:356
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition: PHEMCEP.cpp:290
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:215
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition: PHEMCEP.h:267
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:208
double _resistanceF2
Rolling resistance f2.
Definition: PHEMCEP.h:274
NormalizingType _normalizingType
Definition: PHEMCEP.h:268
std::vector< double > _dragNormTable
Definition: PHEMCEP.h:325
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:176