summaryrefslogtreecommitdiff
path: root/battery.cpp
diff options
context:
space:
mode:
authorJoshua Drake <joshua.ellis.drake@gmail.com>2022-11-21 02:03:46 -0600
committerJoshua Drake <joshua.ellis.drake@gmail.com>2022-11-21 02:03:46 -0600
commit341e61f7a6f9deebf086a2b8147e252be6d45f33 (patch)
treef406b1947fb8791b1ee0820823499880d9989490 /battery.cpp
parent1321168cb22a76df96d747194fcb91863e4e0659 (diff)
Added new UI elements and brushed up calculations.
Diffstat (limited to 'battery.cpp')
-rw-r--r--battery.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/battery.cpp b/battery.cpp
index b38a0ac..e0b7c26 100644
--- a/battery.cpp
+++ b/battery.cpp
@@ -2,8 +2,6 @@
Battery::Battery() :
activeBattery(batteries[LiionPhosphate]),
- seriesCells(0),
- parallelCells(0),
systemVoltage(0),
peakPower(0),
packDischargeRate(0),
@@ -31,7 +29,29 @@ void Battery::setPeakSystemPower(double power)
void Battery::calculate()
{
- seriesCells = ceil(systemVoltage/activeBattery.nominalVoltage);
+ emit calculation();
+}
+
+int Battery::seriesCells(void)
+{
+ return ceil(systemVoltage/activeBattery.nominalVoltage);
+}
+int Battery::parallelCells(void)
+{
+ //return ceil(peakPower);
+}
+float Battery::minimumPackVoltage(void)
+{
+ return seriesCells()*activeBattery.minimumVoltage;
+}
+
+float Battery::maximumPackVoltage(void)
+{
+ return seriesCells()*activeBattery.maximumVoltage;
+}
+double Battery::peakCurrent()
+{
+ return peakPower/minimumPackVoltage();
}