#ifndef BATTERY_H #define BATTERY_H #include #include "math.h" typedef struct batteryData { QString name; double nominalVoltage; double specificEnergy; // Wh/Kg float cellDischargeRate; float 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}, }; enum batteryNames { LiionPhosphate = 0, LiionManganese, LiionCobalt, NiMH, NICd, }; class Battery : public QObject { Q_OBJECT public: Battery(); void setSystemVoltage(double voltage); void setPeakSystemPower(double power); void changeBatteryChemistry(int name); private: batteryData_t activeBattery; int seriesCells; int parallelCells; double systemVoltage; double peakPower; float packDischargeRate; float packChargeRate; float packWeight; float packEnergy; void calculate(void); signals: }; #endif // BATTERY_H