Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/foreign/PHEMlight/cpp/CEP.h
169685 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2016-2025 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
/****************************************************************************/
16
/// @file CEP.h
17
/// @author Martin Dippold
18
/// @author Michael Behrisch
19
/// @date July 2016
20
///
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:
52
bool _heavyVehicle;
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:
62
enum NormalizingType {
63
NormalizingType_RatedPower,
64
NormalizingType_DrivingPower
65
};
66
private:
67
NormalizingType _normalizingType;
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:
78
double _normalizingPower;
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;
92
double _vehicleLoading;
93
double _vehicleMassRot;
94
double _crossSectionalArea;
95
double _cWValue;
96
double _resistanceF0;
97
double _resistanceF1;
98
double _resistanceF2;
99
double _resistanceF3;
100
double _resistanceF4;
101
double _axleRatio;
102
double _auxPower;
103
double _pNormV0;
104
double _pNormP0;
105
double _pNormV1;
106
double _pNormP1;
107
108
double _engineRatedSpeed;
109
double _engineIdlingSpeed;
110
double _effectiveWheelDiameter;
111
112
std::vector<double> _speedPatternRotational;
113
std::vector<double> _powerPatternFC;
114
std::vector<double> _normalizedPowerPatternFC;
115
std::vector<double> _normailzedPowerPatternPollutants;
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;
124
double _idlingValueFC;
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:
167
void InitializeInstanceFields();
168
};
169
}
170
171