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-2019 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
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 // SPDX-License-Identifier: EPL-2.0
11 /****************************************************************************/
18 //
19 /****************************************************************************/
20 
21 
22 #ifndef PHEMlightCEP
23 #define PHEMlightCEP
24 
25 #define _USE_MATH_DEFINES
26 #include <string>
27 #include <map>
28 #include <vector>
29 #include <cmath>
30 #include <utility>
31 
32 //C# TO C++ CONVERTER NOTE: Forward class declarations:
33 namespace PHEMlightdll { class Helpers; }
34 
35 
36 namespace PHEMlightdll {
37  class CEP {
38  //--------------------------------------------------------------------------------------------------
39  // Constructors
40  //--------------------------------------------------------------------------------------------------
41 
42  public:
43  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);
44 
45 
46  //--------------------------------------------------------------------------------------------------
47  // Members
48  //--------------------------------------------------------------------------------------------------
49 
50  private:
52  public:
53  const bool& getHeavyVehicle() const;
54 
55  private:
56  std::string _fuelType;
57  public:
58  const std::string& getFuelType() const;
59 
60  public:
64  };
65  private:
67  public:
68  const NormalizingType& getNormalizingTypeX() const;
69 
70  private:
71  double _ratedPower;
72  public:
73  const double& getRatedPower() const;
74  void setRatedPower(const double& value);
75 
76  private:
78  public:
79  const double& getNormalizingPower() const;
80 
81  private:
82  double _drivingPower;
83  public:
84  const double& getDrivingPower() const;
85  void setDrivingPower(const double& value);
86 
87 
88 
89  protected:
90  double _massVehicle;
94  double _cWValue;
95  double _resistanceF0;
96  double _resistanceF1;
97  double _resistanceF2;
98  double _resistanceF3;
99  double _resistanceF4;
100  double _axleRatio;
101  double _auxPower;
102  double _pNormV0;
103  double _pNormP0;
104  double _pNormV1;
105  double _pNormP1;
106 
110 
111  std::vector<double> _speedPatternRotational;
112  std::vector<double> _powerPatternFC;
113  std::vector<double> _normalizedPowerPatternFC;
115  std::vector<double> _powerPatternPollutants;
116 
117  std::vector<double> _cepCurveFC;
118  std::vector<double> _normedCepCurveFC;
119  std::vector<double> _gearTransmissionCurve;
120  std::vector<double> _speedCurveRotational;
121  std::map<std::string, std::vector<double> > _cepCurvePollutants;
122  std::map<std::string, std::vector<double> > _cepNormalizedCurvePollutants;
124  std::map<std::string, double> _idlingValuesPollutants;
125 
126  std::vector<double> _nNormTable;
127  std::vector<double> _dragNormTable;
128 
129 
130  //--------------------------------------------------------------------------------------------------
131  // Methods
132  //--------------------------------------------------------------------------------------------------
133 
134  public:
135  double CalcPower(double speed, double acc, double gradient);
136 
137  double CalcEngPower(double power);
138 
139  double GetEmission(const std::string& pollutant, double power, double speed, Helpers* VehicleClass);
140 
141 
142  double GetCO2Emission(double _FC, double _CO, double _HC, Helpers* VehicleClass);
143 
144  double GetDecelCoast(double speed, double acc, double gradient);
145 
146  double GetRotationalCoeffecient(double speed);
147 
148 
149  private:
150  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, std::vector<double>& pattern, double value);
151 
152  double Interpolate(double px, double p1, double p2, double e1, double e2);
153 
154  public:
155  double GetMaxAccel(double speed, double gradient);
156 
157  private:
158  double GetPMaxNorm(double speed);
159 
160  //--------------------------------------------------------------------------------------------------
161  // Operators for fleetmix
162  //--------------------------------------------------------------------------------------------------
163 
164 
165  private:
167  };
168 }
169 
170 
171 #endif //#ifndef PHEMlightCEP
std::vector< double > _speedPatternRotational
Definition: CEP.h:111
double _resistanceF0
Definition: CEP.h:95
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
Definition: CEP.cpp:227
std::vector< double > _normailzedPowerPatternPollutants
Definition: CEP.h:114
std::vector< double > _dragNormTable
Definition: CEP.h:127
double _massVehicle
Definition: CEP.h:90
std::map< std::string, std::vector< double > > _cepCurvePollutants
Definition: CEP.h:121
void setDrivingPower(const double &value)
Definition: CEP.cpp:193
double _effectiveWheelDiameter
Definition: CEP.h:109
std::vector< double > _nNormTable
Definition: CEP.h:126
const double & getNormalizingPower() const
Definition: CEP.cpp:185
double _pNormP0
Definition: CEP.h:103
double _engineRatedSpeed
Definition: CEP.h:107
void InitializeInstanceFields()
Definition: CEP.cpp:437
void setRatedPower(const double &value)
Definition: CEP.cpp:181
double _pNormV1
Definition: CEP.h:104
double _drivingPower
Definition: CEP.h:82
double _resistanceF1
Definition: CEP.h:96
double GetRotationalCoeffecient(double speed)
Definition: CEP.cpp:358
const double & getDrivingPower() const
Definition: CEP.cpp:189
double _auxPower
Definition: CEP.h:101
double _engineIdlingSpeed
Definition: CEP.h:108
std::map< std::string, double > _idlingValuesPollutants
Definition: CEP.h:124
double _resistanceF2
Definition: CEP.h:97
std::vector< double > _normedCepCurveFC
Definition: CEP.h:118
NormalizingType _normalizingType
Definition: CEP.h:66
const double & getRatedPower() const
Definition: CEP.cpp:177
double _pNormP1
Definition: CEP.h:105
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
Definition: CEP.h:122
double _normalizingPower
Definition: CEP.h:77
std::vector< double > _normalizedPowerPatternFC
Definition: CEP.h:113
double _cWValue
Definition: CEP.h:94
double GetDecelCoast(double speed, double acc, double gradient)
Definition: CEP.cpp:323
double CalcEngPower(double power)
Definition: CEP.cpp:216
bool _heavyVehicle
Definition: CEP.h:51
double _resistanceF4
Definition: CEP.h:99
std::vector< double > _speedCurveRotational
Definition: CEP.h:120
std::vector< double > _gearTransmissionCurve
Definition: CEP.h:119
double GetMaxAccel(double speed, double gradient)
Definition: CEP.cpp:417
double _pNormV0
Definition: CEP.h:102
double _resistanceF3
Definition: CEP.h:98
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:29
std::vector< double > _powerPatternFC
Definition: CEP.h:112
std::vector< double > _cepCurveFC
Definition: CEP.h:117
double GetPMaxNorm(double speed)
Definition: CEP.cpp:424
const NormalizingType & getNormalizingTypeX() const
Definition: CEP.cpp:173
double Interpolate(double px, double p1, double p2, double e1, double e2)
Definition: CEP.cpp:409
const bool & getHeavyVehicle() const
Definition: CEP.cpp:165
double _axleRatio
Definition: CEP.h:100
double _crossSectionalArea
Definition: CEP.h:93
std::vector< double > _powerPatternPollutants
Definition: CEP.h:115
double _idlingValueFC
Definition: CEP.h:123
double CalcPower(double speed, double acc, double gradient)
Definition: CEP.cpp:197
double _vehicleLoading
Definition: CEP.h:91
double _ratedPower
Definition: CEP.h:71
const std::string & getFuelType() const
Definition: CEP.cpp:169
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
Definition: CEP.cpp:367
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
Definition: CEP.cpp:288
std::string _fuelType
Definition: CEP.h:56
double _vehicleMassRot
Definition: CEP.h:92