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-2025 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
126 SUMOEmissionClass GetEmissionClass() const {
127 return _emissionClass;
128 }
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:
257 SUMOEmissionClass _emissionClass;
258 NormalizingType _normalizingType;
260 double _resistanceF0;
262 double _resistanceF1;
264 double _resistanceF2;
266 double _resistanceF3;
268 double _resistanceF4;
270 double _cdValue;
272 double _crossSectionalArea;
274 double _massVehicle;
276 double _vehicleLoading;
278 double _massRot;
280 double _ratedPower;
282 double _pNormV0;
284 double _pNormP0;
286 double _pNormV1;
288 double _pNormP1;
289 double _axleRatio;
290 double _engineIdlingSpeed;
291 double _engineRatedSpeed;
292 double _effictiveWheelDiameter;
293 double _idlingFC;
294 std::string _vehicleFuelType;
295 int _sizeOfPatternFC;
297 int _sizeOfPatternPollutants;
298 double _normalizingPower;
299 double _drivingPower;
300 bool _heavyVehicle;
301 std::vector<double> _speedPatternRotational;
303 std::vector<double> _powerPatternFC;
305 std::vector<double> _powerPatternPollutants;
306 std::vector<double> _normalizedPowerPatternFC;
307 std::vector<double> _normailzedPowerPatternPollutants;
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;
316 StringBijection< std::vector<double> > _cepCurvePollutants;
317 StringBijection<std::vector<double> > _normalizedCepCurvePollutants;
318 StringBijection<double> _idlingValuesPollutants;
319
320};
NormalizingType
Definition PHEMCEP.h:36
@ RatedPower
Definition PHEMCEP.h:37
@ DrivingPower
Definition PHEMCEP.h:38
const std::string invalid_return< std::string >::value
int SUMOEmissionClass
Data Handler for a single CEP emission data set.