Investiční studie v2: POTENCIÁLNÍ výroba místo telemetrie (škrcení 81 %!)
Klíčová oprava (postřeh uživatele): při sell<0 lokality škrtí výrobu (reg 340 / GEN cutoff) — telemetrie ukázala 357 kWh, predikce 1879 kWh (96 % minut v derating). Studie nyní používají max(skutečnost, kanonický forecast per pole) v sell<0 slotech. Nové výsledky (horní meze): BA81 32 kWh +35/+46 Kč/den (výkon 6.25/12 kW); KV1 25 kWh +20/+22 Kč/den (stará smlouva); HU1 fixní: 75 Kč/den bez sdílení, 149 Kč/den s EDC sdílením @1.5 Kč distribuce (sdílitelných ~49 kWh/den!); HU1 spot: 372 Kč/den, sdílení +0. + docs/onboarding-wallbox-tc-2026-06.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -131,12 +131,34 @@ async def _load_slots(conn: asyncpg.Connection, site_id: int) -> list[Slot]:
|
||||
select a.interval_start,
|
||||
p.effective_buy_price_czk_kwh as buy,
|
||||
p.effective_sell_price_czk_kwh as sell,
|
||||
greatest(0, coalesce(a.actual_pv_production_wh,0) - coalesce(a.pv_b_production_wh,0)) as pv_a,
|
||||
coalesce(a.pv_b_production_wh,0) as pv_b,
|
||||
-- POTENCIÁL: při sell<0 lokalita škrtí výrobu (reg 340 / GEN cutoff),
|
||||
-- telemetrie ji nevidí → použij max(skutečnost, predikce) per pole.
|
||||
case when p.effective_sell_price_czk_kwh < 0
|
||||
then greatest(coalesce(a.actual_pv_production_wh,0) - coalesce(a.pv_b_production_wh,0),
|
||||
coalesce(fc.fc_a_wh, 0))
|
||||
else greatest(0, coalesce(a.actual_pv_production_wh,0) - coalesce(a.pv_b_production_wh,0))
|
||||
end as pv_a,
|
||||
case when p.effective_sell_price_czk_kwh < 0
|
||||
then greatest(coalesce(a.pv_b_production_wh,0), coalesce(fc.fc_b_wh, 0))
|
||||
else coalesce(a.pv_b_production_wh,0)
|
||||
end as pv_b,
|
||||
coalesce(a.actual_load_consumption_wh,0) as load
|
||||
from ems.audit_interval a
|
||||
join ems.vw_site_effective_price p
|
||||
on p.site_id = a.site_id and p.interval_start = a.interval_start
|
||||
left join lateral (
|
||||
select
|
||||
sum(power_w) filter (where pa.controllable) * 0.25 as fc_a_wh,
|
||||
sum(power_w) filter (where not pa.controllable) * 0.25 as fc_b_wh
|
||||
from (
|
||||
select distinct on (fpr.pv_array_id) fpi2.power_w, fpr.pv_array_id
|
||||
from ems.forecast_pv_interval fpi2
|
||||
join ems.forecast_pv_run fpr on fpr.id = fpi2.run_id
|
||||
where fpi2.interval_start = a.interval_start
|
||||
order by fpr.pv_array_id, fpr.created_at desc
|
||||
) x
|
||||
join ems.asset_pv_array pa on pa.id = x.pv_array_id and pa.site_id = a.site_id
|
||||
) fc on true
|
||||
where a.site_id = $1 and a.actual_load_consumption_wh is not null
|
||||
order by a.interval_start
|
||||
""",
|
||||
|
||||
Reference in New Issue
Block a user