Improve soc estimator accuracy (#554)
This commit is contained in:
parent
5ec59a65ba
commit
87fe402a4f
2 changed files with 3 additions and 2 deletions
|
|
@ -111,7 +111,8 @@ func (s *SocEstimator) SoC(chargedEnergy float64) (float64, error) {
|
|||
|
||||
if socDelta != 0 || energyDelta < 0 { // soc value change or unexpected energy reset
|
||||
// calculate gradient, wh per soc %
|
||||
if socDelta > 1 && energyDelta > 0 && s.prevSoC > 0 {
|
||||
// TODO: drop samples with unmatching state of evse and vehicle
|
||||
if socDelta > 2 && energyDelta > 0 && s.prevSoC > 0 {
|
||||
s.energyPerSocStep = energyDelta / socDelta
|
||||
s.virtualCapacity = s.energyPerSocStep * 100
|
||||
s.log.TRACE.Printf("soc gradient updated: energyPerSocStep: %0.0fWh, virtualCapacity: %0.0fWh", s.energyPerSocStep, s.virtualCapacity)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func TestSoCEstimation(t *testing.T) {
|
|||
{7100, 71.0, 71.0, 10000},
|
||||
{7300, 72.0, 72.0, 10000},
|
||||
{7400, 73.0, 73.0, 10000},
|
||||
{7700, 75.0, 75.0, 15000}, // 0.3kWh add 2% -> 15kWh battery
|
||||
{7700, 75.0, 75.0, 10000},
|
||||
{8200, 80.0, 80.0, 10000},
|
||||
{0, 25.0, 25.0, 10000},
|
||||
{2500, 25.0, 50.0, 10000},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue