Eclipse SUMO - Simulation of Urban MObility
V5/cpp/CEP.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/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#include <config.h>
24
25#include "CEP.h"
26#include "CEPHandler.h"
27#include "Constants.h"
28#include "Helpers.h"
29
30
31namespace PHEMlightdllV5 {
32
33 CEP::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) {
35 _resistanceF0 = Vehicle->getRollingResData()->getFr0();
36 _resistanceF1 = Vehicle->getRollingResData()->getFr1();
37 _resistanceF2 = Vehicle->getRollingResData()->getFr2();
38 _resistanceF3 = Vehicle->getRollingResData()->getFr3();
39 _resistanceF4 = Vehicle->getRollingResData()->getFr4();
40 _cWValue = Vehicle->getVehicleData()->getCw();
41 _crossSectionalArea = Vehicle->getVehicleData()->getA();
42 _massVehicle = Vehicle->getVehicleData()->getMass();
43 _vehicleLoading = Vehicle->getVehicleData()->getLoading();
44 _vehicleMassRot = Vehicle->getVehicleData()->getRedMassWheel();
45 setCalcType(Vehicle->getVehicleData()->getCalcType());
46//C# TO C++ CONVERTER NOTE: The following 'switch' operated on a string variable and was converted to C++ 'if-else' logic:
47// switch (CalcType)
48//ORIGINAL LINE: case "Conv":
49 if (getCalcType() == "Conv") {
50 setRatedPower(Vehicle->getEngineData()->getICEData()->getPrated());
51 _engineRatedSpeed = Vehicle->getEngineData()->getICEData()->getnrated();
52 _engineIdlingSpeed = Vehicle->getEngineData()->getICEData()->getIdling();
53 }
54//ORIGINAL LINE: case "HEV":
55 else if (getCalcType() == "HEV") {
56 // Power von beiden zusammen Rest bezogen auf ICE
57 setRatedPower(Vehicle->getEngineData()->getICEData()->getPrated() + Vehicle->getEngineData()->getEMData()->getPrated());
58 _engineRatedSpeed = Vehicle->getEngineData()->getICEData()->getnrated();
59 _engineIdlingSpeed = Vehicle->getEngineData()->getICEData()->getIdling();
60 }
61//ORIGINAL LINE: case "BEV":
62 else if (getCalcType() == "BEV") {
63 setRatedPower(Vehicle->getEngineData()->getEMData()->getPrated());
64 _engineRatedSpeed = Vehicle->getEngineData()->getEMData()->getnrated();
66 }
67
68 _effectiveWheelDiameter = Vehicle->getVehicleData()->getWheelDiameter();
69 privateHeavyVehicle = Vehicle->getVehicleData()->getMassType() == Constants::HeavyVehicle;
70 setFuelType(Vehicle->getVehicleData()->getFuelType());
71 _axleRatio = Vehicle->getTransmissionData()->getAxelRatio();
72 _auxPower = Vehicle->getAuxiliariesData()->getPauxnorm();
73
74 _pNormV0 = Vehicle->getFLDData()->getP_n_max_v0() / 3.6;
75 _pNormP0 = Vehicle->getFLDData()->getP_n_max_p0();
76 _pNormV1 = Vehicle->getFLDData()->getP_n_max_v1() / 3.6;
77 _pNormP1 = Vehicle->getFLDData()->getP_n_max_p1();
78
79 // Init pollutant identifiers, unit and measures
80 std::vector<std::string> FCvaluesIdentifier;
81 std::vector<std::vector<double> > FCvaluesMeasures;
82 std::vector<std::vector<double> > normalizedFCvaluesMeasures;
83 for (int i = 0; i < (int)headerLineFCvalues.size(); i++) {
84 FCvaluesIdentifier.push_back(headerLineFCvalues[i]);
85 FCvaluesMeasures.push_back(std::vector<double>());
86 normalizedFCvaluesMeasures.push_back(std::vector<double>());
87 }
88
89 // Init pollutant identifiers, unit and measures
90 std::vector<std::string> pollutantIdentifier;
91 std::vector<std::vector<double> > pollutantMeasures;
92 std::vector<std::vector<double> > normalizedPollutantMeasures;
93 for (int i = 0; i < (int)headerLinePollutants.size(); i++) {
94 pollutantIdentifier.push_back(headerLinePollutants[i]);
95 pollutantMeasures.push_back(std::vector<double>());
96 normalizedPollutantMeasures.push_back(std::vector<double>());
97 }
98
99 // Assigning values for speed rotational table
100 _speedPatternRotational = std::vector<double>();
101 for (int i = 0; i < (int)Vehicle->getTransmissionData()->getTransm()["Speed"].size(); i++) {
102 _speedPatternRotational.push_back(Vehicle->getTransmissionData()->getTransm()["Speed"][i] / 3.6);
103 }
104
105 _gearTransmissionCurve = Vehicle->getTransmissionData()->getTransm()["GearRatio"];
106 _speedCurveRotational = Vehicle->getTransmissionData()->getTransm()["RotMassF"];
107
108 // Assigning values for drag table
109 _nNormTable = Vehicle->getFLDData()->getDragCurve()["n_norm"];
110 _dragNormTable = Vehicle->getFLDData()->getDragCurve()["pe_drag_norm"];
111
112 // Looping through matrix and assigning values for FC values
113 _powerPatternFCvalues = std::vector<double>();
114 _normalizedPowerPatternFCvalues = std::vector<double>();
115
116 int headerFCCount = (int)headerLineFCvalues.size();
117 for (int i = 0; i < (int)matrixFCvalues.size(); i++) {
118 for (int j = 0; j < (int)matrixFCvalues[i].size(); j++) {
119 if ((int)matrixFCvalues[i].size() != headerFCCount + 1) {
120 return;
121 }
122
123 if (j == 0) {
124 _normalizedPowerPatternFCvalues.push_back(matrixFCvalues[i][j]);
125 _powerPatternFCvalues.push_back(matrixFCvalues[i][j] * getRatedPower());
126 }
127 else {
128 FCvaluesMeasures[j - 1].push_back(matrixFCvalues[i][j] * getRatedPower());
129 normalizedFCvaluesMeasures[j - 1].push_back(matrixFCvalues[i][j]);
130 }
131 }
132 }
133
134 _cepCurveFCvalues = std::map<std::string, std::vector<double> >();
135 _idlingValueFCvalues = std::map<std::string, double>();
136 _normedCepCurveFCvalues = std::map<std::string, std::vector<double> >();
137
138 for (int i = 0; i < (int)headerLineFCvalues.size(); i++) {
139 _cepCurveFCvalues.insert(std::make_pair(FCvaluesIdentifier[i], FCvaluesMeasures[i]));
140 _normedCepCurveFCvalues.insert(std::make_pair(FCvaluesIdentifier[i], normalizedFCvaluesMeasures[i]));
141 _idlingValueFCvalues.insert(std::make_pair(FCvaluesIdentifier[i], idlingFCvalues[i] * getRatedPower()));
142 }
143
144 // looping through matrix and assigning values for pollutants
145 double pollutantMultiplyer = 1;
148 if (getHeavyVehicle()) {
151 pollutantMultiplyer = getRatedPower();
152 }
153 else {
156 }
157
158 _powerPatternPollutants = std::vector<double>();
159 _normailzedPowerPatternPollutants = std::vector<double>();
160 _cepNormalizedCurvePollutants = std::map<std::string, std::vector<double> >();
161
162 int headerCount = (int)headerLinePollutants.size();
163 for (int i = 0; i < (int)matrixPollutants.size(); i++) {
164 for (int j = 0; j < (int)matrixPollutants[i].size(); j++) {
165 if ((int)matrixPollutants[i].size() != headerCount + 1) {
166 return;
167 }
168
169 if (j == 0) {
170 _normailzedPowerPatternPollutants.push_back(matrixPollutants[i][j]);
171 _powerPatternPollutants.push_back(matrixPollutants[i][j] * getNormalizingPower());
172 }
173 else {
174 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
175 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
176 }
177 }
178 }
179
180 _cepCurvePollutants = std::map<std::string, std::vector<double> >();
181 _idlingValuesPollutants = std::map<std::string, double>();
182
183 for (int i = 0; i < (int)headerLinePollutants.size(); i++) {
184 _cepCurvePollutants.insert(std::make_pair(pollutantIdentifier[i], pollutantMeasures[i]));
185 _cepNormalizedCurvePollutants.insert(std::make_pair(pollutantIdentifier[i], normalizedPollutantMeasures[i]));
186 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
187 }
188
189 _FleetMix = std::map<std::string, double>();
190 _FleetMix.insert(std::make_pair(Constants::strGasoline, 0));
191 _FleetMix.insert(std::make_pair(Constants::strDiesel, 0));
192 _FleetMix.insert(std::make_pair(Constants::strCNG, 0));
193 _FleetMix.insert(std::make_pair(Constants::strLPG, 0));
194 }
195
196 const bool& CEP::getHeavyVehicle() const {
197 return privateHeavyVehicle;
198 }
199
200 const std::string& CEP::getFuelType() const {
201 return privateFuelType;
202 }
203
204 void CEP::setFuelType(const std::string& value) {
205 privateFuelType = value;
206 }
207
208 const std::string& CEP::getCalcType() const {
209 return privateCalcType;
210 }
211
212 void CEP::setCalcType(const std::string& value) {
213 privateCalcType = value;
214 }
215
218 }
219
222 }
223
224 const double& CEP::getRatedPower() const {
225 return privateRatedPower;
226 }
227
228 void CEP::setRatedPower(const double& value) {
229 privateRatedPower = value;
230 }
231
232 const double& CEP::getNormalizingPower() const {
234 }
235
236 void CEP::setNormalizingPower(const double& value) {
238 }
239
240 const double& CEP::getDrivingPower() const {
241 return privateDrivingPower;
242 }
243
244 void CEP::setDrivingPower(const double& value) {
245 privateDrivingPower = value;
246 }
247
248 double CEP::CalcPower(double speed, double acc, double gradient, bool HBEV) {
249 //Declaration
250 double power = 0;
251 double rotFactor = GetRotationalCoeffecient(speed);
252 double powerAux = (_auxPower * getRatedPower());
253
254 //Calculate the power
255 power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * (_resistanceF0 + _resistanceF1 * speed + _resistanceF4 * std::pow(speed, 4)) * speed;
256 power += (_crossSectionalArea * _cWValue * Constants::AIR_DENSITY_CONST / 2) * std::pow(speed, 3);
257 power += (_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * acc * speed;
258 power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * gradient * 0.01 * speed;
259 power /= 1000;
261 if (!HBEV) {
262 power += powerAux;
263 }
264
265 //Return result
266 return power;
267 }
268
269 double CEP::CalcWheelPower(double speed, double acc, double gradient) {
270 //Declaration
271 double power = 0;
272 double rotFactor = GetRotationalCoeffecient(speed);
273
274 //Calculate the power
275 power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * (_resistanceF0 + _resistanceF1 * speed + _resistanceF4 * std::pow(speed, 4)) * speed;
276 power += (_crossSectionalArea * _cWValue * Constants::AIR_DENSITY_CONST / 2) * std::pow(speed, 3);
277 power += (_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * acc * speed;
278 power += (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * gradient * 0.01 * speed;
279 power /= 1000;
280
281 //Return result
282 return power;
283 }
284
285 double CEP::CalcEngPower(double power) {
286 if (power < _powerPatternFCvalues.front()) {
287 return _powerPatternFCvalues.front();
288 }
289 if (power > _powerPatternFCvalues.back()) {
290 return _powerPatternFCvalues.back();
291 }
292
293 return power;
294 }
295
296 double CEP::GetEmission(const std::string& pollutant, double power, double speed, Helpers* VehicleClass) {
297 //Declaration
298 std::vector<double> emissionCurve;
299 std::vector<double> powerPattern;
300
301 // bisection search to find correct position in power pattern
302 int upperIndex;
303 int lowerIndex;
304
305 if (std::abs(speed) <= Constants::ZERO_SPEED_ACCURACY) {
306 if (_cepCurvePollutants.find(pollutant) == _cepCurvePollutants.end() && _cepCurveFCvalues.find(pollutant) == _cepCurveFCvalues.end()) {
307 VehicleClass->setErrMsg(std::string("Emission pollutant or fuel value ") + pollutant + std::string(" not found!"));
308 return 0;
309 }
310
311 if (_cepCurveFCvalues.find(pollutant) != _cepCurveFCvalues.end()) {
312 return _idlingValueFCvalues[pollutant];
313 }
314 else if (_cepCurvePollutants.find(pollutant) != _cepCurvePollutants.end()) {
315 return _idlingValuesPollutants[pollutant];
316 }
317 }
318
319 if (_cepCurvePollutants.find(pollutant) == _cepCurvePollutants.end() && _cepCurveFCvalues.find(pollutant) == _cepCurveFCvalues.end()) {
320 VehicleClass->setErrMsg(std::string("Emission pollutant or fuel value ") + pollutant + std::string(" not found!"));
321 return 0;
322 }
323
324 if (_cepCurveFCvalues.find(pollutant) != _cepCurveFCvalues.end()) {
325 emissionCurve = _cepCurveFCvalues[pollutant];
326 powerPattern = _powerPatternFCvalues;
327 }
328 else if (_cepCurvePollutants.find(pollutant) != _cepCurvePollutants.end()) {
329 emissionCurve = _cepCurvePollutants[pollutant];
330 powerPattern = _powerPatternPollutants;
331 }
332
333 if (emissionCurve.empty()) {
334 VehicleClass->setErrMsg(std::string("Empty emission curve for ") + pollutant + std::string(" found!"));
335 return 0;
336 }
337 if (emissionCurve.size() == 1) {
338 return emissionCurve[0];
339 }
340
341 // in case that the demanded power is smaller than the first entry (smallest) in the power pattern the first is returned (should never happen)
342 if (power <= powerPattern.front()) {
343 return emissionCurve[0];
344 }
345
346 // if power bigger than all entries in power pattern return the last (should never happen)
347 if (power >= powerPattern.back()) {
348 return emissionCurve.back();
349 }
350
351 FindLowerUpperInPattern(lowerIndex, upperIndex, powerPattern, power);
352 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
353 }
354
355 double CEP::GetCO2Emission(double _FC, double _CO, double _HC, Helpers* VehicleClass) {
356 //Declaration
357 double fCBr, fCHC, fCCO, fCCO2;
358
359 fCBr = 0;
360 fCHC = 0;
361 fCCO = 0;
362 fCCO2 = 0;
363
364 if (getFuelType() != "Mix") {
365 if (!GetfcVals(getFuelType(), fCBr, fCHC, fCCO, fCCO2, VehicleClass)) {
366 return 0;
367 }
368 }
369 else {
370 if (!CalcfCValMix(fCBr, fCHC, fCCO, fCCO2, VehicleClass)) {
371 return 0;
372 }
373 }
374
375 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
376 }
377
378 bool CEP::CalcfCValMix(double& _fCBr, double& _fCHC, double& _fCCO, double& _fCCO2, Helpers* VehicleClass) {
379 //Declaration
380 double Sum = 0;
381 double sumfCBr, sumfCHC, sumfCCO, sumfCCO2;
382
383 //Initialise
384 sumfCBr = 0;
385 sumfCHC = 0;
386 sumfCCO = 0;
387 sumfCCO2 = 0;
388
389 //calculate the sum
390 for (std::map<std::string, double>::const_iterator id = _FleetMix.begin(); id != _FleetMix.end(); ++id) {
391 Sum += _FleetMix[id->first];
392 }
393
394 //Calculate the weighted fuel factors
395 if (Sum <= 0) {
396 VehicleClass->setErrMsg("All propolsion types in the fleetshares file are not known!");
397 return false;
398 }
399 else {
400 for (std::map<std::string, double>::const_iterator id = _FleetMix.begin(); id != _FleetMix.end(); ++id) {
401 if (!GetfcVals(id->first, _fCBr, _fCHC, _fCCO, _fCCO2, VehicleClass)) {
402 return false;
403 }
404 else {
405 sumfCBr += _fCBr * _FleetMix[id->first] / Sum;
406 sumfCHC += _fCHC * _FleetMix[id->first] / Sum;
407 sumfCCO += _fCCO * _FleetMix[id->first] / Sum;
408 sumfCCO2 += _fCCO2 * _FleetMix[id->first] / Sum;
409 }
410 }
411 }
412 //Result values
413 _fCBr = sumfCBr;
414 _fCHC = sumfCHC;
415 _fCCO = sumfCCO;
416 _fCCO2 = sumfCCO2;
417 return true;
418 }
419
420 bool CEP::GetfcVals(const std::string& _fuelTypex, double& _fCBr, double& _fCHC, double& _fCCO, double& _fCCO2, Helpers* VehicleClass) {
421 _fCHC = 0.866;
422 _fCCO = 0.429;
423 _fCCO2 = 0.273;
424
425//C# TO C++ CONVERTER NOTE: The following 'switch' operated on a string variable and was converted to C++ 'if-else' logic:
426// switch (_fuelTypex)
427//ORIGINAL LINE: case Constants.strGasoline:
428 if (_fuelTypex == Constants::strGasoline) {
429 _fCBr = 0.865;
430 }
431//ORIGINAL LINE: case Constants.strDiesel:
432 else if (_fuelTypex == Constants::strDiesel) {
433 _fCBr = 0.863;
434 }
435//ORIGINAL LINE: case Constants.strCNG:
436 else if (_fuelTypex == Constants::strCNG) {
437 _fCBr = 0.693;
438 _fCHC = 0.803;
439 }
440//ORIGINAL LINE: case Constants.strLPG:
441 else if (_fuelTypex == Constants::strLPG) {
442 _fCBr = 0.825;
443 _fCHC = 0.825;
444 }
445 else {
446 VehicleClass->setErrMsg(std::string("The propolsion type is not known! (") + getFuelType() + std::string(")"));
447 return false;
448 }
449 return true;
450 }
451
452 double CEP::GetDecelCoast(double speed, double acc, double gradient) {
453 //Declaration
454 int upperIndex;
455 int lowerIndex;
456
457 if (speed < Constants::SPEED_DCEL_MIN) {
459 }
460
461 double rotCoeff = GetRotationalCoeffecient(speed);
462 FindLowerUpperInPattern(lowerIndex, upperIndex, _speedPatternRotational, speed);
463 double iGear = Interpolate(speed, _speedPatternRotational[lowerIndex], _speedPatternRotational[upperIndex], _gearTransmissionCurve[lowerIndex], _gearTransmissionCurve[upperIndex]);
464
465 double iTot = iGear * _axleRatio;
466
467 double n = (30 * speed * iTot) / ((_effectiveWheelDiameter / 2) * M_PI);
469
470 FindLowerUpperInPattern(lowerIndex, upperIndex, _nNormTable, nNorm);
471
472 double fMot = 0;
473
474 if (speed >= 10e-2) {
475 fMot = (-Interpolate(nNorm, _nNormTable[lowerIndex], _nNormTable[upperIndex], _dragNormTable[lowerIndex], _dragNormTable[upperIndex]) * getRatedPower() * 1000 / speed) / Constants::getDRIVE_TRAIN_EFFICIENCY();
476 }
477
478 double fRoll = (_resistanceF0 + _resistanceF1 * speed + std::pow(_resistanceF2 * speed, 2) + std::pow(_resistanceF3 * speed, 3) + std::pow(_resistanceF4 * speed, 4)) * (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST;
479
480 double fAir = _cWValue * _crossSectionalArea * Constants::AIR_DENSITY_CONST * 0.5 * std::pow(speed, 2);
481
482 double fGrad = (_massVehicle + _vehicleLoading) * Constants::GRAVITY_CONST * gradient / 100;
483
484 return -(fMot + fRoll + fAir + fGrad) / ((_massVehicle + _vehicleLoading) * rotCoeff);
485 }
486
487 double CEP::GetRotationalCoeffecient(double speed) {
488 //Declaration
489 int upperIndex;
490 int lowerIndex;
491
492 FindLowerUpperInPattern(lowerIndex, upperIndex, _speedPatternRotational, speed);
493 return Interpolate(speed, _speedPatternRotational[lowerIndex], _speedPatternRotational[upperIndex], _speedCurveRotational[lowerIndex], _speedCurveRotational[upperIndex]);
494 }
495
496 void CEP::FindLowerUpperInPattern(int& lowerIndex, int& upperIndex, std::vector<double>& pattern, double value) {
497 lowerIndex = 0;
498 upperIndex = 0;
499
500 if (value <= pattern.front()) {
501 lowerIndex = 0;
502 upperIndex = 0;
503 return;
504 }
505
506 if (value >= pattern.back()) {
507 lowerIndex = (int)pattern.size() - 1;
508 upperIndex = (int)pattern.size() - 1;
509 return;
510 }
511
512 // bisection search to find correct position in power pattern
513 int middleIndex = ((int)pattern.size() - 1) / 2;
514 upperIndex = (int)pattern.size() - 1;
515 lowerIndex = 0;
516
517 while (upperIndex - lowerIndex > 1) {
518 if (pattern[middleIndex] == value) {
519 lowerIndex = middleIndex;
520 upperIndex = middleIndex;
521 return;
522 }
523 else if (pattern[middleIndex] < value) {
524 lowerIndex = middleIndex;
525 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
526 }
527 else {
528 upperIndex = middleIndex;
529 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
530 }
531 }
532
533 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
534 return;
535 }
536 }
537
538 double CEP::Interpolate(double px, double p1, double p2, double e1, double e2) {
539 if (p2 == p1) {
540 return e1;
541 }
542
543 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);
544 }
545
546 double CEP::GetMaxAccel(double speed, double gradient, bool HBEV) {
547 double rotFactor = GetRotationalCoeffecient(speed);
548 double pMaxForAcc = GetPMaxNorm(speed) * getRatedPower() - CalcPower(speed, 0, gradient, HBEV);
549
550 return (pMaxForAcc * 1000) / ((_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * speed);
551 }
552
553 double CEP::GetPMaxNorm(double speed) {
554 // Linear function between v0 and v1, constant elsewhere
555 if (speed <= _pNormV0) {
556 return _pNormP0;
557 }
558 else if (speed >= _pNormV1) {
559 return _pNormP1;
560 }
561 else {
563 }
564 }
565
567 _massVehicle = 0;
568 _vehicleLoading = 0;
569 _vehicleMassRot = 0;
571 _cWValue = 0;
572 _resistanceF0 = 0;
573 _resistanceF1 = 0;
574 _resistanceF2 = 0;
575 _resistanceF3 = 0;
576 _resistanceF4 = 0;
577 _axleRatio = 0;
578 _auxPower = 0;
579 _pNormV0 = 0;
580 _pNormP0 = 0;
581 _pNormV1 = 0;
582 _pNormP1 = 0;
586 }
587}
bool GetfcVals(const std::string &_fuelTypex, double &_fCBr, double &_fCHC, double &_fCCO, double &_fCCO2, Helpers *VehicleClass)
Definition: V5/cpp/CEP.cpp:420
double _vehicleMassRot
Definition: V5/cpp/CEP.h:84
std::map< std::string, std::vector< double > > _normedCepCurveFCvalues
Definition: V5/cpp/CEP.h:110
double GetRotationalCoeffecient(double speed)
Definition: V5/cpp/CEP.cpp:487
const double & getRatedPower() const
Definition: V5/cpp/CEP.cpp:224
void setNormalizingPower(const double &value)
Definition: V5/cpp/CEP.cpp:236
eNormalizingType privateNormalizingType
Definition: V5/cpp/CEP.h:52
double CalcPower(double speed, double acc, double gradient, bool HBEV)
Definition: V5/cpp/CEP.cpp:248
double GetDecelCoast(double speed, double acc, double gradient)
Definition: V5/cpp/CEP.cpp:452
std::vector< double > _normalizedPowerPatternFCvalues
Definition: V5/cpp/CEP.h:105
const eNormalizingType & getNormalizingType() const
Definition: V5/cpp/CEP.cpp:216
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)
Definition: V5/cpp/CEP.cpp:212
std::vector< double > _normailzedPowerPatternPollutants
Definition: V5/cpp/CEP.h:106
void InitializeInstanceFields()
Definition: V5/cpp/CEP.cpp:566
double Interpolate(double px, double p1, double p2, double e1, double e2)
Definition: V5/cpp/CEP.cpp:538
std::vector< double > _powerPatternPollutants
Definition: V5/cpp/CEP.h:107
double CalcWheelPower(double speed, double acc, double gradient)
Definition: V5/cpp/CEP.cpp:269
const bool & getHeavyVehicle() const
Definition: V5/cpp/CEP.cpp:196
std::vector< double > _powerPatternFCvalues
Definition: V5/cpp/CEP.h:104
void setRatedPower(const double &value)
Definition: V5/cpp/CEP.cpp:228
const std::string & getCalcType() const
Definition: V5/cpp/CEP.cpp:208
std::map< std::string, double > _idlingValuesPollutants
Definition: V5/cpp/CEP.h:117
double GetPMaxNorm(double speed)
Definition: V5/cpp/CEP.cpp:553
std::vector< double > _speedPatternRotational
Definition: V5/cpp/CEP.h:103
double GetMaxAccel(double speed, double gradient, bool HBEV)
Definition: V5/cpp/CEP.cpp:546
std::vector< double > _gearTransmissionCurve
Definition: V5/cpp/CEP.h:111
const std::string & getFuelType() const
Definition: V5/cpp/CEP.cpp:200
double _engineRatedSpeed
Definition: V5/cpp/CEP.h:99
double _vehicleLoading
Definition: V5/cpp/CEP.h:83
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
Definition: V5/cpp/CEP.cpp:496
double privateDrivingPower
Definition: V5/cpp/CEP.h:55
void setNormalizingType(const eNormalizingType &value)
Definition: V5/cpp/CEP.cpp:220
double CalcEngPower(double power)
Definition: V5/cpp/CEP.cpp:285
double privateNormalizingPower
Definition: V5/cpp/CEP.h:54
double _engineIdlingSpeed
Definition: V5/cpp/CEP.h:100
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
Definition: V5/cpp/CEP.cpp:355
std::vector< double > _nNormTable
Definition: V5/cpp/CEP.h:119
void setFuelType(const std::string &value)
Definition: V5/cpp/CEP.cpp:204
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)
Definition: V5/cpp/CEP.cpp:296
std::map< std::string, std::vector< double > > _cepCurveFCvalues
Definition: V5/cpp/CEP.h:109
const double & getDrivingPower() const
Definition: V5/cpp/CEP.cpp:240
double _crossSectionalArea
Definition: V5/cpp/CEP.h:85
double _effectiveWheelDiameter
Definition: V5/cpp/CEP.h:101
double privateRatedPower
Definition: V5/cpp/CEP.h:53
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)
Definition: V5/cpp/CEP.cpp:33
void setDrivingPower(const double &value)
Definition: V5/cpp/CEP.cpp:244
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)
Definition: V5/cpp/CEP.cpp:378
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
Definition: V5/cpp/CEP.cpp:232
std::map< std::string, double > _FleetMix
Definition: V5/cpp/CEP.h:115
std::string privateFuelType
Definition: V5/cpp/CEP.h:50
static const std::string HeavyVehicle
static const double NORMALIZING_ACCELARATION
static const double NORMALIZING_SPEED
static const double & getDRIVE_TRAIN_EFFICIENCY()
static const std::string strLPG
static const std::string strCNG
static const double SPEED_DCEL_MIN
static const double ZERO_SPEED_ACCURACY
static const double AIR_DENSITY_CONST
static const std::string strGasoline
static const std::string strDiesel
static const double GRAVITY_CONST
static double _DRIVE_TRAIN_EFFICIENCY
void setErrMsg(const std::string &value)
C++ TraCI client API implementation.
#define M_PI
Definition: odrSpiral.cpp:45