Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
V5/cs/CEP.cs
Go to the documentation of this file.
1#define FLEET
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
8namespace PHEMlightdll
9{
10 public class CEP
11 {
12 #region Constructor
13 public CEP(VEHPHEMLightJSON.VEH Vehicle,
14 List<string> headerLineFCvalues,
15 List<List<double>> matrixFCvalues,
16 List<string> headerLinePollutants,
17 List<List<double>> matrixPollutants,
18 List<double> idlingFCvalues,
19 List<double> idlingPollutants)
20 {
21 _resistanceF0 = Vehicle.RollingResData.Fr0.Value;
22 _resistanceF1 = Vehicle.RollingResData.Fr1.Value;
23 _resistanceF2 = Vehicle.RollingResData.Fr2.Value;
24 _resistanceF3 = Vehicle.RollingResData.Fr3.Value;
25 _resistanceF4 = Vehicle.RollingResData.Fr4.Value;
26 _cWValue = Vehicle.VehicleData.Cw.Value;
27 _crossSectionalArea = Vehicle.VehicleData.A.Value;
28 _massVehicle = Vehicle.VehicleData.Mass.Value;
29 _vehicleLoading = Vehicle.VehicleData.Loading.Value;
30 _vehicleMassRot = Vehicle.VehicleData.RedMassWheel.Value;
31 CalcType = Vehicle.VehicleData.CalcType;
32 switch (CalcType)
33 {
34 case "Conv":
35 RatedPower = Vehicle.EngineData.ICEData.Prated.Value;
36 _engineRatedSpeed = Vehicle.EngineData.ICEData.nrated.Value;
37 _engineIdlingSpeed = Vehicle.EngineData.ICEData.Idling.Value;
38 break;
39 case "HEV":
40 // Power von beiden zusammen Rest bezogen auf ICE
41 RatedPower = Vehicle.EngineData.ICEData.Prated.Value + Vehicle.EngineData.EMData.Prated.Value;
42 _engineRatedSpeed = Vehicle.EngineData.ICEData.nrated.Value;
43 _engineIdlingSpeed = Vehicle.EngineData.ICEData.Idling.Value;
44 break;
45 case "BEV":
46 RatedPower = Vehicle.EngineData.EMData.Prated.Value;
47 _engineRatedSpeed = Vehicle.EngineData.EMData.nrated.Value;
49 break;
50 }
51
52 _effectiveWheelDiameter = Vehicle.VehicleData.WheelDiameter.Value;
53 HeavyVehicle = Vehicle.VehicleData.MassType == Constants.HeavyVehicle;
54 FuelType = Vehicle.VehicleData.FuelType;
55 _axleRatio = Vehicle.TransmissionData.AxelRatio.Value;
56 _auxPower = Vehicle.AuxiliariesData.Pauxnorm.Value;
57
58 _pNormV0 = Vehicle.FLDData.P_n_max_v0.Value / 3.6;
59 _pNormP0 = Vehicle.FLDData.P_n_max_p0.Value;
60 _pNormV1 = Vehicle.FLDData.P_n_max_v1.Value / 3.6;
61 _pNormP1 = Vehicle.FLDData.P_n_max_p1.Value;
62
63 // Init pollutant identifiers, unit and measures
64 List<string> FCvaluesIdentifier = new List<string>();
65 List<List<double>> FCvaluesMeasures = new List<List<double>>();
66 List<List<double>> normalizedFCvaluesMeasures = new List<List<double>>();
67 for (int i = 0; i < headerLineFCvalues.Count; i++)
68 {
69 FCvaluesIdentifier.Add(headerLineFCvalues[i]);
70 FCvaluesMeasures.Add(new List<double>());
71 normalizedFCvaluesMeasures.Add(new List<double>());
72 }
73
74 // Init pollutant identifiers, unit and measures
75 List<string> pollutantIdentifier = new List<string>();
76 List<List<double>> pollutantMeasures = new List<List<double>>();
77 List<List<double>> normalizedPollutantMeasures = new List<List<double>>();
78 for (int i = 0; i < headerLinePollutants.Count; i++)
79 {
80 pollutantIdentifier.Add(headerLinePollutants[i]);
81 pollutantMeasures.Add(new List<double>());
82 normalizedPollutantMeasures.Add(new List<double>());
83 }
84
85 // Assigning values for speed rotational table
86 _speedPatternRotational = new List<double>();
87 for (int i = 0; i < Vehicle.TransmissionData.Transm["Speed"].Count; i++)
88 _speedPatternRotational.Add(Vehicle.TransmissionData.Transm["Speed"][i] / 3.6);
89
90 _gearTransmissionCurve = Vehicle.TransmissionData.Transm["GearRatio"];
91 _speedCurveRotational = Vehicle.TransmissionData.Transm["RotMassF"];
92
93 // Assigning values for drag table
94 _nNormTable = Vehicle.FLDData.DragCurve["n_norm"];
95 _dragNormTable = Vehicle.FLDData.DragCurve["pe_drag_norm"];
96
97 // Looping through matrix and assigning values for FC values
98 _powerPatternFCvalues = new List<double>();
99 _normalizedPowerPatternFCvalues = new List<double>();
100
101 int headerFCCount = headerLineFCvalues.Count;
102 for (int i = 0; i < matrixFCvalues.Count; i++)
103 {
104 for (int j = 0; j < matrixFCvalues[i].Count; j++)
105 {
106 if (matrixFCvalues[i].Count != headerFCCount + 1)
107 return;
108
109 if (j == 0)
110 {
111 _normalizedPowerPatternFCvalues.Add(matrixFCvalues[i][j]);
112 _powerPatternFCvalues.Add(matrixFCvalues[i][j] * RatedPower);
113 }
114 else
115 {
116 FCvaluesMeasures[j - 1].Add(matrixFCvalues[i][j] * RatedPower);
117 normalizedFCvaluesMeasures[j - 1].Add(matrixFCvalues[i][j]);
118 }
119 }
120 }
121
122 _cepCurveFCvalues = new Dictionary<string, List<double>>();
123 _idlingValueFCvalues = new Dictionary<string, double>();
124 _normedCepCurveFCvalues = new Dictionary<string, List<double>>();
125
126 for (int i = 0; i < headerLineFCvalues.Count; i++)
127 {
128 _cepCurveFCvalues.Add(FCvaluesIdentifier[i], FCvaluesMeasures[i]);
129 _normedCepCurveFCvalues.Add(FCvaluesIdentifier[i], normalizedFCvaluesMeasures[i]);
130 _idlingValueFCvalues.Add(FCvaluesIdentifier[i], idlingFCvalues[i] * RatedPower);
131 }
132
133 // looping through matrix and assigning values for pollutants
134 double pollutantMultiplyer = 1;
136 if (HeavyVehicle)
137 {
140 pollutantMultiplyer = RatedPower;
141 }
142 else
143 {
145 NormalizingType = eNormalizingType.DrivingPower;
146 }
147
148 _powerPatternPollutants = new List<double>();
149 _normailzedPowerPatternPollutants = new List<double>();
150 _cepNormalizedCurvePollutants = new Dictionary<string, List<double>>();
151
152 int headerCount = headerLinePollutants.Count;
153 for (int i = 0; i < matrixPollutants.Count; i++)
154 {
155 for (int j = 0; j < matrixPollutants[i].Count; j++)
156 {
157 if (matrixPollutants[i].Count != headerCount + 1)
158 return;
159
160 if (j == 0)
161 {
162 _normailzedPowerPatternPollutants.Add(matrixPollutants[i][j]);
163 _powerPatternPollutants.Add(matrixPollutants[i][j] * NormalizingPower);
164 }
165 else
166 {
167 pollutantMeasures[j - 1].Add(matrixPollutants[i][j] * pollutantMultiplyer);
168 normalizedPollutantMeasures[j - 1].Add(matrixPollutants[i][j]);
169 }
170 }
171 }
172
173 _cepCurvePollutants = new Dictionary<string, List<double>>();
174 _idlingValuesPollutants = new Dictionary<string, double>();
175
176 for (int i = 0; i < headerLinePollutants.Count; i++)
177 {
178 _cepCurvePollutants.Add(pollutantIdentifier[i], pollutantMeasures[i]);
179 _cepNormalizedCurvePollutants.Add(pollutantIdentifier[i], normalizedPollutantMeasures[i]);
180 _idlingValuesPollutants.Add(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer);
181 }
182
183 _FleetMix = new Dictionary<string, double>();
186 _FleetMix.Add(Constants.strCNG, 0);
187 _FleetMix.Add(Constants.strLPG, 0);
188 }
189 #endregion
190
191 #if FLEET
192 #region ConstrutorForFleetmix
193 private CEP(bool heavyVehicle,
194 double vehicleMass,
195 double vehicleLoading,
196 double vehicleMassRot,
197 double crossArea,
198 double cWValue,
199 double f0,
200 double f1,
201 double f2,
202 double f3,
203 double f4,
204 double axleRatio,
205 double auxPower,
206 double ratedPower,
207 double engineIdlingSpeed,
208 double engineRatedSpeed,
209 double effictiveWheelDiameter,
210 double pNormV0,
211 double pNormP0,
212 double pNormV1,
213 double pNormP1)
214 {
215 _resistanceF0 = f0;
216 _resistanceF1 = f1;
217 _resistanceF2 = f2;
218 _resistanceF3 = f3;
219 _resistanceF4 = f4;
220 _cWValue = cWValue;
221 _crossSectionalArea = crossArea;
222 _massVehicle = vehicleMass;
223 _vehicleLoading = vehicleLoading;
224 _vehicleMassRot = vehicleMassRot;
225 RatedPower = ratedPower;
226 _engineIdlingSpeed = engineIdlingSpeed;
227 _engineRatedSpeed = engineRatedSpeed;
228 _effectiveWheelDiameter = effictiveWheelDiameter;
229
230 _axleRatio = axleRatio;
231 _auxPower = auxPower;
232
233 _pNormV0 = pNormV0;
234 _pNormP0 = pNormP0;
235 _pNormV1 = pNormV1;
236 _pNormP1 = pNormP1;
237
238 HeavyVehicle = heavyVehicle;
239 }
240 #endregion
241 #endif
242
243 public bool HeavyVehicle { get; }
244 public string FuelType { get; private set; }
245 public string CalcType { get; private set; }
246
247 #region NormalizingType
249 {
252 }
253
254 public eNormalizingType NormalizingType { get; private set; }
255 #endregion
256
257 public double RatedPower { get; set; }
258 public double NormalizingPower { get; private set; }
259 public double DrivingPower { get; set; }
260
261 #region Private Members
262 protected double _massVehicle;
263 protected double _vehicleLoading;
264 protected double _vehicleMassRot;
265 protected double _crossSectionalArea;
266 protected double _cWValue;
267 protected double _resistanceF0;
268 protected double _resistanceF1;
269 protected double _resistanceF2;
270 protected double _resistanceF3;
271 protected double _resistanceF4;
272 protected double _axleRatio;
273 protected double _auxPower;
274 protected double _pNormV0;
275 protected double _pNormP0;
276 protected double _pNormV1;
277 protected double _pNormP1;
278
279 protected double _engineRatedSpeed;
280 protected double _engineIdlingSpeed;
281 protected double _effectiveWheelDiameter;
282
283 protected List<double> _speedPatternRotational;
284 protected List<double> _powerPatternFCvalues;
285 protected List<double> _normalizedPowerPatternFCvalues;
286 protected List<double> _normailzedPowerPatternPollutants;
287 protected List<double> _powerPatternPollutants;
288
289 protected Dictionary<string, List<double>> _cepCurveFCvalues;
290 protected Dictionary<string, List<double>> _normedCepCurveFCvalues;
291 protected List<double> _gearTransmissionCurve;
292 protected List<double> _speedCurveRotational;
293 protected Dictionary<string, List<double>> _cepCurvePollutants;
294 protected Dictionary<string, List<double>> _cepNormalizedCurvePollutants;
295 protected Dictionary<string, double> _FleetMix;
296 protected Dictionary<string, double> _idlingValueFCvalues;
297 protected Dictionary<string, double> _idlingValuesPollutants;
298
299 protected List<double> _nNormTable;
300 protected List<double> _dragNormTable;
301 #endregion
302
303 #region CalcPower
304 public double CalcPower(double speed, double acc, double gradient, bool HBEV)
305 {
306 //Declaration
307 double power = 0;
308 double rotFactor = GetRotationalCoeffecient(speed);
309 double powerAux = (_auxPower * RatedPower);
310
311 //Calculate the power
312 power += (_massVehicle + _vehicleLoading) * Constants.GRAVITY_CONST * (_resistanceF0 + _resistanceF1 * speed + _resistanceF4 * Math.Pow(speed, 4)) * speed;
313 power += (_crossSectionalArea * _cWValue * Constants.AIR_DENSITY_CONST / 2) * Math.Pow(speed, 3);
314 power += (_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * acc * speed;
315 power += (_massVehicle + _vehicleLoading) * Constants.GRAVITY_CONST * gradient * 0.01 * speed;
316 power /= 1000;
318 if (!HBEV)
319 power += powerAux;
320
321 //Return result
322 return power;
323 }
324
325 public double CalcWheelPower(double speed, double acc, double gradient)
326 {
327 //Declaration
328 double power = 0;
329 double rotFactor = GetRotationalCoeffecient(speed);
330
331 //Calculate the power
332 power += (_massVehicle + _vehicleLoading) * Constants.GRAVITY_CONST * (_resistanceF0 + _resistanceF1 * speed + _resistanceF4 * Math.Pow(speed, 4)) * speed;
333 power += (_crossSectionalArea * _cWValue * Constants.AIR_DENSITY_CONST / 2) * Math.Pow(speed, 3);
334 power += (_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * acc * speed;
335 power += (_massVehicle + _vehicleLoading) * Constants.GRAVITY_CONST * gradient * 0.01 * speed;
336 power /= 1000;
337
338 //Return result
339 return power;
340 }
341 #endregion
342
343 #region CalcEngPower
344 public double CalcEngPower(double power)
345 {
346 if (power < _powerPatternFCvalues.First()) return _powerPatternFCvalues.First();
347 if (power > _powerPatternFCvalues.Last()) return _powerPatternFCvalues.Last();
348
349 return power;
350 }
351 #endregion
352
353 #region GetEmission
354 public Dictionary<string, double> GetAllEmission(double power, double speed, Helpers VehicleClass, bool SetZero = false)
355 {
356 //Declaration
357 Dictionary<string, double> Emi = new Dictionary<string, double>();
358
359 if (!SetZero)
360 {
361 //FC values
362 foreach (string id in _cepCurveFCvalues.Keys)
363 {
364 if (id.ToUpper() == "FC_EL" & VehicleClass.pClass == Constants.strBEV)
365 Emi.Add(id.ToUpper(), GetEmission(id, power, speed, VehicleClass) + _auxPower * RatedPower);
366 else
367 Emi.Add(id.ToUpper(), GetEmission(id, power, speed, VehicleClass));
368 }
369
370 //Emission
371 foreach (string id in _cepCurvePollutants.Keys)
372 {
373 if (VehicleClass.pClass != Constants.strBEV)
374 {
375 Emi.Add(id.ToUpper(), GetEmission(id, power, speed, VehicleClass));
376 }
377 else
378 {
379 //If BEV set all emissions to 0
380 Emi.Add(id.ToUpper(), 0);
381 }
382 }
383
384 if (!Emi.ContainsKey("CO2"))
385 {
386 if (Emi.ContainsKey("FC") & Emi.ContainsKey("CO") & Emi.ContainsKey("HC") & VehicleClass.pClass != Constants.strBEV)
387 Emi.Add("CO2", GetCO2Emission(Emi["FC"], Emi["CO"], Emi["HC"], VehicleClass));
388 else
389 Emi.Add("CO2", 0);
390 }
391 }
392 else
393 {
394 foreach (string id in _cepCurveFCvalues.Keys)
395 {
396 if (VehicleClass.pClass == "Mix" & id.ToUpper() == "FC_EL")
397 Emi.Add(id, GetEmission(id, power, speed, VehicleClass));
398 else
399 Emi.Add(id.ToUpper(), 0);
400 }
401
402 foreach (string id in _cepCurvePollutants.Keys)
403 {
404 Emi.Add(id.ToUpper(), 0);
405 }
406 if (!Emi.ContainsKey("CO2")) Emi.Add("CO2", 0);
407 }
408
409 //Return value
410 return Emi;
411 }
412
413 private double GetEmission(string pollutant, double power, double speed, Helpers VehicleClass)
414 {
415 //Declaration
416 List<double> emissionCurve = new List<double>();
417 List<double> powerPattern = new List<double>();
418
419 // bisection search to find correct position in power pattern
420 int upperIndex;
421 int lowerIndex;
422
423 if (Math.Abs(speed) <= Constants.ZERO_SPEED_ACCURACY)
424 {
425 if (!_cepCurvePollutants.ContainsKey(pollutant) & !_cepCurveFCvalues.ContainsKey(pollutant))
426 {
427 VehicleClass.ErrMsg = "Emission pollutant or fuel value " + pollutant + " not found!";
428 return 0;
429 }
430
431 if (_cepCurveFCvalues.ContainsKey(pollutant))
432 return _idlingValueFCvalues[pollutant];
433 else if (_cepCurvePollutants.ContainsKey(pollutant))
434 return _idlingValuesPollutants[pollutant];
435 }
436
437 if (!_cepCurvePollutants.ContainsKey(pollutant) & !_cepCurveFCvalues.ContainsKey(pollutant))
438 {
439 VehicleClass.ErrMsg = "Emission pollutant or fuel value " + pollutant + " not found!";
440 return 0;
441 }
442
443 if (_cepCurveFCvalues.ContainsKey(pollutant))
444 {
445 emissionCurve = _cepCurveFCvalues[pollutant];
446 powerPattern = _powerPatternFCvalues;
447 }
448 else if (_cepCurvePollutants.ContainsKey(pollutant))
449 {
450 emissionCurve = _cepCurvePollutants[pollutant];
451 powerPattern = _powerPatternPollutants;
452 }
453
454 if (emissionCurve.Count == 0)
455 {
456 VehicleClass.ErrMsg = "Empty emission curve for " + pollutant + " found!";
457 return 0;
458 }
459 if (emissionCurve.Count == 1)
460 {
461 return emissionCurve[0];
462 }
463
464 // in case that the demanded power is smaller than the first entry (smallest) in the power pattern the first is returned (should never happen)
465 if (power <= powerPattern.First())
466 {
467 return emissionCurve[0];
468 }
469
470 // if power bigger than all entries in power pattern return the last (should never happen)
471 if (power >= powerPattern.Last())
472 {
473 return emissionCurve.Last();
474 }
475
476 FindLowerUpperInPattern(out lowerIndex, out upperIndex, powerPattern, power);
477 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
478 }
479 #endregion
480
481#if FLEET
482 #region GetNormedEmission
483 private double GetNormedEmission(string pollutant, double power, double speed, Helpers VehicleClass)
484 {
485 //Declaration
486 List<double> emissionCurve = new List<double>();
487 List<double> powerPattern = new List<double>();
488
489 // bisection search to find correct position in power pattern
490 int upperIndex;
491 int lowerIndex;
492
493 if (!_cepCurvePollutants.ContainsKey(pollutant) & !_cepCurveFCvalues.ContainsKey(pollutant))
494 {
495 VehicleClass.ErrMsg = "Emission pollutant or fuel value " + pollutant + " not found!";
496 return 0;
497 }
498
499 if (_cepCurveFCvalues.ContainsKey(pollutant))
500 {
501 emissionCurve = _normedCepCurveFCvalues[pollutant];
502 powerPattern = _normalizedPowerPatternFCvalues;
503 }
504 else if (_cepCurvePollutants.ContainsKey(pollutant))
505 {
506 emissionCurve = _cepNormalizedCurvePollutants[pollutant];
508 }
509
510 if (emissionCurve.Count == 0)
511 {
512 VehicleClass.ErrMsg = "Empty emission curve for " + pollutant + " found!";
513 return 0;
514 }
515 if (emissionCurve.Count == 1)
516 {
517 return emissionCurve[0];
518 }
519 // in case that the demanded power is smaller than the first entry (smallest) in the power pattern the first is returned (should never happen)
520 if (power <= powerPattern.First())
521 {
522 return emissionCurve[0];
523 }
524
525 // if power bigger than all entries in power pattern the last is returned (should never happen)
526 if (power >= powerPattern.Last())
527 {
528 return emissionCurve.Last();
529 }
530
531 FindLowerUpperInPattern(out lowerIndex, out upperIndex, powerPattern, power);
532 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
533 }
534 #endregion
535 #endif
536
537 #region GetCO2Emission
538 public double GetCO2Emission(double _FC, double _CO, double _HC, Helpers VehicleClass)
539 {
540 //Declaration
541 double fCBr, fCHC, fCCO, fCCO2;
542
543 fCBr = 0;
544 fCHC = 0;
545 fCCO = 0;
546 fCCO2 = 0;
547
548 if (FuelType != "Mix")
549 {
550 if (!GetfcVals(FuelType, ref fCBr, ref fCHC, ref fCCO, ref fCCO2, VehicleClass))
551 return 0;
552 }
553 else
554 {
555 if (!CalcfCValMix(ref fCBr, ref fCHC, ref fCCO, ref fCCO2, VehicleClass))
556 return 0;
557 }
558
559 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
560 }
561
562 //Calculate the weighted fuel factor values for Fleetmix
563 private bool CalcfCValMix(ref double _fCBr, ref double _fCHC, ref double _fCCO, ref double _fCCO2, Helpers VehicleClass)
564 {
565 //Declaration
566 double Sum = 0;
567 double sumfCBr, sumfCHC, sumfCCO, sumfCCO2;
568
569 //Initialise
570 sumfCBr = 0;
571 sumfCHC = 0;
572 sumfCCO = 0;
573 sumfCCO2 = 0;
574
575 //calculate the sum
576 foreach (string id in _FleetMix.Keys)
577 {
578 Sum += _FleetMix[id];
579 }
580
581 //Calculate the weighted fuel factors
582 if (Sum <= 0)
583 {
584 VehicleClass.ErrMsg = "All propolsion types in the fleetshares file are not known!";
585 return false;
586 }
587 else
588 {
589 foreach (string id in _FleetMix.Keys)
590 {
591 if (!GetfcVals(id, ref _fCBr, ref _fCHC, ref _fCCO, ref _fCCO2, VehicleClass))
592 {
593 return false;
594 }
595 else
596 {
597 sumfCBr += _fCBr * _FleetMix[id] / Sum;
598 sumfCHC += _fCHC * _FleetMix[id] / Sum;
599 sumfCCO += _fCCO * _FleetMix[id] / Sum;
600 sumfCCO2 += _fCCO2 * _FleetMix[id] / Sum;
601 }
602 }
603 }
604 //Result values
605 _fCBr = sumfCBr;
606 _fCHC = sumfCHC;
607 _fCCO = sumfCCO;
608 _fCCO2 = sumfCCO2;
609 return true;
610 }
611
612 // Get the fuel factor values
613 private bool GetfcVals(string _fuelTypex, ref double _fCBr, ref double _fCHC, ref double _fCCO, ref double _fCCO2, Helpers VehicleClass)
614 {
615 _fCHC = 0.866;
616 _fCCO = 0.429;
617 _fCCO2 = 0.273;
618
619 switch (_fuelTypex)
620 {
622 _fCBr = 0.865;
623 break;
624 case Constants.strDiesel:
625 _fCBr = 0.863;
626 break;
627 case Constants.strCNG:
628 _fCBr = 0.693;
629 _fCHC = 0.803;
630 break;
631 case Constants.strLPG:
632 _fCBr = 0.825;
633 _fCHC = 0.825;
634 break;
635 default:
636 VehicleClass.ErrMsg = "The propolsion type is not known! (" + FuelType + ")";
637 return false;
638 }
639 return true;
640 }
641 #endregion
642
643 #region GetDecelCoast
644 public double GetDecelCoast(double speed, double acc, double gradient)
645 {
646 //Declaration
647 int upperIndex;
648 int lowerIndex;
649
650 if (speed < Constants.SPEED_DCEL_MIN)
651 {
652 return speed / Constants.SPEED_DCEL_MIN * GetDecelCoast(Constants.SPEED_DCEL_MIN, acc, gradient);
653 }
654
655 double rotCoeff = GetRotationalCoeffecient(speed);
656 FindLowerUpperInPattern(out lowerIndex, out upperIndex, _speedPatternRotational, speed);
657 double iGear = Interpolate(speed,
658 _speedPatternRotational[lowerIndex],
659 _speedPatternRotational[upperIndex],
660 _gearTransmissionCurve[lowerIndex],
661 _gearTransmissionCurve[upperIndex]);
662
663 double iTot = iGear * _axleRatio;
664
665 double n = (30 * speed * iTot) / ((_effectiveWheelDiameter / 2) * Math.PI);
667
668 FindLowerUpperInPattern(out lowerIndex, out upperIndex, _nNormTable, nNorm);
669
670 double fMot = 0;
671
672 if (speed >= 10e-2)
673 {
674 fMot = (-Interpolate(nNorm,
675 _nNormTable[lowerIndex],
676 _nNormTable[upperIndex],
677 _dragNormTable[lowerIndex],
678 _dragNormTable[upperIndex]) * RatedPower * 1000 / speed) / Constants.DRIVE_TRAIN_EFFICIENCY;
679 }
680
681 double fRoll = (_resistanceF0
682 + _resistanceF1 * speed
683 + Math.Pow(_resistanceF2 * speed, 2)
684 + Math.Pow(_resistanceF3 * speed, 3)
685 + Math.Pow(_resistanceF4 * speed, 4)) * (_massVehicle + _vehicleLoading) * Constants.GRAVITY_CONST;
686
687 double fAir = _cWValue * _crossSectionalArea * Constants.AIR_DENSITY_CONST * 0.5 * Math.Pow(speed, 2);
688
689 double fGrad = (_massVehicle + _vehicleLoading) * Constants.GRAVITY_CONST * gradient / 100;
690
691 return -(fMot + fRoll + fAir + fGrad) / ((_massVehicle + _vehicleLoading) * rotCoeff);
692 }
693 #endregion
694
695 #region GetRotationalCoeffecient
696 public double GetRotationalCoeffecient(double speed)
697 {
698 //Declaration
699 int upperIndex;
700 int lowerIndex;
701
702 FindLowerUpperInPattern(out lowerIndex, out upperIndex, _speedPatternRotational, speed);
703 return Interpolate(speed,
704 _speedPatternRotational[lowerIndex],
705 _speedPatternRotational[upperIndex],
706 _speedCurveRotational[lowerIndex],
707 _speedCurveRotational[upperIndex]);
708 }
709 #endregion
710
711 #if FLEET
712 #region GetGearCoeffecient
713 public double GetGearCoeffecient(double speed)
714 {
715 //Declaration
716 int upperIndex;
717 int lowerIndex;
718
719 FindLowerUpperInPattern(out lowerIndex, out upperIndex, _speedPatternRotational, speed);
720 return Interpolate(speed,
721 _speedPatternRotational[lowerIndex],
722 _speedPatternRotational[upperIndex],
723 _gearTransmissionCurve[lowerIndex],
724 _gearTransmissionCurve[upperIndex]);
725 }
726 #endregion
727
728 #region GetDragCoeffecient
729 public double GetDragCoeffecient(double nNorm)
730 {
731 //Declaration
732 int upperIndex;
733 int lowerIndex;
734
735 FindLowerUpperInPattern(out lowerIndex, out upperIndex, _nNormTable, nNorm);
736 return Interpolate(nNorm,
737 _nNormTable[lowerIndex],
738 _nNormTable[upperIndex],
739 _dragNormTable[lowerIndex],
740 _dragNormTable[upperIndex]);
741 }
742 #endregion
743 #endif
744
745 #region FindLowerUpperInPattern
746 private void FindLowerUpperInPattern(out int lowerIndex, out int upperIndex, List<double> pattern, double value)
747 {
748 lowerIndex = 0;
749 upperIndex = 0;
750
751 if (value <= pattern.First())
752 {
753 lowerIndex = 0;
754 upperIndex = 0;
755 return;
756 }
757
758 if (value >= pattern.Last())
759 {
760 lowerIndex = pattern.Count - 1;
761 upperIndex = pattern.Count - 1;
762 return;
763 }
764
765 // bisection search to find correct position in power pattern
766 int middleIndex = (pattern.Count - 1) / 2;
767 upperIndex = pattern.Count - 1;
768 lowerIndex = 0;
769
770 while (upperIndex - lowerIndex > 1)
771 {
772 if (pattern[middleIndex] == value)
773 {
774 lowerIndex = middleIndex;
775 upperIndex = middleIndex;
776 return;
777 }
778 else if (pattern[middleIndex] < value)
779 {
780 lowerIndex = middleIndex;
781 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
782 }
783 else
784 {
785 upperIndex = middleIndex;
786 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
787 }
788 }
789
790 if (pattern[lowerIndex] <= value && value < pattern[upperIndex])
791 {
792 return;
793 }
794 }
795 #endregion
796
797 #region Interpolate
798 private double Interpolate(double px, double p1, double p2, double e1, double e2)
799 {
800 if (p2 == p1)
801 return e1;
802
803 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);
804 }
805 #endregion
806
807 #region GetMaxAccel
808 public double GetMaxAccel(double speed, double gradient, bool HBEV)
809 {
810 double rotFactor = GetRotationalCoeffecient(speed);
811 double pMaxForAcc = GetPMaxNorm(speed) * RatedPower - CalcPower(speed, 0, gradient, HBEV);
812
813 return (pMaxForAcc * 1000) / ((_massVehicle * rotFactor + _vehicleMassRot + _vehicleLoading) * speed);
814 }
815 #endregion
816
817 #region GetPMaxNorm
818 private double GetPMaxNorm(double speed)
819 {
820 // Linear function between v0 and v1, constant elsewhere
821 if (speed <= _pNormV0)
822 return _pNormP0;
823 else if (speed >= _pNormV1)
824 return _pNormP1;
825 else
826 {
828 }
829 }
830 #endregion
831
832 //--------------------------------------------------------------------------------------------------
833 // Operators for fleetmix
834 //--------------------------------------------------------------------------------------------------
835
836 #if FLEET
837 #region AddRangeCeps
838 public static CEP AddRangeCeps(CEP[] cps, Helpers Helper)
839 {
840 #region SingleValues
841 CEP newCEP = new CEP(cps.Select(p => p.HeavyVehicle ? 1 : 0).Sum() > 0,
842 cps.Select(p => p._massVehicle).Sum(),
843 cps.Select(p => p._vehicleLoading).Sum(),
844 cps.Select(p => p._vehicleMassRot).Sum(),
845 cps.Select(p => p._crossSectionalArea).Sum(),
846 cps.Select(p => p._cWValue).Sum(),
847 cps.Select(p => p._resistanceF0).Sum(),
848 cps.Select(p => p._resistanceF1).Sum(),
849 cps.Select(p => p._resistanceF2).Sum(),
850 cps.Select(p => p._resistanceF3).Sum(),
851 cps.Select(p => p._resistanceF4).Sum(),
852 cps.Select(p => p._axleRatio).Sum(),
853 cps.Select(p => p._auxPower).Sum(),
854 cps.Select(p => p.RatedPower).Sum(),
855 cps.Select(p => p._engineIdlingSpeed).Sum(),
856 cps.Select(p => p._engineRatedSpeed).Sum(),
857 cps.Select(p => p._effectiveWheelDiameter).Sum(),
858 cps.Select(p => p._pNormV0).Sum(),
859 cps.Select(p => p._pNormP0).Sum(),
860 cps.Select(p => p._pNormV1).Sum(),
861 cps.Select(p => p._pNormP1).Sum());
862
863 #region Fleetmix and Fueltype
864 if (cps.Select(p => p.FuelType).Min() == cps.Select(p => p.FuelType).Max())
865 newCEP.FuelType = cps.First().FuelType;
866 else
867 newCEP.FuelType = "Mix";
868
869 newCEP._FleetMix = new Dictionary<string, double>();
870 foreach (string id in cps.First()._FleetMix.Keys)
871 {
872 newCEP._FleetMix.Add(id, cps.Select(p => p._FleetMix[id]).Sum());
873 }
874 #endregion
875 #endregion
876
877 #region SpeedRotationalTable
878 double minSpeedRotational = cps.Select(p => p._speedPatternRotational.First()).Min();
879 double maxSpeedRotational = cps.Select(p => p._speedPatternRotational.Last()).Max();
880
881 newCEP._speedPatternRotational
882 = CreatePattern(minSpeedRotational,
883 maxSpeedRotational,
885
886 newCEP._speedCurveRotational = new List<double>();
887 newCEP._gearTransmissionCurve = new List<double>();
888
889 for (int i = 0; i < newCEP._speedPatternRotational.Count; i++)
890 {
891 newCEP._speedCurveRotational.Add(cps.Select(p => p.GetRotationalCoeffecient(newCEP._speedPatternRotational[i])).Sum());
892
893 newCEP._gearTransmissionCurve.Add(cps.Select(p => p.GetGearCoeffecient(newCEP._speedPatternRotational[i])).Sum());
894 }
895 #endregion
896
897 #region NormalizingPower
898 newCEP.DrivingPower = newCEP.CalcPower(Constants.NORMALIZING_SPEED, Constants.NORMALIZING_ACCELARATION, 0, (Helper.pClass == Constants.strBEV | Helper.uClass == Constants.strHybrid));
899
900 if (newCEP.HeavyVehicle)
901 {
902 newCEP.NormalizingPower = newCEP.RatedPower;
903 newCEP.NormalizingType = eNormalizingType.RatedPower;
904 }
905 else
906 {
907 newCEP.NormalizingPower = newCEP.DrivingPower;
908 newCEP.NormalizingType = eNormalizingType.DrivingPower;
909 }
910 #endregion
911
912 #region FC
913 double minNormPowerPatternFC = cps.Select(p => p._normalizedPowerPatternFCvalues.First()).Min();
914 double maxNormPowerPatternFC = cps.Select(p => p._normalizedPowerPatternFCvalues.Last()).Max();
915
916 newCEP._normalizedPowerPatternFCvalues
917 = CreatePattern(minNormPowerPatternFC,
918 maxNormPowerPatternFC,
920
921 newCEP._cepCurveFCvalues = new Dictionary<string, List<double>>();
922 newCEP._normedCepCurveFCvalues = new Dictionary<string, List<double>>();
923 newCEP._powerPatternFCvalues = new List<double>();
924
925 foreach (string id in cps.First()._cepCurveFCvalues.Keys)
926 {
927 newCEP._cepCurveFCvalues.Add(id, new List<double>());
928 newCEP._normedCepCurveFCvalues.Add(id, new List<double>());
929 }
930
931 for (int i = 0; i < newCEP._normalizedPowerPatternFCvalues.Count; i++)
932 {
933 foreach (string id in newCEP._cepCurveFCvalues.Keys)
934 {
935 double newCepVal = cps.Select(p => p.GetNormedEmission(id, newCEP._normalizedPowerPatternFCvalues[i], double.MaxValue, Helper)).Sum();
936 newCEP._cepCurveFCvalues[id].Add(newCepVal * newCEP.RatedPower);
937 newCEP._normedCepCurveFCvalues[id].Add(newCepVal);
938 }
939 newCEP._powerPatternFCvalues.Add(newCEP._normalizedPowerPatternFCvalues[i] * newCEP.RatedPower);
940 }
941 #endregion
942
943 #region Pollutants
944 double minNormPowerPattern = cps.Select(p => p._normailzedPowerPatternPollutants.First()).Min();
945 double maxNormPowerPattern = cps.Select(p => p._normailzedPowerPatternPollutants.Last()).Max();
946
947 newCEP._normailzedPowerPatternPollutants
948 = CreatePattern(minNormPowerPattern,
949 maxNormPowerPattern,
951
952 newCEP._cepCurvePollutants = new Dictionary<string, List<double>>();
953 newCEP._cepNormalizedCurvePollutants = new Dictionary<string, List<double>>();
954 newCEP._powerPatternPollutants = new List<double>();
955
956 foreach (string id in cps.First()._cepCurvePollutants.Keys)
957 {
958 newCEP._cepCurvePollutants.Add(id, new List<double>());
959 newCEP._cepNormalizedCurvePollutants.Add(id, new List<double>());
960 }
961
962 for (int i = 0; i < newCEP._normailzedPowerPatternPollutants.Count; i++)
963 {
964 foreach (string id in newCEP._cepCurvePollutants.Keys)
965 {
966 if (newCEP.NormalizingType == eNormalizingType.RatedPower)
967 {
968 double newCepVal = cps.Select(p => p.GetNormedEmission(id, newCEP._normailzedPowerPatternPollutants[i], double.MaxValue, Helper)).Sum();
969 newCEP._cepCurvePollutants[id].Add(newCepVal * newCEP.RatedPower);
970 newCEP._cepNormalizedCurvePollutants[id].Add(newCepVal);
971 }
972 else
973 {
974 newCEP._cepCurvePollutants[id].Add(cps.Select(p => p.GetEmission(id, newCEP._normailzedPowerPatternPollutants[i] * p.NormalizingPower, double.MaxValue, Helper)).Sum());
975 newCEP._cepNormalizedCurvePollutants[id].Add(cps.Select(p => p.GetNormedEmission(id, newCEP._normailzedPowerPatternPollutants[i], double.MaxValue, Helper)).Sum());
976 }
977 }
978 newCEP._powerPatternPollutants.Add(newCEP._normailzedPowerPatternPollutants[i] * newCEP.NormalizingPower);
979 }
980 #endregion
981
982 #region IdlingValues
983 newCEP._idlingValueFCvalues = new Dictionary<string, double>();
984 newCEP._idlingValuesPollutants = new Dictionary<string, double>();
985
986 foreach (string id in cps.First()._idlingValueFCvalues.Keys)
987 {
988 newCEP._idlingValueFCvalues.Add(id, cps.Select(p => p._idlingValueFCvalues[id]).Sum());
989 }
990
991 foreach (string id in cps.First()._idlingValuesPollutants.Keys)
992 {
993 newCEP._idlingValuesPollutants.Add(id, cps.Select(p => p._idlingValuesPollutants[id]).Sum());
994 }
995 #endregion
996
997 #region TragTable
998 double minTragTable = cps.Select(p => p._nNormTable.First()).Min();
999 double maxTragTable = cps.Select(p => p._nNormTable.Last()).Max();
1000
1001 newCEP._nNormTable
1002 = CreatePattern(minTragTable,
1003 maxTragTable,
1005
1006 newCEP._dragNormTable = new List<double>();
1007
1008 for (int i = 0; i < newCEP._nNormTable.Count; i++)
1009 {
1010 newCEP._dragNormTable.Add(cps.Select(p => p.GetDragCoeffecient(newCEP._nNormTable[i])).Sum());
1011 }
1012 #endregion
1013 return newCEP;
1014 }
1015 #endregion
1016
1017 #region Operator *
1018 public static CEP operator *(CEP cp1, double d)
1019 {
1020 #region SingleValues
1021 CEP newCEP = new CEP(cp1.HeavyVehicle,
1022 d * cp1._massVehicle,
1023 d * cp1._vehicleLoading,
1024 d * cp1._vehicleMassRot,
1025 d * cp1._crossSectionalArea,
1026 d * cp1._cWValue,
1027 d * cp1._resistanceF0,
1028 d * cp1._resistanceF1,
1029 d * cp1._resistanceF2,
1030 d * cp1._resistanceF3,
1031 d * cp1._resistanceF4,
1032 d * cp1._axleRatio,
1033 d * cp1._auxPower,
1034 d * cp1.RatedPower,
1035 d * cp1._engineIdlingSpeed,
1036 d * cp1._engineRatedSpeed,
1037 d * cp1._effectiveWheelDiameter,
1038 d * cp1._pNormV0,
1039 d * cp1._pNormP0,
1040 d * cp1._pNormV1,
1041 d * cp1._pNormP1);
1042
1043 #region Fleetmix and Fueltype
1044 newCEP.FuelType = cp1.FuelType;
1045 newCEP._FleetMix = new Dictionary<string, double>();
1046 foreach (string id in cp1._FleetMix.Keys)
1047 {
1048 if (newCEP.FuelType == id)
1049 newCEP._FleetMix.Add(newCEP.FuelType, d);
1050 else
1051 newCEP._FleetMix.Add(id, 0);
1052 }
1053 #endregion
1054 #endregion
1055
1056 #region SpeedRotationalTable
1057 newCEP._speedPatternRotational = new List<double>(cp1._speedPatternRotational);
1058 newCEP._speedCurveRotational = new List<double>(cp1._speedCurveRotational.Select(p => p * d));
1059 newCEP._gearTransmissionCurve = new List<double>(cp1._gearTransmissionCurve.Select(p => p * d));
1060 #endregion
1061
1062 #region NormalizingPower
1063 newCEP.DrivingPower = newCEP.CalcPower(Constants.NORMALIZING_SPEED, Constants.NORMALIZING_ACCELARATION, 0, (cp1.CalcType == "HEV" | cp1.CalcType == "BEV"));
1064
1065 if (newCEP.HeavyVehicle)
1066 {
1067 newCEP.NormalizingPower = newCEP.RatedPower;
1068 newCEP.NormalizingType = eNormalizingType.RatedPower;
1069 }
1070 else
1071 {
1072 newCEP.NormalizingPower = newCEP.DrivingPower;
1073 newCEP.NormalizingType = eNormalizingType.DrivingPower;
1074 }
1075 #endregion
1076
1077 #region FC
1078 newCEP._powerPatternFCvalues = new List<double>(cp1._powerPatternFCvalues.Select(p => p * d));
1079 newCEP._normalizedPowerPatternFCvalues = new List<double>(cp1._normalizedPowerPatternFCvalues);
1080 newCEP._cepCurveFCvalues = new Dictionary<string, List<double>>();
1081 newCEP._normedCepCurveFCvalues = new Dictionary<string, List<double>>();
1082
1083 foreach (string id in cp1._cepCurveFCvalues.Keys)
1084 {
1085 newCEP._cepCurveFCvalues.Add(id, new List<double>(cp1._cepCurveFCvalues[id].Select(p => p * d)));
1086 newCEP._normedCepCurveFCvalues.Add(id, new List<double>(cp1._normedCepCurveFCvalues[id].Select(p => p * d)));
1087 }
1088 #endregion
1089
1090 #region Pollutants
1091 newCEP._powerPatternPollutants = new List<double>(cp1._normailzedPowerPatternPollutants.Select(p => p * newCEP.NormalizingPower));
1092 newCEP._normailzedPowerPatternPollutants = new List<double>(cp1._normailzedPowerPatternPollutants);
1093 newCEP._cepCurvePollutants = new Dictionary<string, List<double>>();
1094 newCEP._cepNormalizedCurvePollutants = new Dictionary<string, List<double>>();
1095
1096 foreach (string id in cp1._cepCurvePollutants.Keys)
1097 {
1098 newCEP._cepCurvePollutants.Add(id, new List<double>(cp1._cepCurvePollutants[id].Select(p => p * d)));
1099 newCEP._cepNormalizedCurvePollutants.Add(id, new List<double>(cp1._cepNormalizedCurvePollutants[id].Select(p => p * d)));
1100 }
1101 #endregion
1102
1103 #region IdlingValues
1104 newCEP._idlingValueFCvalues = new Dictionary<string, double>();
1105 newCEP._idlingValuesPollutants = new Dictionary<string, double>();
1106
1107 foreach (string id in cp1._idlingValueFCvalues.Keys)
1108 {
1109 newCEP._idlingValueFCvalues.Add(id,
1110 cp1._idlingValueFCvalues[id] * d);
1111 }
1112
1113 foreach (string id in cp1._idlingValuesPollutants.Keys)
1114 {
1115 newCEP._idlingValuesPollutants.Add(id,
1116 cp1._idlingValuesPollutants[id] * d);
1117 }
1118 #endregion
1119
1120 #region DragTable
1121 newCEP._nNormTable = new List<double>(cp1._nNormTable);
1122 newCEP._dragNormTable = new List<double>(cp1._dragNormTable.Select(p => p * d));
1123 #endregion
1124 return newCEP;
1125 }
1126 #endregion
1127
1128 #region CreatePattern
1129 static public List<double> CreatePattern(double min, double max, double increment)
1130 {
1131 //Declaration
1132 List<double> pattern = new List<double>();
1133 double actualMin = min;
1134 double actualMax = max;
1135
1136 if (min < 0)
1137 actualMin = Math.Ceiling(min / increment) * increment;
1138 else
1139 actualMin = Math.Floor(min / increment) * increment;
1140
1141 if (max < 0)
1142 actualMax = Math.Floor(max / increment) * increment;
1143 else
1144 actualMax = Math.Ceiling(max / increment) * increment;
1145
1146 double curVal = actualMin;
1147
1148 while (curVal <= actualMax)
1149 {
1150 pattern.Add(curVal);
1151 curVal += increment;
1152 }
1153 return pattern;
1154 }
1155 #endregion
1156
1157 #region CheckClass
1158 public static bool CheckClass(CEP[] cps)
1159 {
1160 return cps.Select(p => p.HeavyVehicle ? 1 : 0).Min() == cps.Select(p => p.HeavyVehicle ? 1 : 0).Max();
1161 }
1162 #endregion
1163 #endif
1164 }
1165}
#define Max
Definition RTree.h:17
#define Min
Definition RTree.h:14
Dictionary< string, List< double > > _cepCurveFCvalues
Definition V5/cs/CEP.cs:289
std::vector< double > _powerPatternPollutants
Definition cpp/CEP.h:116
std::vector< double > _dragNormTable
Definition cpp/CEP.h:128
double GetGearCoeffecient(double speed)
Definition V5/cs/CEP.cs:713
CEP(VEHPHEMLightJSON.VEH Vehicle, List< string > headerLineFCvalues, List< List< double > > matrixFCvalues, List< string > headerLinePollutants, List< List< double > > matrixPollutants, List< double > idlingFCvalues, List< double > idlingPollutants)
Definition V5/cs/CEP.cs:13
double GetPMaxNorm(double speed)
Definition cpp/CEP.cpp:427
List< double > _normalizedPowerPatternFCvalues
Definition V5/cs/CEP.cs:285
std::vector< double > _nNormTable
Definition cpp/CEP.h:127
double GetEmission(string pollutant, double power, double speed, Helpers VehicleClass)
Definition V5/cs/CEP.cs:413
double _effectiveWheelDiameter
Definition cpp/CEP.h:110
double GetDragCoeffecient(double nNorm)
Definition V5/cs/CEP.cs:729
Dictionary< string, List< double > > _normedCepCurveFCvalues
Definition V5/cs/CEP.cs:290
double _axleRatio
Definition cpp/CEP.h:101
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
Definition cpp/CEP.h:123
std::map< std::string, double > _idlingValuesPollutants
Definition cpp/CEP.h:125
double _vehicleLoading
Definition cpp/CEP.h:92
static CEP AddRangeCeps(CEP[] cps, Helpers Helper)
Definition V5/cs/CEP.cs:838
std::vector< double > _speedPatternRotational
Definition cpp/CEP.h:112
Dictionary< string, double > _FleetMix
Definition V5/cs/CEP.cs:295
static List< double > CreatePattern(double min, double max, double increment)
double CalcWheelPower(double speed, double acc, double gradient)
Definition V5/cs/CEP.cs:325
double GetNormedEmission(string pollutant, double power, double speed, Helpers VehicleClass)
Definition V5/cs/CEP.cs:483
bool GetfcVals(string _fuelTypex, ref double _fCBr, ref double _fCHC, ref double _fCCO, ref double _fCCO2, Helpers VehicleClass)
Definition V5/cs/CEP.cs:613
double _resistanceF2
Definition cpp/CEP.h:98
double _resistanceF3
Definition cpp/CEP.h:99
double GetMaxAccel(double speed, double gradient, bool HBEV)
Definition V5/cs/CEP.cs:808
double _cWValue
Definition cpp/CEP.h:95
static CEP operator*(CEP cp1, double d)
std::vector< double > _normailzedPowerPatternPollutants
Definition cpp/CEP.h:115
double _crossSectionalArea
Definition cpp/CEP.h:94
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
Definition cpp/CEP.cpp:370
std::vector< double > _gearTransmissionCurve
Definition cpp/CEP.h:120
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers VehicleClass)
Definition V5/cs/CEP.cs:538
List< double > _powerPatternFCvalues
Definition V5/cs/CEP.cs:284
double GetRotationalCoeffecient(double speed)
Definition cpp/CEP.cpp:361
double CalcEngPower(double power)
Definition V5/cs/CEP.cs:344
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
Definition cpp/CEP.cpp:230
std::vector< double > _speedCurveRotational
Definition cpp/CEP.h:121
void FindLowerUpperInPattern(out int lowerIndex, out int upperIndex, List< double > pattern, double value)
Definition V5/cs/CEP.cs:746
double _resistanceF4
Definition cpp/CEP.h:100
Dictionary< string, double > _idlingValueFCvalues
Definition V5/cs/CEP.cs:296
double _resistanceF0
Definition cpp/CEP.h:96
double CalcPower(double speed, double acc, double gradient)
Definition cpp/CEP.cpp:200
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
Definition cpp/CEP.cpp:291
static bool CheckClass(CEP[] cps)
double Interpolate(double px, double p1, double p2, double e1, double e2)
Definition cpp/CEP.cpp:412
double _engineIdlingSpeed
Definition cpp/CEP.h:109
bool CalcfCValMix(ref double _fCBr, ref double _fCHC, ref double _fCCO, ref double _fCCO2, Helpers VehicleClass)
Definition V5/cs/CEP.cs:563
double _engineRatedSpeed
Definition cpp/CEP.h:108
std::map< std::string, std::vector< double > > _cepCurvePollutants
Definition cpp/CEP.h:122
double _massVehicle
Definition cpp/CEP.h:91
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, double auxPower, double ratedPower, double engineIdlingSpeed, double engineRatedSpeed, double effictiveWheelDiameter, double pNormV0, double pNormP0, double pNormV1, double pNormP1)
Definition V5/cs/CEP.cs:193
Dictionary< string, double > GetAllEmission(double power, double speed, Helpers VehicleClass, bool SetZero=false)
Definition V5/cs/CEP.cs:354
double CalcPower(double speed, double acc, double gradient, bool HBEV)
Definition V5/cs/CEP.cs:304
double GetDecelCoast(double speed, double acc, double gradient)
Definition V5/cs/CEP.cs:644
double _resistanceF1
Definition cpp/CEP.h:97
double _vehicleMassRot
Definition cpp/CEP.h:93
static const std::string strBEV
static const double SPEED_DCEL_MIN
static const std::string strLPG
static const double ZERO_SPEED_ACCURACY
static const double GRAVITY_CONST
static const std::string strDiesel
const double SPEED_ROTATIONAL_INCREMENT
static const std::string HeavyVehicle
const double POWER_POLLUTANT_INCREMENT
static const double NORMALIZING_ACCELARATION
static double _DRIVE_TRAIN_EFFICIENCY
static const std::string strHybrid
static const std::string strGasoline
static const std::string strCNG
static const double NORMALIZING_SPEED
static double DRIVE_TRAIN_EFFICIENCY
C++ TraCI client API implementation.