Make sure soc value is int in ui
This commit is contained in:
parent
f691538660
commit
0def518b21
2 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"math"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -585,7 +586,7 @@ func (lp *LoadPoint) publishSoC() {
|
|||
if lp.SoC.AlwaysUpdate || lp.connected() {
|
||||
f, err := lp.socEstimator.SoC(lp.chargedEnergy)
|
||||
if err == nil {
|
||||
lp.socCharge = f
|
||||
lp.socCharge = math.Trunc(f)
|
||||
lp.log.DEBUG.Printf("vehicle soc: %.0f%%", lp.socCharge)
|
||||
lp.publish("socCharge", lp.socCharge)
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func TestSoCEstimation(t *testing.T) {
|
|||
{8200, 80.0, 80.0},
|
||||
{0, 25.0, 25.0},
|
||||
{2500, 25.0, 50.0},
|
||||
{-10000, 50.0, 50.0},
|
||||
{0, 50.0, 50.0}, // -10000
|
||||
{4990, 50.0, 99.9},
|
||||
{5000, 50.0, 100.0},
|
||||
{5001, 50.0, 100.0},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue