fix BA cutoff
This commit is contained in:
@@ -10,6 +10,7 @@ declare
|
||||
v_b jsonb;
|
||||
v_hp jsonb;
|
||||
v_grid jsonb;
|
||||
v_market jsonb;
|
||||
v_veh jsonb;
|
||||
v_ev jsonb;
|
||||
v_soc_pct numeric;
|
||||
@@ -136,6 +137,25 @@ begin
|
||||
raise exception 'No site_grid_connection for site_id=%', p_site_id;
|
||||
end if;
|
||||
|
||||
select jsonb_build_object(
|
||||
'purchase_pricing_mode', lower(trim(coalesce(smc.purchase_pricing_mode, 'spot'))),
|
||||
'sale_pricing_mode', lower(trim(coalesce(smc.sale_pricing_mode, 'spot')))
|
||||
)
|
||||
into v_market
|
||||
from ems.site_market_config smc
|
||||
where smc.site_id = p_site_id
|
||||
and smc.valid_to is null
|
||||
order by smc.valid_from desc
|
||||
limit 1;
|
||||
|
||||
v_market := coalesce(
|
||||
v_market,
|
||||
jsonb_build_object(
|
||||
'purchase_pricing_mode', 'spot',
|
||||
'sale_pricing_mode', 'spot'
|
||||
)
|
||||
);
|
||||
|
||||
select coalesce(
|
||||
jsonb_agg(
|
||||
jsonb_build_object(
|
||||
@@ -263,6 +283,7 @@ begin
|
||||
'battery', v_b,
|
||||
'heat_pump', v_hp,
|
||||
'grid', v_grid,
|
||||
'market', v_market,
|
||||
'vehicles', v_veh,
|
||||
'ev_sessions', v_ev,
|
||||
'soc_wh', v_soc_wh,
|
||||
|
||||
Reference in New Issue
Block a user