zas oprava KV1 a BA81
This commit is contained in:
@@ -664,13 +664,19 @@ begin
|
||||
from _ems_plan_slot_wk w2
|
||||
where w2.sell_price > w2.buy_price + v_degrad_czk_kwh
|
||||
) then
|
||||
-- Fixní nákup (BA81): buy konstantní — grid nabíjení před exportním oknem, AM/PM rozpočet.
|
||||
-- Fixní nákup (BA81/KV1): grid jen u nejnižšího sell v horizontu (ne slot_ord → 22h za 6 Kč).
|
||||
v_cum := 0;
|
||||
v_grid_slots_am := 0;
|
||||
for r_slot in
|
||||
select wk.slot_ord
|
||||
from _ems_plan_slot_wk wk
|
||||
where extract(hour from wk.interval_start at time zone 'Europe/Prague') < 12
|
||||
and wk.sell_price >= 0
|
||||
and wk.sell_price <= (
|
||||
select min(w3.sell_price)
|
||||
from _ems_plan_slot_wk w3
|
||||
where w3.sell_price >= 0
|
||||
) + v_degrad_czk_kwh + 0.05
|
||||
order by
|
||||
case
|
||||
when (wk.interval_start at time zone 'Europe/Prague')::date = v_plan_day_prague
|
||||
@@ -684,6 +690,7 @@ begin
|
||||
else 1
|
||||
end,
|
||||
wk.is_predicted_price::int,
|
||||
wk.sell_price asc,
|
||||
wk.slot_ord
|
||||
loop
|
||||
exit when v_cum >= v_chg_am_wh;
|
||||
@@ -716,6 +723,12 @@ begin
|
||||
select wk.slot_ord
|
||||
from _ems_plan_slot_wk wk
|
||||
where extract(hour from wk.interval_start at time zone 'Europe/Prague') >= 12
|
||||
and wk.sell_price >= 0
|
||||
and wk.sell_price <= (
|
||||
select min(w3.sell_price)
|
||||
from _ems_plan_slot_wk w3
|
||||
where w3.sell_price >= 0
|
||||
) + v_degrad_czk_kwh + 0.05
|
||||
order by
|
||||
case
|
||||
when (wk.interval_start at time zone 'Europe/Prague')::date = v_plan_day_prague
|
||||
@@ -729,6 +742,7 @@ begin
|
||||
else 1
|
||||
end,
|
||||
wk.is_predicted_price::int,
|
||||
wk.sell_price asc,
|
||||
wk.slot_ord
|
||||
loop
|
||||
exit when v_cum >= v_chg_pm_wh;
|
||||
|
||||
Reference in New Issue
Block a user