blob: d4a8ae70584ecca1ea3c4a4d24a889329a0620f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#include "battery.h"
Battery::Battery() :
activeBattery(batteries[LiionPhosphate]),
systemVoltage(0),
peakPower(0),
minimumAllowableSOC(0),
packDischargeRate(0),
packChargeRate(0),
packWeight(0),
packEnergy(0)
{
}
void Battery::changeBatteryChemistry(int name)
{
activeBattery= batteries[name];
}
void Battery::setSystemVoltage(double voltage)
{
systemVoltage = voltage;
}
void Battery::setPeakSystemPower(double power)
{
peakPower = power;
}
void Battery::setMinimumSOC(double SOC)
{
minimumAllowableSOC = SOC;
}
void Battery::calculate()
{
emit calculation();
}
int Battery::seriesCells(void)
{
return ceil(systemVoltage/activeBattery.nominalVoltage);
}
int Battery::parallelCells(void)
{
//return ceil(peakPower);
}
float Battery::minimumPackVoltage(void)
{
float min = seriesCells()*activeBattery.minimumVoltage;
return (min) + (maximumPackVoltage()-min)*(minimumAllowableSOC*0.01);
}
float Battery::maximumPackVoltage(void)
{
return seriesCells()*activeBattery.maximumVoltage;
}
double Battery::peakCurrent()
{
return peakPower/minimumPackVoltage();
}
|