From 341e61f7a6f9deebf086a2b8147e252be6d45f33 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Mon, 21 Nov 2022 02:03:46 -0600 Subject: Added new UI elements and brushed up calculations. --- battery.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'battery.cpp') 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(); } -- cgit v1.2.3