Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
V5/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-2023 German Aerospace Center (DLR) and others.
4// PHEMlight module
5// Copyright (C) 2016-2023 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
25#define _USE_MATH_DEFINES
26#include <string>
27#include <map>
28#include <vector>
29#include <cmath>
30#include <utility>
31#include "CEPHandler.h"
32
33//C# TO C++ CONVERTER NOTE: Forward class declarations:
34namespace PHEMlightdllV5 { class VEHPHEMLightJSON; }
35namespace PHEMlightdllV5 { class VEH; }
36namespace PHEMlightdllV5 { class Helpers; }
37
38#define FLEET
39
40namespace PHEMlightdllV5 {
41 class CEP {
42 public:
47
48 private:
50 std::string privateFuelType;
51 std::string privateCalcType;
56
57 public:
58 CEP(VEHPHEMLightJSON::VEH* Vehicle, std::vector<std::string>& headerLineFCvalues, std::vector<std::vector<double> >& matrixFCvalues, std::vector<std::string>& headerLinePollutants, std::vector<std::vector<double> >& matrixPollutants, std::vector<double>& idlingFCvalues, std::vector<double>& idlingPollutants);
59
60
61 const bool& getHeavyVehicle() const;
62 const std::string& getFuelType() const;
63 void setFuelType(const std::string& value);
64 const std::string& getCalcType() const;
65 void setCalcType(const std::string& value);
66
67 public:
69 void setNormalizingType(const eNormalizingType& value);
70
71 const double& getRatedPower() const;
72 void setRatedPower(const double& value);
73 const double& getNormalizingPower() const;
74 void setNormalizingPower(const double& value);
75 const double& getDrivingPower() const;
76 void setDrivingPower(const double& value);
77 double getAuxPower() const {
78 return _auxPower * getRatedPower();
79 }
80
81 protected:
86 double _cWValue;
92 double _axleRatio;
93 double _auxPower;
94 double _pNormV0;
95 double _pNormP0;
96 double _pNormV1;
97 double _pNormP1;
98
102
103 std::vector<double> _speedPatternRotational;
104 std::vector<double> _powerPatternFCvalues;
107 std::vector<double> _powerPatternPollutants;
108
109 std::map<std::string, std::vector<double> > _cepCurveFCvalues;
110 std::map<std::string, std::vector<double> > _normedCepCurveFCvalues;
111 std::vector<double> _gearTransmissionCurve;
112 std::vector<double> _speedCurveRotational;
113 std::map<std::string, std::vector<double> > _cepCurvePollutants;
114 std::map<std::string, std::vector<double> > _cepNormalizedCurvePollutants;
115 std::map<std::string, double> _FleetMix;
116 std::map<std::string, double> _idlingValueFCvalues;
117 std::map<std::string, double> _idlingValuesPollutants;
118
119 std::vector<double> _nNormTable;
120 std::vector<double> _dragNormTable;
121
122 public:
123 double CalcPower(double speed, double acc, double gradient, bool HBEV);
124
125 double CalcWheelPower(double speed, double acc, double gradient);
126
127 double CalcEngPower(double power);
128
129 double GetEmission(const std::string& pollutant, double power, double speed, Helpers* VehicleClass);
130
131 double GetCO2Emission(double _FC, double _CO, double _HC, Helpers* VehicleClass);
132
133 //Calculate the weighted fuel factor values for Fleetmix
134 private:
135 bool CalcfCValMix(double& _fCBr, double& _fCHC, double& _fCCO, double& _fCCO2, Helpers* VehicleClass);
136
137 // Get the fuel factor values
138 bool GetfcVals(const std::string& _fuelTypex, double& _fCBr, double& _fCHC, double& _fCCO, double& _fCCO2, Helpers* VehicleClass);
139
140 public:
141 double GetDecelCoast(double speed, double acc, double gradient);
142
143 double GetRotationalCoeffecient(double speed);
144
145
146 private:
147 void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, std::vector<double>& pattern, double value);
148
149 double Interpolate(double px, double p1, double p2, double e1, double e2);
150
151 public:
152 double GetMaxAccel(double speed, double gradient, bool HBEV);
153
154 private:
155 double GetPMaxNorm(double speed);
156
157 //--------------------------------------------------------------------------------------------------
158 // Operators for fleetmix
159 //--------------------------------------------------------------------------------------------------
160
161
162 private:
164 };
165}
166
bool GetfcVals(const std::string &_fuelTypex, double &_fCBr, double &_fCHC, double &_fCCO, double &_fCCO2, Helpers *VehicleClass)
std::map< std::string, std::vector< double > > _normedCepCurveFCvalues
Definition V5/cpp/CEP.h:110
double GetRotationalCoeffecient(double speed)
const double & getRatedPower() const
void setNormalizingPower(const double &value)
eNormalizingType privateNormalizingType
Definition V5/cpp/CEP.h:52
double CalcPower(double speed, double acc, double gradient, bool HBEV)
double GetDecelCoast(double speed, double acc, double gradient)
std::vector< double > _normalizedPowerPatternFCvalues
Definition V5/cpp/CEP.h:105
const eNormalizingType & getNormalizingType() const
std::vector< double > _dragNormTable
Definition V5/cpp/CEP.h:120
std::vector< double > _speedCurveRotational
Definition V5/cpp/CEP.h:112
void setCalcType(const std::string &value)
std::vector< double > _normailzedPowerPatternPollutants
Definition V5/cpp/CEP.h:106
void InitializeInstanceFields()
double Interpolate(double px, double p1, double p2, double e1, double e2)
std::vector< double > _powerPatternPollutants
Definition V5/cpp/CEP.h:107
double CalcWheelPower(double speed, double acc, double gradient)
const bool & getHeavyVehicle() const
std::vector< double > _powerPatternFCvalues
Definition V5/cpp/CEP.h:104
void setRatedPower(const double &value)
const std::string & getCalcType() const
std::map< std::string, double > _idlingValuesPollutants
Definition V5/cpp/CEP.h:117
double GetPMaxNorm(double speed)
std::vector< double > _speedPatternRotational
Definition V5/cpp/CEP.h:103
double GetMaxAccel(double speed, double gradient, bool HBEV)
std::vector< double > _gearTransmissionCurve
Definition V5/cpp/CEP.h:111
const std::string & getFuelType() const
double getAuxPower() const
Definition V5/cpp/CEP.h:77
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
double privateDrivingPower
Definition V5/cpp/CEP.h:55
void setNormalizingType(const eNormalizingType &value)
double CalcEngPower(double power)
double privateNormalizingPower
Definition V5/cpp/CEP.h:54
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
std::vector< double > _nNormTable
Definition V5/cpp/CEP.h:119
void setFuelType(const std::string &value)
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
Definition V5/cpp/CEP.h:114
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
std::map< std::string, std::vector< double > > _cepCurveFCvalues
Definition V5/cpp/CEP.h:109
const double & getDrivingPower() const
double _crossSectionalArea
Definition V5/cpp/CEP.h:85
double _effectiveWheelDiameter
Definition V5/cpp/CEP.h:101
void setDrivingPower(const double &value)
std::map< std::string, std::vector< double > > _cepCurvePollutants
Definition V5/cpp/CEP.h:113
bool CalcfCValMix(double &_fCBr, double &_fCHC, double &_fCCO, double &_fCCO2, Helpers *VehicleClass)
std::string privateCalcType
Definition V5/cpp/CEP.h:51
std::map< std::string, double > _idlingValueFCvalues
Definition V5/cpp/CEP.h:116
const double & getNormalizingPower() const
std::map< std::string, double > _FleetMix
Definition V5/cpp/CEP.h:115
std::string privateFuelType
Definition V5/cpp/CEP.h:50
C++ TraCI client API implementation.