evcc-io / evcc

Sonne tanken ☀️🚘
https://evcc.io
MIT License
3.28k stars 595 forks source link

Charging stops in PV mode even BatterySoC is > bufferSoc #6561

Closed Stefan0875 closed 1 year ago

Stefan0875 commented 1 year ago

Describe the bug

I have the following configuration for my site:

prioritySoc: 80 # Hausbatterie bekommt bis zum Soc 80% Priorität beim laden bufferSoc: 81 # Hausbatterie wird oberhalb Soc 81% als Puffer genutzt residualPower: 500

At the sunny day today, the battery was fully charged at 100% and PV mode was working fine.

With reduced sunlight in the afternoon, the power output dropped below the minpower needed to charge (4,1kW).

The expectation was that power from the battery is used as long as the SoC is > bufferSoC but charing stopped after the timer timed out after 3min.

Checking the code I noticed the following if statement in site.go, line 526

// if battery is discharging above bufferSoc ignore it site.batteryBuffered = batteryPower > 0 && site.BufferSoc > 0 && site.batterySoc > site.BufferSoc

In the case the battery is at 100%, the batteryPower is 0 and thus site.batteryBuffered will never be true in that case. Is the check "batteryPower>0" needed? Maybe the battery is discharged at this moment and batteryPower is < 0. Isn't the check for "site.batterySoc > site.BufferSoc" sufficient?

site.batteryBuffered = site.BufferSoc > 0 && site.batterySoc > site.BufferSoc

Steps to reproduce

1.Use configuration as described, bufferSoc > 0 2.Charge battery to 100% Battery Power must be <= 0 3.Beeing in PV mode, the output power must fall below the minimum required power ...

Configuration details

# open evcc at http://evcc.local:7070
network:
  schema: http
  host: evcc.local # .local suffix announces the hostname on MDNS
  port: 7070

log: debug 
levels:
  cache: error

# unique installation id
plant: *****

interval: 10s # control cycle interval

meters:
- type: template
  template: sungrow-hybrid 
  id: 1  
  host: 192.168.178.169  
  port: 502  
  usage: grid  
  modbus: tcpip  
  name: grid1
- type: template
  template: sungrow-hybrid 
  id: 1  
  host: 192.168.178.169  
  port: 502  
  usage: pv  
  modbus: tcpip  
  name: pv2
- type: template
  template: sungrow-hybrid 
  id: 1  
  host: 192.168.178.169  
  port: 502  
  usage: battery  
  modbus: tcpip  
  name: battery3

chargers:
- type: template
  template: tinkerforge-warp 
  fw2: true  
  host: 192.168.178.105  
  port: 1883  
  user: Stefan0875  
  password: topSecret  
  topic: warp2/X7j  
  timeout: 30s  
  name: wallbox5

vehicles:
- type: template
  template: tesla 
  title: Tessi  
  accessToken: ***** 
  refreshToken: *****
  vin: *****
  capacity: 60  
  phases: 3  
  icon: car  
  mode: pv  
  minSoc: 30  
  targetSoc: 100  
  minCurrent: 5  
  maxCurrent: 16  
  name: ev4

loadpoints:
- title: Garage
  charger: wallbox5
  vehicle: ev4
  mode: pv
  phases: 3
  mincurrent: 6
  maxcurrent: 16
  resetOnDisconnect: true

site:
  title: My home
  meters:
    grid: grid1
    pvs:
    - pv2
    batteries:
    - battery3
  prioritySoc: 80 # Hausbatterie bekommt bis zum Soc 80% Priorität beim laden
  bufferSoc: 81 # Hausbatterie wird oberhalb Soc 81% als Puffer genutzt  
  residualPower: 500
mqtt:
  broker: 192.168.178.105:1883
  topic: evcc # root topic for publishing, set empty to disable publishing
  # clientid: foo
  user: Stefan0875
  password: topSecret

tariffs:
  currency: EUR # (default EUR)
  grid:
    # static grid price
    type: fixed
    price: 0.256 # [currency]/kWh

  feedin:
    # rate for feeding excess (pv) energy to the grid
    type: fixed
    price: 0.066 # [currency]/kWh

Log details

Mar  1 15:26:55 evcc evcc[1341001]: [site  ] DEBUG 2023/03/01 15:26:55 ----
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 charge power: 4156W
Mar  1 15:26:55 evcc evcc[1341001]: [site  ] DEBUG 2023/03/01 15:26:55 pv power: 4787W
Mar  1 15:26:55 evcc evcc[1341001]: [site  ] DEBUG 2023/03/01 15:26:55 battery soc: 100%
Mar  1 15:26:55 evcc evcc[1341001]: [site  ] DEBUG 2023/03/01 15:26:55 battery power: 0W
Mar  1 15:26:55 evcc evcc[1341001]: [site  ] DEBUG 2023/03/01 15:26:55 grid power: -486W
Mar  1 15:26:55 evcc evcc[1341001]: [site  ] DEBUG 2023/03/01 15:26:55 site power: 14W
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 charge currents: [6.04 6.04 6.05]A
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 detected active phases: 3p
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 charger status: C
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 next soc poll remaining time: 59m50s
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 soc estimated: 84.16% (vehicle: 84.00%)
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 vehicle soc: 84%
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 vehicle soc limit: 100%
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 vehicle range: 367km
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 pv charge current: 5.98A = 6A + -0.0203A (14W @ 3p)
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 site power 14W >= 0W disable threshold
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 pv disable timer start: 3m0s
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 pv disable in 3m0s
Mar  1 15:26:55 evcc evcc[1341001]: [lp-1  ] DEBUG 2023/03/01 15:26:55 max charge current: 6A

What type of operating system are you running?

Linux

Version

evcc version 0.112.5

GrimmiMeloni commented 1 year ago

Saw the same behavior today at my site running evcc 0.113.2 as well.

Edit: In my case battery power is negative (i.e. charging) and batterySoc at 91%. I'm running the same value for the battery as the reporter (80 prioritySoc and 81 bufferSoc). My residualPower value is 100. Result is the same.

[lp-1  ] DEBUG 2023/03/01 16:04:58 charge power: 1467W
[site  ] DEBUG 2023/03/01 16:04:58 pv power: 1667W
[site  ] DEBUG 2023/03/01 16:04:58 battery soc: 91%
[site  ] DEBUG 2023/03/01 16:04:58 battery power: -10W
[site  ] DEBUG 2023/03/01 16:04:58 grid power: 13W
[site  ] DEBUG 2023/03/01 16:04:58 site power: 103W
[lp-1  ] DEBUG 2023/03/01 16:04:58 charge currents: [6.01 0.011 0.011]A
[lp-1  ] DEBUG 2023/03/01 16:04:58 detected active phases: 1p
[lp-1  ] DEBUG 2023/03/01 16:04:58 charger status: C
[lp-1  ] DEBUG 2023/03/01 16:04:58 soc estimated: 58.19% (vehicle: 57.00%)
[lp-1  ] DEBUG 2023/03/01 16:04:58 vehicle soc: 58%
[lp-1  ] DEBUG 2023/03/01 16:04:58 vehicle soc limit: 80%
[lp-1  ] DEBUG 2023/03/01 16:04:58 vehicle range: 253km
[lp-1  ] DEBUG 2023/03/01 16:04:58 pv charge current: 5.55A = 6A + -0.448A (103W @ 1p)
[lp-1  ] DEBUG 2023/03/01 16:04:58 site power 103W >= 0W disable threshold
[lp-1  ] DEBUG 2023/03/01 16:04:58 pv disable in 0s
[lp-1  ] DEBUG 2023/03/01 16:04:58 pv disable timer elapsed
[lp-1  ] DEBUG 2023/03/01 16:04:58 charger disable
Stefan0875 commented 1 year ago

Btw: Switching to MinPV mode started charing the car again and now "batteryPower" is > 0 since some power is taken out of the battery. If you then switch back to PV mode, it works as expected and charging will stop at the defined batterySoc

andig commented 1 year ago

@premultiply hast du eine Idee? Liegt das an https://github.com/evcc-io/evcc/issues/6213?

premultiply commented 1 year ago

Is the check "batteryPower>0" needed?

Das frage ich mich gerade auch. IMHO kann der auch raus oder müsste dann eher batteryPower != 0 sein.

andig commented 1 year ago

@Stefan0875 der PR ändert das jetzt, ich frag mich allerdings, warum der Akku nicht eigentlich entladen sollte, also power < 0? Wo kommt die Leistung denn dann her?

VolkerK62 commented 1 year ago

Ich war an der Diskussion beteiligt. Problem war. Hausspeicher war voll, also Power = 0. Die PV-Leistung ging zurück. Der disable Timer lief ab und die Ladung wurde beendet. Erwartet wird, dass weiter geladen wird, bis BatterySoc auf bufferSoc gesunken ist, auch wenn die Hausbatterie in dem Moment noch nicht entladen wird.

premultiply commented 1 year ago

Dann teilst du also auch die Auffassung dass das ganz raus kann?

Stefan0875 commented 1 year ago

@andig Volker hat es genau richtig beschrieben, der Akku war voll und deswegen batteryPower=0

Ich hatte mir bereits eine Version gebaut die genau die Änderungen enthält die jetzt committed wurden. Leider konnte ich es Wetter bedingt nicht testen, denke aber dass es so passt.

Solange batterySoc >bufferSoc is soll doch Strom aus der Batterie benutzt werden zum laden, dafür ist bufferSoc doch gedacht, oder?

andig commented 1 year ago

Genau- wir waren nur davon ausgegangen, dass dann ja auch die Batterie entladen muss. Ich habs jetzt mal gemerged, Rückmeldung wäre Klasse!

Stefan0875 commented 1 year ago

Hallo

der Fix funktioniert soweit.

Generell werde ich zur Nutzung des BufferSoC mal eine Diskussion starten, da mir noch ein paar Dinge aufgefallen sind, die man evtl. schöner lösen könnte.