Eclipse SUMO - Simulation of Urban MObility
cpp/CEP.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2016-2024 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 #pragma once
24 #include <config.h>
25 
26 #define _USE_MATH_DEFINES
27 #include <string>
28 #include <map>
29 #include <vector>
30 #include <cmath>
31 #include <utility>
32 
33 //C# TO C++ CONVERTER NOTE: Forward class declarations:
34 namespace PHEMlightdll { class Helpers; }
35 
36 
37 namespace PHEMlightdll {
38  class CEP {
39  //--------------------------------------------------------------------------------------------------
40  // Constructors
41  //--------------------------------------------------------------------------------------------------
42 
43  public:
44  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);
45 
46 
47  //--------------------------------------------------------------------------------------------------
48  // Members
49  //--------------------------------------------------------------------------------------------------
50 
51  private:
53  public:
54  const bool& getHeavyVehicle() const;
55 
56  private:
57  std::string _fuelType;
58  public:
59  const std::string& getFuelType() const;
60 
61  public:
65  };
66  private:
68  public:
69  const NormalizingType& getNormalizingTypeX() const;
70 
71  private:
72  double _ratedPower;
73  public:
74  const double& getRatedPower() const;
75  void setRatedPower(const double& value);
76 
77  private:
79  public:
80  const double& getNormalizingPower() const;
81 
82  private:
83  double _drivingPower;
84  public:
85  const double& getDrivingPower() const;
86  void setDrivingPower(const double& value);
87 
88 
89 
90  protected:
91  double _massVehicle;
95  double _cWValue;
96  double _resistanceF0;
97  double _resistanceF1;
98  double _resistanceF2;
99  double _resistanceF3;
101  double _axleRatio;
102  double _auxPower;
103  double _pNormV0;
104  double _pNormP0;
105  double _pNormV1;
106  double _pNormP1;
107 
111 
112  std::vector<double> _speedPatternRotational;
113  std::vector<double> _powerPatternFC;
114  std::vector<double> _normalizedPowerPatternFC;
116  std::vector<double> _powerPatternPollutants;
117 
118  std::vector<double> _cepCurveFC;
119  std::vector<double> _normedCepCurveFC;
120  std::vector<double> _gearTransmissionCurve;
121  std::vector<double> _speedCurveRotational;
122  std::map<std::string, std::vector<double> > _cepCurvePollutants;
123  std::map<std::string, std::vector<double> > _cepNormalizedCurvePollutants;
125  std::map<std::string, double> _idlingValuesPollutants;
126 
127  std::vector<double> _nNormTable;
128  std::vector<double> _dragNormTable;
129 
130 
131  //--------------------------------------------------------------------------------------------------
132  // Methods
133  //--------------------------------------------------------------------------------------------------
134 
135  public:
136  double CalcPower(double speed, double acc, double gradient);
137 
138  double CalcEngPower(double power);
139 
140  double GetEmission(const std::string& pollutant, double power, double speed, Helpers* VehicleClass);
141 
142 
143  double GetCO2Emission(double _FC, double _CO, double _HC, Helpers* VehicleClass);
144 
145  double GetDecelCoast(double speed, double acc, double gradient);
146 
147  double GetRotationalCoeffecient(double speed);
148 
149 
150  private:
151  void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, std::vector<double>& pattern, double value);
152 
153  double Interpolate(double px, double p1, double p2, double e1, double e2);
154 
155  public:
156  double GetMaxAccel(double speed, double gradient);
157 
158  private:
159  double GetPMaxNorm(double speed);
160 
161  //--------------------------------------------------------------------------------------------------
162  // Operators for fleetmix
163  //--------------------------------------------------------------------------------------------------
164 
165 
166  private:
168  };
169 }
std::vector< double > _powerPatternPollutants
Definition: cpp/CEP.h:116
std::vector< double > _dragNormTable
Definition: cpp/CEP.h:128
const double & getDrivingPower() const
Definition: cpp/CEP.cpp:192
std::vector< double > _powerPatternFC
Definition: cpp/CEP.h:113
double _pNormP1
Definition: cpp/CEP.h:106
double GetPMaxNorm(double speed)
Definition: cpp/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: cpp/CEP.cpp:32
std::vector< double > _nNormTable
Definition: cpp/CEP.h:127
const NormalizingType & getNormalizingTypeX() const
Definition: cpp/CEP.cpp:176
double _pNormP0
Definition: cpp/CEP.h:104
double _effectiveWheelDiameter
Definition: cpp/CEP.h:110
void setDrivingPower(const double &value)
Definition: cpp/CEP.cpp:196
double _drivingPower
Definition: cpp/CEP.h:83
double _axleRatio
Definition: cpp/CEP.h:101
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
Definition: cpp/CEP.h:123
std::map< std::string, double > _idlingValuesPollutants
Definition: cpp/CEP.h:125
double GetMaxAccel(double speed, double gradient)
Definition: cpp/CEP.cpp:420
double _vehicleLoading
Definition: cpp/CEP.h:92
bool _heavyVehicle
Definition: cpp/CEP.h:52
const double & getNormalizingPower() const
Definition: cpp/CEP.cpp:188
std::vector< double > _speedPatternRotational
Definition: cpp/CEP.h:112
double _ratedPower
Definition: cpp/CEP.h:72
std::vector< double > _normalizedPowerPatternFC
Definition: cpp/CEP.h:114
double _normalizingPower
Definition: cpp/CEP.h:78
NormalizingType _normalizingType
Definition: cpp/CEP.h:67
double _resistanceF2
Definition: cpp/CEP.h:98
double _resistanceF3
Definition: cpp/CEP.h:99
double _pNormV1
Definition: cpp/CEP.h:105
std::vector< double > _cepCurveFC
Definition: cpp/CEP.h:118
double _cWValue
Definition: cpp/CEP.h:95
std::vector< double > _normedCepCurveFC
Definition: cpp/CEP.h:119
std::vector< double > _normailzedPowerPatternPollutants
Definition: cpp/CEP.h:115
double _crossSectionalArea
Definition: cpp/CEP.h:94
double _auxPower
Definition: cpp/CEP.h:102
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
Definition: cpp/CEP.cpp:370
std::vector< double > _gearTransmissionCurve
Definition: cpp/CEP.h:120
void setRatedPower(const double &value)
Definition: cpp/CEP.cpp:184
double GetRotationalCoeffecient(double speed)
Definition: cpp/CEP.cpp:361
std::string _fuelType
Definition: cpp/CEP.h:57
double CalcEngPower(double power)
Definition: cpp/CEP.cpp:219
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
Definition: cpp/CEP.cpp:230
std::vector< double > _speedCurveRotational
Definition: cpp/CEP.h:121
double _resistanceF4
Definition: cpp/CEP.h:100
double _resistanceF0
Definition: cpp/CEP.h:96
double CalcPower(double speed, double acc, double gradient)
Definition: cpp/CEP.cpp:200
void InitializeInstanceFields()
Definition: cpp/CEP.cpp:440
const std::string & getFuelType() const
Definition: cpp/CEP.cpp:172
const bool & getHeavyVehicle() const
Definition: cpp/CEP.cpp:168
double _idlingValueFC
Definition: cpp/CEP.h:124
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
Definition: cpp/CEP.cpp:291
double _pNormV0
Definition: cpp/CEP.h:103
double Interpolate(double px, double p1, double p2, double e1, double e2)
Definition: cpp/CEP.cpp:412
double _engineIdlingSpeed
Definition: cpp/CEP.h:109
double _engineRatedSpeed
Definition: cpp/CEP.h:108
std::map< std::string, std::vector< double > > _cepCurvePollutants
Definition: cpp/CEP.h:122
double _massVehicle
Definition: cpp/CEP.h:91
const double & getRatedPower() const
Definition: cpp/CEP.cpp:180
double GetDecelCoast(double speed, double acc, double gradient)
Definition: cpp/CEP.cpp:326
double _resistanceF1
Definition: cpp/CEP.h:97
double _vehicleMassRot
Definition: cpp/CEP.h:93