Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
PHEMCEP.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2013-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// Helper class for PHEM Light, holds a specific CEP for a PHEM emission class
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <vector>
29#include "PHEMConstants.h"
30
31
32
33// ===========================================================================
34// enumerations
35// ===========================================================================
40
41
42// ===========================================================================
43// class definitions
44// ===========================================================================
49class PHEMCEP {
50public:
51 /*** @brief Constructor
52 * @param[in] emissionClass PHEM emission class of vehicle
53 * @param[in] vehicleMass vehicle mass
54 * @param[in] vehicleLoading vehicle loading
55 * @param[in] vehicleMassRot rotational mass of vehicle
56 * @param[in] crossArea crosssectional area of vehicle
57 * @param[in] cWValue cw-value
58 * @param[in] f0 Rolling resistance f0
59 * @param[in] f1 Rolling resistance f1
60 * @param[in] f2 Rolling resistance f2
61 * @param[in] f3 Rolling resistance f3
62 * @param[in] f4 Rolling resistance f4
63 * @param[in] ratedPower rated power of vehicle
64 * @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed
65 * @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed
66 * @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed
67 * @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed
68 * @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel
69 * @param[in] matrixFC Coefficients of the fuel consumption
70 * @param[in] headerLine Definition of covered pollutants
71 * @param[in] headerLinePollutants Coefficients of the pollutants
72 * @param[in] matrixPollutants Coefficients of the pollutants
73 * @param[in] matrixSpeedRotational Table for rotational coefficients over speed
74 */
75 PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier,
76 double vehicleMass, double vehicleLoading, double vehicleMassRot,
77 double crossArea, double cdValue,
78 double f0, double f1, double f2, double f3, double f4,
79 double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1,
80 double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter,
81 double idlingFC,
82 const std::string& vehicleFuelType,
83 const std::vector< std::vector<double> >& matrixFC,
84 const std::vector<std::string>& headerLinePollutants,
85 const std::vector< std::vector<double> >& matrixPollutants,
86 const std::vector< std::vector<double> >& matrixSpeedRotational,
87 const std::vector< std::vector<double> >& normedDragTable,
88 const std::vector<double>& idlingValuesPollutants);
89
91 ~PHEMCEP();
92
101 double CalcPower(double v, double a, double slope, double vehicleLoading = 0) const;
102
103
112 double GetMaxAccel(double v, double a, double gradient, double vehicleLoading = 0) const;
113
119 double GetEmission(const std::string& pollutantIdentifier, double power, double speed, bool normalized = false) const;
120 double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const;
121
122
129
130
134 double GetResistanceF0() const {
135 return _resistanceF0;
136 }
137
138
142 double GetResistanceF1() const {
143 return _resistanceF1;
144 }
145
146
150 double GetResistanceF2() const {
151 return _resistanceF2;
152 }
153
154
158 double GetResistanceF3() const {
159 return _resistanceF3;
160 }
161
162
166 double GetResistanceF4() const {
167 return _resistanceF4;
168 }
169
170
175 double GetCdValue() const {
176 return _cdValue;
177 }
178
182 double GetCrossSectionalArea() const {
183 return _crossSectionalArea;
184 }
185
186
190 double GetMassVehicle() const {
191 return _massVehicle;
192 }
193
197 double GetVehicleLoading() const {
198 return _vehicleLoading;
199 }
200
201
205 double GetMassRot() const {
206 return _massRot;
207 }
208
209
213 double GetRatedPower() const {
214 return _ratedPower;
215 }
216
220 const std::string& GetVehicleFuelType() const {
221 return _vehicleFuelType;
222 }
223
224private:
233 double Interpolate(double px, double p1, double p2, double e1, double e2) const;
234
241 void FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, const std::vector<double>& pattern, double value) const;
242
246 double GetRotationalCoeffecient(double speed) const;
247 double GetGearCoeffecient(double speed) const;
248 double GetDragCoeffecient(double nNorm) const;
249
253 double GetPMaxNorm(double speed) const;
254
255private:
270 double _cdValue;
278 double _massRot;
282 double _pNormV0;
284 double _pNormP0;
286 double _pNormV1;
288 double _pNormP1;
293 double _idlingFC;
294 std::string _vehicleFuelType;
301 std::vector<double> _speedPatternRotational;
303 std::vector<double> _powerPatternFC;
305 std::vector<double> _powerPatternPollutants;
306 std::vector<double> _normalizedPowerPatternFC;
309 std::vector<double> _cepCurveFC;
311 std::vector<double> _normedCepCurveFC;
312 std::vector<double> _speedCurveRotational;
313 std::vector<double> _gearTransmissionCurve;
314 std::vector<double> _nNormTable;
315 std::vector<double> _dragNormTable;
319
320};
NormalizingType
Definition PHEMCEP.h:36
@ RatedPower
Definition PHEMCEP.h:37
@ DrivingPower
Definition PHEMCEP.h:38
int SUMOEmissionClass
Data Handler for a single CEP emission data set.
Definition PHEMCEP.h:49
double GetResistanceF0() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:134
double _resistanceF3
Rolling resistance f3.
Definition PHEMCEP.h:266
double _pNormV0
Step functions parameter for maximum rated power.
Definition PHEMCEP.h:282
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, const std::vector< double > &pattern, double value) const
Finds bounding upper and lower index in pattern for value.
Definition PHEMCEP.cpp:357
double _effictiveWheelDiameter
Definition PHEMCEP.h:292
double _idlingFC
Definition PHEMCEP.h:293
std::vector< double > _speedCurveRotational
Definition PHEMCEP.h:312
StringBijection< std::vector< double > > _cepCurvePollutants
Definition PHEMCEP.h:316
double GetResistanceF1() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:142
double _vehicleLoading
vehicle loading
Definition PHEMCEP.h:276
int _sizeOfPatternFC
Definition PHEMCEP.h:295
std::string _vehicleFuelType
Definition PHEMCEP.h:294
double GetResistanceF4() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:166
double CalcPower(double v, double a, double slope, double vehicleLoading=0) const
Returns the power of used for a vehicle at state v,a, slope and loading.
Definition PHEMCEP.cpp:399
double GetDragCoeffecient(double nNorm) const
Definition PHEMCEP.cpp:344
double GetResistanceF2() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:150
double _pNormV1
Step functions parameter for maximum rated power.
Definition PHEMCEP.h:286
double _pNormP1
Step functions parameter for maximum rated power.
Definition PHEMCEP.h:288
double GetVehicleLoading() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:197
double _resistanceF2
Rolling resistance f2.
Definition PHEMCEP.h:264
std::vector< double > _nNormTable
Definition PHEMCEP.h:314
double _engineIdlingSpeed
Definition PHEMCEP.h:290
SUMOEmissionClass GetEmissionClass() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:126
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:220
double GetMassVehicle() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:190
double GetCrossSectionalArea() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:182
double _resistanceF4
Rolling resistance f4.
Definition PHEMCEP.h:268
double _resistanceF1
Rolling resistance f1.
Definition PHEMCEP.h:262
double GetEmission(const std::string &pollutantIdentifier, double power, double speed, bool normalized=false) const
Returns a emission measure for power[kW] level.
Definition PHEMCEP.cpp:196
double _resistanceF0
Rolling resistance f0.
Definition PHEMCEP.h:260
std::vector< double > _normedCepCurveFC
Definition PHEMCEP.h:311
std::vector< double > _cepCurveFC
Definition PHEMCEP.h:309
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
Definition PHEMCEP.cpp:278
std::vector< double > _powerPatternPollutants
Definition PHEMCEP.h:305
std::vector< double > _normailzedPowerPatternPollutants
Definition PHEMCEP.h:307
double _massVehicle
vehicle mass
Definition PHEMCEP.h:274
double _axleRatio
Definition PHEMCEP.h:289
~PHEMCEP()
Destructor.
Definition PHEMCEP.cpp:185
double _pNormP0
Step functions parameter for maximum rated power.
Definition PHEMCEP.h:284
double _drivingPower
Definition PHEMCEP.h:299
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
Definition PHEMCEP.h:257
double GetMaxAccel(double v, double a, double gradient, double vehicleLoading=0) const
Returns the maximum accelaration for a vehicle at state v,a, slope and loading.
Definition PHEMCEP.cpp:410
std::vector< double > _dragNormTable
Definition PHEMCEP.h:315
double GetMassRot() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:205
NormalizingType _normalizingType
Definition PHEMCEP.h:258
std::vector< double > _speedPatternRotational
Definition PHEMCEP.h:301
double Interpolate(double px, double p1, double p2, double e1, double e2) const
Interpolates emission linearly between two known power-emission pairs.
Definition PHEMCEP.cpp:270
std::vector< double > _powerPatternFC
Definition PHEMCEP.h:303
StringBijection< double > _idlingValuesPollutants
Definition PHEMCEP.h:318
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
Definition PHEMCEP.cpp:318
int _sizeOfPatternPollutants
Definition PHEMCEP.h:297
double GetGearCoeffecient(double speed) const
Definition PHEMCEP.cpp:331
double GetRatedPower() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:213
double _ratedPower
rated power of vehicle
Definition PHEMCEP.h:280
double _massRot
rotational mass of vehicle
Definition PHEMCEP.h:278
double GetResistanceF3() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:158
std::vector< double > _gearTransmissionCurve
Definition PHEMCEP.h:313
double _normalizingPower
Definition PHEMCEP.h:298
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
Definition PHEMCEP.h:317
double GetCdValue() const
Getter function to recieve vehicle data from CEP.
Definition PHEMCEP.h:175
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
Definition PHEMCEP.cpp:419
std::vector< double > _normalizedPowerPatternFC
Definition PHEMCEP.h:306
double _crossSectionalArea
crosssectional area of vehicle
Definition PHEMCEP.h:272
double _cdValue
Cw value.
Definition PHEMCEP.h:270
bool _heavyVehicle
Definition PHEMCEP.h:300
double _engineRatedSpeed
Definition PHEMCEP.h:291