summaryrefslogtreecommitdiff
path: root/battery.cpp
diff options
context:
space:
mode:
authorJoshua Drake <joshua.drake@ditchwitch.com>2022-11-21 16:34:17 -0600
committerJoshua Drake <joshua.drake@ditchwitch.com>2022-11-21 16:34:17 -0600
commit179ed918aed1c9f190ae6846ea4bcccccbeab18f (patch)
tree1fabd0bbc20e102097eeecf18e2238f121629d0f /battery.cpp
parent341e61f7a6f9deebf086a2b8147e252be6d45f33 (diff)
Added Pre-Charge functionality and made thing prettier.
Diffstat (limited to 'battery.cpp')
-rw-r--r--battery.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/battery.cpp b/battery.cpp
index e0b7c26..d4a8ae7 100644
--- a/battery.cpp
+++ b/battery.cpp
@@ -4,6 +4,7 @@ Battery::Battery() :
activeBattery(batteries[LiionPhosphate]),
systemVoltage(0),
peakPower(0),
+ minimumAllowableSOC(0),
packDischargeRate(0),
packChargeRate(0),
packWeight(0),
@@ -26,6 +27,10 @@ void Battery::setPeakSystemPower(double power)
{
peakPower = power;
}
+void Battery::setMinimumSOC(double SOC)
+{
+ minimumAllowableSOC = SOC;
+}
void Battery::calculate()
{
@@ -43,7 +48,8 @@ int Battery::parallelCells(void)
float Battery::minimumPackVoltage(void)
{
- return seriesCells()*activeBattery.minimumVoltage;
+ float min = seriesCells()*activeBattery.minimumVoltage;
+ return (min) + (maximumPackVoltage()-min)*(minimumAllowableSOC*0.01);
}
float Battery::maximumPackVoltage(void)