NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
energyconsumption.h
Go to the documentation of this file.
1//
2// Created by Ahmed Aredah
3// Version 0.1
4//
5#pragma once
6#ifndef NeTrainSim_EnergyConsumption_h
7#define NeTrainSim_EnergyConsumption_h
8
9#include <string>
10#include <iostream>
11#include "traintypes.h"
12
13
14using namespace std;
15
16namespace EC {
17// ##################################################################
18// # start: define locomotive default values #
19// ##################################################################
21 static constexpr double DefaultLocomotiveAuxiliaryPower = 0.0;
24 static double DefaultLocomotiveBatteryMaxCharge_Electric = 4000.0;
27 static double DefaultLocomotiveBatteryMaxCharge_DieselHybrid = 4000.0;
30 static double DefaultLocomotiveBatteryMaxCharge_BioDieselHybrid = 4000.0;
33 static double DefaultLocomotiveBatteryMaxCharge_HydogenHybrid = 4000.0;
34
36 static double DefaultLocomotiveBatteryInitialCharge_Electric = 0.6;
38 static double DefaultLocomotiveBatteryInitialCharge_DieselHybrid = 0.6;
40 static double DefaultLocomotiveBatteryInitialCharge_BioDieselHybrid = 0.6;
41
42 static double DefaultLocomotiveBatteryInitialCharge_HydrogenHybrid = 0.6;
43
46 static double DefaultLocomotiveTankMaxCapacityDiesel = 20065.0;
47
50 static double DefaultLocomotiveTankMaxCapacityHydrogen = 20065.0;
52 static double DefaultLocomotiveTankInitialCapacity = 0.9;
53
55 static constexpr double DefaultLocomotiveMinTankDOD = 0.8;
56
58 static constexpr double DefaultLocomotiveBatteryDOD = 0.9;
60 static constexpr double DefaultLocomotiveBatteryCRate = 2.0;
63 static constexpr double DefaultLocomotiveBatteryRechargeMaxSOC_Diesel = 0.65;
66 static constexpr double DefaultLocomotiveBatteryRechargeMaxSOC_Other = 0.65;
69 static constexpr double DefaultLocomotiveBatteryRechargeMinSOC_Diesel = 0.20;
72 static constexpr double DefaultLocomotiveBatteryRechargeMinSOC_Other = 0.50;//0.5
73
75 static constexpr double requiredGeneratorPower[] = {1,1,0.8,0.6,0.4,0.2,0.1,0.0};
76
77 static constexpr double DefaultLocomotivePowerReduction_DieselHybrid = 0.8;
78
79 static constexpr double DefaultLocomotivePowerReduction_BioDieselHybrid = 0.8;
80
81 static constexpr double DefaultLocomotivePowerReduction_HydrogenHybrid = 0.5;
82// ##################################################################
83// # end: define locomotive default values #
84// ##################################################################
85
86// ##################################################################
87// # start: define cars default values #
88// ##################################################################
90 static constexpr double DefaultCarAuxiliaryPower = 0.0;
93 static double DefaultCarBatteryMaxCapacity = 10000.0;
95 static double DefaultCarBatteryInitialCharge = 0.9;
96
99 static double DefaultCarTenderMaxCapacity = 87064.471;
101 static double DefaultCarTenderInitialCapacity = 0.9;
102
104 static constexpr double DefaultCarBatteryDOD = 0.9;
106 static constexpr double DefaultCarBatteryCRate = 2.0;
108 static constexpr double DefaultCarMinTankDOD = 0.9;
109// ##################################################################
110// # end: define cars default values #
111// ##################################################################
112
113// ##################################################################
114// # start: general energy consumption default values #
115// ##################################################################
116
120 static double DefaultDieselConversionFactor = 0.1005;
128 static double DefaultBiodieselConversionFactor = 67.0/620.0;
129
133 static double DefaultHydrogenConversionFactor = 0.002995;
134
136 static double DefaultDieselDensity = 0.00085;
137
139 static double DefaultBioDieselDensity = 0.00088;
141 static double DefaultHydrogenDensity = 0.000099836;
143 static double gamma = 0.65;
144
146 static std::map<TrainTypes::CarType, double> fuelConversionFactor_carTypes = {
147 {TrainTypes::CarType::dieselTender, DefaultDieselConversionFactor},
148 {TrainTypes::CarType::biodieselTender, DefaultBiodieselConversionFactor},
149 {TrainTypes::CarType::hydrogenTender, DefaultHydrogenConversionFactor},
151 };
152
154 static std::map<TrainTypes::PowerType, double> fuelConversionFactor_powerTypes = {
155 {TrainTypes::PowerType::diesel, DefaultDieselConversionFactor},
156 {TrainTypes::PowerType::dieselHybrid, DefaultDieselConversionFactor},
157 {TrainTypes::PowerType::dieselElectric, DefaultDieselConversionFactor},
158 {TrainTypes::PowerType::biodiesel, DefaultBiodieselConversionFactor},
159 {TrainTypes::PowerType::biodieselHybrid, DefaultBiodieselConversionFactor},
160 {TrainTypes::PowerType::hydrogenHybrid, DefaultHydrogenConversionFactor},
162 };
163// ##################################################################
164// # end: general energy consumption default values #
165// ##################################################################
166
178 double getDriveLineEff(double &trainSpeed, int notchNumberIndex, double powerAtWheelProportion,
179 TrainTypes::PowerType powerType,
181
189 double getWheelToDCBusEff(double &trainSpeed);
190
200 double getDCBusToTankEff(double powerAtWheelProportion,
201 TrainTypes::PowerType powerType,
203
212 double getGeneratorEff(TrainTypes::PowerType powerType, double powerAtWheelProportion);
213
214
222 double getBatteryEff(TrainTypes::PowerType powerType);
223
231 std::pair<double,double> getMaxEffeciencyRange(TrainTypes::PowerType powerType);
232
240 double getRequiredGeneratorPowerForRecharge(double batterySOC);
241
242
250 double getEmissions(double fuelConsumption);
251
260
269 double getFuelFromEC(TrainTypes::PowerType powerType, double &EC_KWh);
270
279 double getFuelFromEC(TrainTypes::CarType carType, double &EC_KWh);
280
289
298}
299
300
301
302#endif // !NeTrainSim_EnergyConsumption_h
Definition energyconsumption.cpp:6
std::pair< double, double > getMaxEffeciencyRange(TrainTypes::PowerType powerType)
Gets the maximum efficiency range for a given power type.
Definition energyconsumption.cpp:97
double getFuelConversionFactor(TrainTypes::PowerType powerType)
Gets the fuel conversion factor for a given power type.
Definition energyconsumption.cpp:146
double getEmissions(double fuelConsumption)
Gets the CO2 emissions based on fuel consumption.
Definition energyconsumption.cpp:118
double getGeneratorEff(TrainTypes::PowerType powerType, double powerAtWheelProportion)
Gets the generator efficiency based on power type and power at wheel proportion.
Definition energyconsumption.cpp:72
double getRequiredGeneratorPowerForRecharge(double batterySOC)
Gets the required generator power percentage for recharging the battery based on battery state of cha...
Definition energyconsumption.cpp:110
double getDCBusToTankEff(double powerAtWheelProportion, TrainTypes::PowerType powerType, TrainTypes::LocomotivePowerMethod hybridMethod)
Gets the DC bus-to-tank efficiency based on power proportion at wheel, power type,...
Definition energyconsumption.cpp:19
double getFuelFromEC(TrainTypes::PowerType powerType, double &EC_KWh)
Gets the fuel consumption in liters for a given energy consumption and power type.
Definition energyconsumption.cpp:138
double getDriveLineEff(double &trainSpeed, int notchNumberIndex, double powerAtWheelProportion, TrainTypes::PowerType powerType, TrainTypes::LocomotivePowerMethod hybridMethod)
Gets the drive line efficiency based on train speed, notch number index, power proportion at wheel,...
Definition energyconsumption.cpp:8
double getBatteryEff(TrainTypes::PowerType powerType)
Gets the battery efficiency based on power type.
Definition energyconsumption.cpp:86
double getWheelToDCBusEff(double &trainSpeed)
Gets the wheel-to-DC bus efficiency based on train speed.
Definition energyconsumption.cpp:55
double getLocomotivePowerReductionFactor(TrainTypes::PowerType powerType)
Gets the power reduction factor for a given power type.
Definition energyconsumption.cpp:124
_LocomotivePowerMethod
Values that represent power types.
Definition traintypes.h:337
_PowerType
Values that represent power types.
Definition traintypes.h:168
_CarType
Values that represent car types.
Definition traintypes.h:23