register 340 -omezovani vyrkonu pv pole (home-01)
Some checks failed
CI and deploy / migration-check (push) Failing after 11s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-01 12:51:28 +02:00
parent e686bc1d2c
commit 1e0300dd7e
8 changed files with 200 additions and 11 deletions

View File

@@ -0,0 +1,14 @@
-- Cap pro Deye reg 340 (max solar power, W): součet nominal_power_wp řiditelných PV polí na invertoru.
create or replace function ems.fn_inverter_pv_a_max_w(p_inverter_id int)
returns int
language sql
stable
as $$
select coalesce(sum(nominal_power_wp), 0)::int
from ems.asset_pv_array
where inverter_id = p_inverter_id
and controllable = true
$$;
comment on function ems.fn_inverter_pv_a_max_w(int) is
'Cap pro Deye reg 340 (max solar power, W) = součet nominal_power_wp řiditelných PV polí na daném invertoru. 0 = EMS reg 340 neaktivní (skip zápisu).';