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.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'battery.h') diff --git a/battery.h b/battery.h index 6c0ed44..4c80917 100644 --- a/battery.h +++ b/battery.h @@ -7,18 +7,20 @@ typedef struct batteryData { QString name; double nominalVoltage; + double minimumVoltage; + double maximumVoltage; double specificEnergy; // Wh/Kg - float cellDischargeRate; - float cellChargeRate; + double cellDischargeRate; + double cellChargeRate; }batteryData_t; static const batteryData_t batteries[] { - {.name = "Li-ion Phosphate", .nominalVoltage = 3.3, .specificEnergy = 105.0, .cellDischargeRate = 30, .cellChargeRate = 10}, - {.name = "Li-ion Manganese", .nominalVoltage = 3.7, .specificEnergy = 125.0, .cellDischargeRate = 30, .cellChargeRate = 10}, - {.name = "Li-ion Cobalt", .nominalVoltage = 3.6, .specificEnergy = 200.0, .cellDischargeRate = 2, .cellChargeRate = 1}, - {.name = "NiMH", .nominalVoltage = 1.2, .specificEnergy = 90.0, .cellDischargeRate = 5, .cellChargeRate = 0.5}, - {.name = "NiCd", .nominalVoltage = 1.2, .specificEnergy = 60.0, .cellDischargeRate = 20, .cellChargeRate = 1}, + {.name = "Li-ion Phosphate", .nominalVoltage = 3.3, .minimumVoltage = 2.5, .maximumVoltage = 3.6, .specificEnergy = 105.0, .cellDischargeRate = 30, .cellChargeRate = 10}, + {.name = "Li-ion Manganese", .nominalVoltage = 3.7, .minimumVoltage = 2.5, .maximumVoltage = 4.2, .specificEnergy = 125.0, .cellDischargeRate = 30, .cellChargeRate = 10}, + {.name = "Li-ion Cobalt", .nominalVoltage = 3.6, .minimumVoltage = 2.5, .maximumVoltage = 4.2, .specificEnergy = 200.0, .cellDischargeRate = 2, .cellChargeRate = 1}, + {.name = "NiMH", .nominalVoltage = 1.2, .minimumVoltage = 1.0, .maximumVoltage = 1.3, .specificEnergy = 90.0, .cellDischargeRate = 5, .cellChargeRate = 0.5}, + {.name = "NiCd", .nominalVoltage = 1.2, .minimumVoltage = 1.0, .maximumVoltage = 1.3, .specificEnergy = 60.0, .cellDischargeRate = 20, .cellChargeRate = 1}, }; enum batteryNames { @@ -38,20 +40,26 @@ public: void setSystemVoltage(double voltage); void setPeakSystemPower(double power); void changeBatteryChemistry(int name); + + int seriesCells(void); + int parallelCells(void); + float minimumPackVoltage(void); + float maximumPackVoltage(void); + double peakCurrent(void); public slots: void calculate(void); private: batteryData_t activeBattery; - int seriesCells; - int parallelCells; double systemVoltage; double peakPower; float packDischargeRate; float packChargeRate; float packWeight; float packEnergy; + signals: + void calculation(void); }; -- cgit v1.2.3