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-2020 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
std::vector< double > _speedCurveRotational
Definition: CEP.h:123
const double & getDrivingPower() const
Definition: CEP.cpp:192
std::vector< double > _powerPatternFC
Definition: CEP.h:115
double _pNormP1
Definition: CEP.h:108
double GetPMaxNorm(double speed)
Definition: CEP.cpp:427
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
const NormalizingType & getNormalizingTypeX() const
Definition: CEP.cpp:176
double _pNormP0
Definition: CEP.h:106
double _effectiveWheelDiameter
Definition: CEP.h:112
void setDrivingPower(const double &value)
Definition: CEP.cpp:196
double _drivingPower
Definition: CEP.h:85
double _axleRatio
Definition: CEP.h:103
double GetMaxAccel(double speed, double gradient)
Definition: CEP.cpp:420
double _vehicleLoading
Definition: CEP.h:94
bool _heavyVehicle
Definition: CEP.h:54
const double & getNormalizingPower() const
Definition: CEP.cpp:188
double _ratedPower
Definition: CEP.h:74
std::vector< double > _normalizedPowerPatternFC
Definition: CEP.h:116
std::map< std::string, double > _idlingValuesPollutants
Definition: CEP.h:127
double _normalizingPower
Definition: CEP.h:80
NormalizingType _normalizingType
Definition: CEP.h:69
std::vector< double > _speedPatternRotational
Definition: CEP.h:114
double _resistanceF2
Definition: CEP.h:100
double _resistanceF3
Definition: CEP.h:101
std::vector< double > _gearTransmissionCurve
Definition: CEP.h:122
double _pNormV1
Definition: CEP.h:107
std::vector< double > _powerPatternPollutants
Definition: CEP.h:118
std::vector< double > _cepCurveFC
Definition: CEP.h:120
double _cWValue
Definition: CEP.h:97
std::vector< double > _normedCepCurveFC
Definition: CEP.h:121
double _crossSectionalArea
Definition: CEP.h:96
double _auxPower
Definition: CEP.h:104
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
Definition: CEP.cpp:370
std::map< std::string, std::vector< double > > _cepCurvePollutants
Definition: CEP.h:124
void setRatedPower(const double &value)
Definition: CEP.cpp:184
double GetRotationalCoeffecient(double speed)
Definition: CEP.cpp:361
std::string _fuelType
Definition: CEP.h:59
double CalcEngPower(double power)
Definition: CEP.cpp:219
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
Definition: CEP.cpp:230
std::vector< double > _normailzedPowerPatternPollutants
Definition: CEP.h:117
double _resistanceF4
Definition: CEP.h:102
double _resistanceF0
Definition: CEP.h:98
double CalcPower(double speed, double acc, double gradient)
Definition: CEP.cpp:200
void InitializeInstanceFields()
Definition: CEP.cpp:440
const std::string & getFuelType() const
Definition: CEP.cpp:172
const bool & getHeavyVehicle() const
Definition: CEP.cpp:168
double _idlingValueFC
Definition: CEP.h:126
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
Definition: CEP.cpp:291
double _pNormV0
Definition: CEP.h:105
double Interpolate(double px, double p1, double p2, double e1, double e2)
Definition: CEP.cpp:412
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
Definition: CEP.h:125
std::vector< double > _dragNormTable
Definition: CEP.h:130
double _engineIdlingSpeed
Definition: CEP.h:111
double _engineRatedSpeed
Definition: CEP.h:110
double _massVehicle
Definition: CEP.h:93
std::vector< double > _nNormTable
Definition: CEP.h:129
const double & getRatedPower() const
Definition: CEP.cpp:180
double GetDecelCoast(double speed, double acc, double gradient)
Definition: CEP.cpp:326
double _resistanceF1
Definition: CEP.h:99
double _vehicleMassRot
Definition: CEP.h:95