Deye: simplify curtailment scaling (#32798)

This commit is contained in:
andig 2026-08-13 11:48:06 +02:00 • committed by GitHub
parent 904285688d
commit 63e18774b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -284,34 +284,22 @@ render: |
# "Solar Sell" (register 145) is the owner's export on/off switch and left untouched.
# HV models use 10 W units for register 143 (LV: 1 W).
curtail: # limit feed-in to the given percent of nominal (100 % = nominal power)
source: go
in:
- name: maxacpower
type: int
config:
source: const
value: {{ .maxacpower }}
script: |
powerlimit := ( maxacpower * curtail ) / 100
powerlimit
out:
- name: powerlimit
type: int
config:
source: modbus
{{- include "modbus" . | indent 8 }}
register:
address: 143 # Max Sell Power (W)
type: writemultiple
decode: uint16
{{- if eq .batterytype "hv" }}
scale: 0.1
{{- end }}
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 143 # Max Sell Power (W)
type: writemultiple
decode: uint16
{{- if eq .batterytype "hv" }}
scale: {{ divf (maxf .maxacpower 1) 1000 }} # % to 10 W units
{{- else }}
scale: {{ divf (maxf .maxacpower 1) 100 }} # % to W
{{- end }}
curtailed: # allowed feed-in as percent of nominal, derived from Max Sell Power
source: go
in:
- name: limit
type: int
type: float
config:
source: modbus
{{- include "modbus" . | indent 8 }}
@ -322,18 +310,13 @@ render: |
{{- if eq .batterytype "hv" }}
scale: 10
{{- end }}
- name: maxacpower
type: int
config:
source: const
value: {{ .maxacpower }}
script: |
percent := 100
if maxacpower > 0 && limit < maxacpower {
// round, the watt conversion does not reproduce the written percent exactly
percent = (limit*100 + maxacpower/2) / maxacpower
// round, the watt conversion does not reproduce the written percent exactly
p := int(limit*100/{{ maxf .maxacpower 1 }} + 0.5)
if p > 100 {
p = 100
}
percent
p
{{- end }}
{{- if eq .usage "battery" }}
power: