dalsi
This commit is contained in:
@@ -874,6 +874,37 @@ begin
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
-- v43: levný grid před prvním sell<0, když tentýž den večer (≥17h) dává arbitráž buy→sell.
|
||||
update _ems_plan_slot_wk wk
|
||||
set allow_charge = true,
|
||||
allow_grid_charge = true,
|
||||
grid_charge_suppressed_reason = coalesce(
|
||||
wk.grid_charge_suppressed_reason,
|
||||
'evening_arbitrage_unlock'
|
||||
)
|
||||
from (
|
||||
select
|
||||
(wk2.interval_start at time zone 'Europe/Prague')::date as plan_date,
|
||||
max(wk2.sell_price) filter (
|
||||
where extract(hour from wk2.interval_start at time zone 'Europe/Prague')
|
||||
>= v_evening_peak_start_hour
|
||||
and wk2.sell_price > 0
|
||||
) as evening_peak_sell
|
||||
from _ems_plan_slot_wk wk2
|
||||
group by 1
|
||||
) ep
|
||||
where (wk.interval_start at time zone 'Europe/Prague')::date = ep.plan_date
|
||||
and ep.evening_peak_sell is not null
|
||||
and ep.evening_peak_sell > v_degrad_czk_kwh + 0.05
|
||||
and wk.buy_price >= 0
|
||||
and wk.buy_price + v_degrad_czk_kwh < ep.evening_peak_sell
|
||||
and extract(hour from wk.interval_start at time zone 'Europe/Prague')
|
||||
< v_evening_peak_start_hour
|
||||
and (
|
||||
v_first_neg_sell_ord is null
|
||||
or wk.slot_ord < v_first_neg_sell_ord
|
||||
);
|
||||
|
||||
-- Ranní pásmo před prvním sell<0 (5–11 Prague): lokální peak, ne půlnoc celého dne.
|
||||
if v_first_neg_sell_ord is not null
|
||||
and v_first_neg_prague_date is not null
|
||||
|
||||
Reference in New Issue
Block a user