pry oprava uplne chybneho rizeni (prodaval za levneji nez nakoupil)
This commit is contained in:
@@ -60,6 +60,7 @@ declare
|
||||
v_reserve_wh numeric;
|
||||
v_daytime_en boolean;
|
||||
v_night_buf_pct numeric;
|
||||
v_degrad_czk_kwh numeric;
|
||||
begin
|
||||
drop table if exists _ems_plan_slot_wk;
|
||||
create temp table _ems_plan_slot_wk on commit drop as
|
||||
@@ -199,7 +200,8 @@ begin
|
||||
greatest(coalesce(ab.discharge_efficiency, 1::numeric), 0.0001::numeric),
|
||||
(ab.reserve_soc_percent / 100.0 * ab.usable_capacity_wh)::numeric,
|
||||
coalesce(ab.planner_daytime_charge_target_enabled, true),
|
||||
coalesce(ab.planner_night_baseload_buffer_percent, 20::numeric)
|
||||
coalesce(ab.planner_night_baseload_buffer_percent, 20::numeric),
|
||||
coalesce(ab.degradation_cost_czk_kwh, 0.15::numeric)
|
||||
into
|
||||
v_charge_buf,
|
||||
v_discharge_buf,
|
||||
@@ -212,7 +214,8 @@ begin
|
||||
v_discharge_eff,
|
||||
v_reserve_wh,
|
||||
v_daytime_en,
|
||||
v_night_buf_pct
|
||||
v_night_buf_pct,
|
||||
v_degrad_czk_kwh
|
||||
from ems.asset_battery ab
|
||||
join ems.asset_inverter ai on ai.id = ab.inverter_id and ai.site_id = ab.site_id
|
||||
where ab.site_id = p_site_id
|
||||
@@ -331,6 +334,7 @@ begin
|
||||
for r_slot in
|
||||
select wk.slot_ord
|
||||
from _ems_plan_slot_wk wk
|
||||
where wk.sell_price > wk.buy_price + v_degrad_czk_kwh
|
||||
order by wk.sell_price desc, wk.slot_ord desc
|
||||
loop
|
||||
exit when v_cum >= v_discharge_target_wh;
|
||||
|
||||
Reference in New Issue
Block a user