Eclipse SUMO - Simulation of Urban MObility
CEP.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2016-2022 German Aerospace Center (DLR) and others.
4 // PHEMlight module
5 // Copyright (C) 2016-2017 Technische Universitaet Graz, https://www.tugraz.at/
6 // This program and the accompanying materials are made available under the
7 // terms of the Eclipse Public License 2.0 which is available at
8 // https://www.eclipse.org/legal/epl-2.0/
9 // This Source Code may also be made available under the following Secondary
10 // Licenses when the conditions for such availability set forth in the Eclipse
11 // Public License 2.0 are satisfied: GNU General Public License, version 2
12 // or later which is available at
13 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
14 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
15 /****************************************************************************/
21 //
22 /****************************************************************************/
23 
24 
25 #ifndef PHEMlightCEP
26 #define PHEMlightCEP
27 
28 #define _USE_MATH_DEFINES
29 #include <string>
30 #include <map>
31 #include <vector>
32 #include <cmath>
33 #include <utility>
34 
35 //C# TO C++ CONVERTER NOTE: Forward class declarations:
36 namespace PHEMlightdll { class Helpers; }
37 
38 
39 namespace PHEMlightdll {
40  class CEP {
41  //--------------------------------------------------------------------------------------------------
42  // Constructors
43  //--------------------------------------------------------------------------------------------------
44 
45  public:
46  CEP(bool heavyVehicle, double vehicleMass, double vehicleLoading, double vehicleMassRot, double crossArea, double cWValue, double f0, double f1, double f2, double f3, double f4, double axleRatio, std::vector<double>& transmissionGearRatios, double auxPower, double ratedPower, double engineIdlingSpeed, double engineRatedSpeed, double effictiveWheelDiameter, double pNormV0, double pNormP0, double pNormV1, double pNormP1, const std::string& vehicelFuelType, std::vector<std::vector<double> >& matrixFC, std::vector<std::string>& headerLinePollutants, std::vector<std::vector<double> >& matrixPollutants, std::vector<std::vector<double> >& matrixSpeedRotational, std::vector<std::vector<double> >& normedDragTable, double idlingFC, std::vector<double>& idlingPollutants);
47 
48 
49  //--------------------------------------------------------------------------------------------------
50  // Members
51  //--------------------------------------------------------------------------------------------------
52 
53  private:
55  public:
56  const bool& getHeavyVehicle() const;
57 
58  private:
59  std::string _fuelType;
60  public:
61  const std::string& getFuelType() const;
62 
63  public:
67  };
68  private:
70  public:
71  const NormalizingType& getNormalizingTypeX() const;
72 
73  private:
74  double _ratedPower;
75  public:
76  const double& getRatedPower() const;
77  void setRatedPower(const double& value);
78 
79  private:
81  public:
82  const double& getNormalizingPower() const;
83 
84  private:
85  double _drivingPower;
86  public:
87  const double& getDrivingPower() const;
88  void setDrivingPower(const double& value);
89 
90 
91 
92  protected:
93  double _massVehicle;
97  double _cWValue;
98  double _resistanceF0;
99  double _resistanceF1;
103  double _axleRatio;
104  double _auxPower;
105  double _pNormV0;
106  double _pNormP0;
107  double _pNormV1;
108  double _pNormP1;
109 
113 
114  std::vector<double> _speedPatternRotational;
115  std::vector<double> _powerPatternFC;
116  std::vector<double> _normalizedPowerPatternFC;
118  std::vector<double> _powerPatternPollutants;
119 
120  std::vector<double> _cepCurveFC;
121  std::vector<double> _normedCepCurveFC;
122  std::vector<double> _gearTransmissionCurve;
123  std::vector<double> _speedCurveRotational;
124  std::map<std::string, std::vector<double> > _cepCurvePollutants;
125  std::map<std::string, std::vector<double> > _cepNormalizedCurvePollutants;
127  std::map<std::string, double> _idlingValuesPollutants;
128 
129  std::vector<double> _nNormTable;
130  std::vector<double> _dragNormTable;
131 
132 
133  //--------------------------------------------------------------------------------------------------
134  // Methods
135  //--------------------------------------------------------------------------------------------------
136 
137  public:
138  double CalcPower(double speed, double acc, double gradient);
139 
140  double CalcEngPower(double power);
141 
142  double GetEmission(const std::string& pollutant, double power, double speed, Helpers* VehicleClass);
143 
144 
145  double GetCO2Emission(double _FC, double _CO, double _HC, Helpers* VehicleClass);
146 
147  double GetDecelCoast(double speed, double acc, double gradient);
148 
149  double GetRotationalCoeffecient(double speed);
150 
151 
152  private:
153  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, std::vector<double>& pattern, double value);
154 
155  double Interpolate(double px, double p1, double p2, double e1, double e2);
156 
157  public:
158  double GetMaxAccel(double speed, double gradient);
159 
160  private:
161  double GetPMaxNorm(double speed);
162 
163  //--------------------------------------------------------------------------------------------------
164  // Operators for fleetmix
165  //--------------------------------------------------------------------------------------------------
166 
167 
168  private:
170  };
171 }
172 
173 
174 #endif //#ifndef PHEMlightCEP
PHEMlightdll::CEP::GetRotationalCoeffecient
double GetRotationalCoeffecient(double speed)
Definition: CEP.cpp:361
PHEMlightdll::CEP::setDrivingPower
void setDrivingPower(const double &value)
Definition: CEP.cpp:196
PHEMlightdll::CEP::_cepNormalizedCurvePollutants
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
Definition: CEP.h:125
PHEMlightdll::CEP::_ratedPower
double _ratedPower
Definition: CEP.h:74
PHEMlightdll::CEP::_idlingValueFC
double _idlingValueFC
Definition: CEP.h:126
PHEMlightdll::CEP::_cWValue
double _cWValue
Definition: CEP.h:97
PHEMlightdll::CEP::_speedPatternRotational
std::vector< double > _speedPatternRotational
Definition: CEP.h:114
PHEMlightdll::CEP::_vehicleLoading
double _vehicleLoading
Definition: CEP.h:94
PHEMlightdll::CEP::_dragNormTable
std::vector< double > _dragNormTable
Definition: CEP.h:130
PHEMlightdll::CEP::GetEmission
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
Definition: CEP.cpp:230
PHEMlightdll::CEP::setRatedPower
void setRatedPower(const double &value)
Definition: CEP.cpp:184
PHEMlightdll::CEP::_engineRatedSpeed
double _engineRatedSpeed
Definition: CEP.h:110
PHEMlightdll::CEP::_auxPower
double _auxPower
Definition: CEP.h:104
PHEMlightdll::CEP::_pNormP0
double _pNormP0
Definition: CEP.h:106
PHEMlightdll::CEP::_nNormTable
std::vector< double > _nNormTable
Definition: CEP.h:129
PHEMlightdll::CEP::getRatedPower
const double & getRatedPower() const
Definition: CEP.cpp:180
PHEMlightdll::CEP::_normailzedPowerPatternPollutants
std::vector< double > _normailzedPowerPatternPollutants
Definition: CEP.h:117
PHEMlightdll::CEP::_axleRatio
double _axleRatio
Definition: CEP.h:103
PHEMlightdll::CEP::GetPMaxNorm
double GetPMaxNorm(double speed)
Definition: CEP.cpp:427
PHEMlightdll::CEP::NormalizingType
NormalizingType
Definition: CEP.h:64
PHEMlightdll::CEP::getFuelType
const std::string & getFuelType() const
Definition: CEP.cpp:172
PHEMlightdll::CEP::_drivingPower
double _drivingPower
Definition: CEP.h:85
PHEMlightdll::CEP::InitializeInstanceFields
void InitializeInstanceFields()
Definition: CEP.cpp:440
PHEMlightdll::CEP::FindLowerUpperInPattern
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
Definition: CEP.cpp:370
PHEMlightdll::CEP::getNormalizingPower
const double & getNormalizingPower() const
Definition: CEP.cpp:188
PHEMlightdll::CEP::_cepCurvePollutants
std::map< std::string, std::vector< double > > _cepCurvePollutants
Definition: CEP.h:124
PHEMlightdll::CEP::getHeavyVehicle
const bool & getHeavyVehicle() const
Definition: CEP.cpp:168
PHEMlightdll::CEP::_resistanceF0
double _resistanceF0
Definition: CEP.h:98
PHEMlightdll::CEP::getNormalizingTypeX
const NormalizingType & getNormalizingTypeX() const
Definition: CEP.cpp:176
PHEMlightdll::CEP::_fuelType
std::string _fuelType
Definition: CEP.h:59
PHEMlightdll::CEP::_resistanceF2
double _resistanceF2
Definition: CEP.h:100
PHEMlightdll::CEP::GetCO2Emission
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
Definition: CEP.cpp:291
PHEMlightdll::CEP::_powerPatternPollutants
std::vector< double > _powerPatternPollutants
Definition: CEP.h:118
PHEMlightdll::CEP::_pNormV0
double _pNormV0
Definition: CEP.h:105
PHEMlightdll::CEP::GetMaxAccel
double GetMaxAccel(double speed, double gradient)
Definition: CEP.cpp:420
PHEMlightdll::CEP::getDrivingPower
const double & getDrivingPower() const
Definition: CEP.cpp:192
PHEMlightdll::CEP::_cepCurveFC
std::vector< double > _cepCurveFC
Definition: CEP.h:120
PHEMlightdll
Definition: CEP.cpp:30
PHEMlightdll::CEP::GetDecelCoast
double GetDecelCoast(double speed, double acc, double gradient)
Definition: CEP.cpp:326
PHEMlightdll::CEP::Interpolate
double Interpolate(double px, double p1, double p2, double e1, double e2)
Definition: CEP.cpp:412
PHEMlightdll::CEP::_heavyVehicle
bool _heavyVehicle
Definition: CEP.h:54
PHEMlightdll::Helpers
Definition: Helpers.h:32
PHEMlightdll::CEP::_vehicleMassRot
double _vehicleMassRot
Definition: CEP.h:95
PHEMlightdll::CEP.NormalizingType::NormalizingType_DrivingPower
@ NormalizingType_DrivingPower
Definition: CEP.h:66
PHEMlightdll::CEP::_normedCepCurveFC
std::vector< double > _normedCepCurveFC
Definition: CEP.h:121
PHEMlightdll::CEP::CalcPower
double CalcPower(double speed, double acc, double gradient)
Definition: CEP.cpp:200
PHEMlightdll::CEP.NormalizingType::NormalizingType_RatedPower
@ NormalizingType_RatedPower
Definition: CEP.h:65
PHEMlightdll::CEP::_pNormV1
double _pNormV1
Definition: CEP.h:107
PHEMlightdll::CEP::_resistanceF3
double _resistanceF3
Definition: CEP.h:101
PHEMlightdll::CEP::_resistanceF4
double _resistanceF4
Definition: CEP.h:102
PHEMlightdll::CEP::_speedCurveRotational
std::vector< double > _speedCurveRotational
Definition: CEP.h:123
PHEMlightdll::CEP::_crossSectionalArea
double _crossSectionalArea
Definition: CEP.h:96
PHEMlightdll::CEP::_resistanceF1
double _resistanceF1
Definition: CEP.h:99
PHEMlightdll::CEP::_normalizingType
NormalizingType _normalizingType
Definition: CEP.h:69
PHEMlightdll::CEP::_normalizingPower
double _normalizingPower
Definition: CEP.h:80
PHEMlightdll::CEP::_normalizedPowerPatternFC
std::vector< double > _normalizedPowerPatternFC
Definition: CEP.h:116
PHEMlightdll::CEP::_powerPatternFC
std::vector< double > _powerPatternFC
Definition: CEP.h:115
PHEMlightdll::CEP::_idlingValuesPollutants
std::map< std::string, double > _idlingValuesPollutants
Definition: CEP.h:127
PHEMlightdll::CEP::_pNormP1
double _pNormP1
Definition: CEP.h:108
PHEMlightdll::CEP::_gearTransmissionCurve
std::vector< double > _gearTransmissionCurve
Definition: CEP.h:122
PHEMlightdll::CEP::_massVehicle
double _massVehicle
Definition: CEP.h:93
PHEMlightdll::CEP
Definition: CEP.h:40
PHEMlightdll::CEP::_effectiveWheelDiameter
double _effectiveWheelDiameter
Definition: CEP.h:112
PHEMlightdll::CEP::CEP
CEP(bool heavyVehicle, double vehicleMass, double vehicleLoading, double vehicleMassRot, double crossArea, double cWValue, double f0, double f1, double f2, double f3, double f4, double axleRatio, std::vector< double > &transmissionGearRatios, double auxPower, double ratedPower, double engineIdlingSpeed, double engineRatedSpeed, double effictiveWheelDiameter, double pNormV0, double pNormP0, double pNormV1, double pNormP1, const std::string &vehicelFuelType, std::vector< std::vector< double > > &matrixFC, std::vector< std::string > &headerLinePollutants, std::vector< std::vector< double > > &matrixPollutants, std::vector< std::vector< double > > &matrixSpeedRotational, std::vector< std::vector< double > > &normedDragTable, double idlingFC, std::vector< double > &idlingPollutants)
Definition: CEP.cpp:32
PHEMlightdll::CEP::_engineIdlingSpeed
double _engineIdlingSpeed
Definition: CEP.h:111
PHEMlightdll::CEP::CalcEngPower
double CalcEngPower(double power)
Definition: CEP.cpp:219