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