MCPcopy Create free account
hub / github.com/evcc-io/evcc / minSocNotReached

Method minSocNotReached

core/loadpoint.go:1081–1102  ·  view source on GitHub ↗

minSocNotReached checks if minimum is configured and not reached. If vehicle is not configured this will always return false

()

Source from the content-addressed store, hash-verified

1079// minSocNotReached checks if minimum is configured and not reached.
1080// If vehicle is not configured this will always return false
1081func (lp *Loadpoint) minSocNotReached() bool {
1082 v := lp.GetVehicle()
1083 if v == nil {
1084 return false
1085 }
1086
1087 minSoc := vehicle.Settings(lp.log, v).GetMinSoc()
1088 if minSoc == 0 {
1089 return false
1090 }
1091
1092 if lp.vehicleSoc != 0 {
1093 active := lp.vehicleSoc < float64(minSoc)
1094 if active {
1095 lp.log.DEBUG.Printf("forced charging at vehicle soc %.0f%% (< %.0f%% min soc)", lp.vehicleSoc, float64(minSoc))
1096 }
1097 return active
1098 }
1099
1100 minEnergy := v.Capacity() * float64(minSoc) * 10 / soc.ChargeEfficiency
1101 return minEnergy > 0 && lp.getChargedEnergy() < minEnergy
1102}
1103
1104// disableUnlessClimater disables the charger unless climate is active
1105func (lp *Loadpoint) disableUnlessClimater() error {

Callers 4

UpdateMethod · 0.95
IsFastChargingActiveMethod · 0.95

Calls 6

GetVehicleMethod · 0.95
getChargedEnergyMethod · 0.95
SettingsFunction · 0.92
PrintfMethod · 0.80
GetMinSocMethod · 0.65
CapacityMethod · 0.65

Tested by 1