NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
battery.h
Go to the documentation of this file.
1
16#ifndef BATTERY_H
17#define BATTERY_H
18
19#include <iostream>
20
21class Battery {
22private:
23 double batteryMaxCapacity; // Battery max capacity
24 double batteryInitialCharge; // Battery initial capacity
25 double batteryCurrentCharge; // Battery current charge
26 double batteryStateOfCharge; // Battery State of Charge
27 double batteryDischargeCRate; // The C-Rate value of the battery while discharging
28 double batteryRechargeCRate; // The C-Rate value of the battery while recharging
29 double batteryDOD; // The minimum battery depth of discharge
30 double batteryRechargeSOCUpperBound; // The depth of recharge at which the battery stops recharging
31 double batteryRechargeSOCLowerBound; // The depth of discharge at which the battery requires a recharge
32 bool enableRecharge = false; // Indicates whether the battery needs to recharge
33 double batteryCumEnergyConsumed = 0.0; // Cumulative energy consumed by the battery
34 double batteryCumEnergyRegenerated = 0.0; // Cumulative energy regenerated by the battery
35 double batteryCumNetEnergyConsumed = 0.0; // Cumulative net energy consumed by the battery
36
37public:
47 void setBattery(double maxCharge, double initialChargePercentage, double depthOfDischarge,
48 double batteryCRate, double maxRechargeSOC = 0.9, double minRechargeSOC = 0.5);
49
54 double getBatteryMaxCharge() const;
55
60 void setBatteryMaxCharge(double newMaxCharge);
61
66 double getBatteryInitialCharge() const;
67
72 void setBatteryInitialCharge(double newInitialCharge);
73
78 double getBatteryCurrentCharge() const;
79
87 std::pair<bool, double> consumeBattery(double timeStep, double consumedCharge);
88
95 double rechargeBatteryForHybrids(double timeStep, double recharge);
96
103 double rechargeBatteryByRegeneratedEnergy(double timeStep, double recharge);
104
109 double getBatteryStateOfCharge() const;
110
115 double getBatteryDOD() const;
116
121 void setBatteryDOD(double newBatteryDOD);
122
127 double getBatteryCRate() const;
128
133 void setBatteryCRate(double newBatteryCRate);
134
140 bool isBatteryDrainable(double requiredCharge);
141
147
153 double getBatteryMaxDischarge(double timeStep);
154
160 double getBatteryMaxRecharge(double timeStep);
161
166 bool isRechargeRequired() const;
167
172 double getBatteryRechargeSOCUpperBound() const;
173
178 void setBatteryRechargeSOCUpperBound(double newBatteryMaxSOC);
179
184 double getBatteryRechargeSOCLowerBound() const;
185
190 void setBatteryRechargeSOCLowerBound(double newBatteryRechargeSOCLowerBound);
191
197
203
209
214 bool batteryHasCharge();
215
221};
222
223#endif // BATTERY_H
Definition battery.h:21
double rechargeBatteryByRegeneratedEnergy(double timeStep, double recharge)
Recharges the battery by regenerated energy.
Definition battery.cpp:60
double getBatteryCumNetEnergyConsumption()
Gets the cumulative net energy consumption for this battery.
Definition battery.cpp:183
void setBattery(double maxCharge, double initialChargePercentage, double depthOfDischarge, double batteryCRate, double maxRechargeSOC=0.9, double minRechargeSOC=0.5)
Sets the battery properties.
Definition battery.cpp:191
double getBatteryRechargeSOCUpperBound() const
Gets the upper bound of the battery's recharge state of charge.
Definition battery.cpp:139
double getBatteryDOD() const
Gets the depth of discharge of the battery.
Definition battery.cpp:81
double getBatteryCumEnergyRegenerated()
Gets the cumulative energy regenerated for this battery only.
Definition battery.cpp:179
void setBatteryMaxCharge(double newMaxCharge)
Sets the maximum charge of the battery.
Definition battery.cpp:8
bool isBatteryDrainable(double requiredCharge)
Checks if the battery can be drained by the required charge.
Definition battery.cpp:106
void setBatteryCRate(double newBatteryCRate)
Sets the C-Rate of discharge for the battery.
Definition battery.cpp:101
double getBatteryMaxRecharge(double timeStep)
Gets the maximum recharge of the battery.
Definition battery.cpp:131
double getBatteryCurrentCharge() const
Gets the current charge of the battery.
Definition battery.cpp:20
void setBatteryRechargeSOCUpperBound(double newBatteryMaxSOC)
Sets the upper bound of the battery's recharge state of charge.
Definition battery.cpp:143
void setBatteryDOD(double newBatteryDOD)
Sets the depth of discharge of the battery.
Definition battery.cpp:85
bool isRechargeRequired() const
Checks if the battery requires a recharge.
Definition battery.cpp:135
double getBatteryStateOfCharge() const
Gets the state of charge of the battery.
Definition battery.cpp:77
double getBatteryMaxCharge() const
Gets the maximum charge of the battery.
Definition battery.cpp:4
double rechargeBatteryForHybrids(double timeStep, double recharge)
Recharges the battery for hybrid vehicles.
Definition battery.cpp:43
bool IsBatteryExceedingThresholds()
Checks if the battery exceeds certain thresholds.
Definition battery.cpp:119
bool isBatteryRechargable()
Checks if the battery can be recharged.
Definition battery.cpp:112
void setBatteryRechargeSOCLowerBound(double newBatteryRechargeSOCLowerBound)
Sets the lower bound of the battery's recharge state of charge.
Definition battery.cpp:163
double getBatteryMaxDischarge(double timeStep)
Gets the maximum discharge of the battery.
Definition battery.cpp:126
double getBatteryRechargeSOCLowerBound() const
Gets the lower bound of the battery's recharge state of charge.
Definition battery.cpp:159
double getBatteryCumEnergyConsumption()
Gets the cumulative energy consumption for this battery only.
Definition battery.cpp:175
double getBatteryCRate() const
Gets the C-Rate of discharge for the battery.
Definition battery.cpp:97
std::pair< bool, double > consumeBattery(double timeStep, double consumedCharge)
Consumes charge from the battery.
Definition battery.cpp:24
bool batteryHasCharge()
Checks if the battery has enough charge.
Definition battery.cpp:187
double getBatteryInitialCharge() const
Gets the initial charge of the battery.
Definition battery.cpp:12
void setBatteryInitialCharge(double newInitialCharge)
Sets the initial charge of the battery.
Definition battery.cpp:16