summaryrefslogtreecommitdiff
path: root/battery.cpp
diff options
context:
space:
mode:
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();
}