dalsi pokusy
This commit is contained in:
@@ -211,6 +211,10 @@ def _select_charge_slots(
|
||||
grid_pm += 1
|
||||
grid_filled_wh += cum
|
||||
|
||||
for t, s in enumerate(slots):
|
||||
if float(s.buy_price) < 0:
|
||||
selected.add(t)
|
||||
|
||||
pv_layer_cap = max(charge_target_wh - grid_filled_wh, 0.0)
|
||||
pv_candidates: list[tuple[int, float, float]] = []
|
||||
for t, s in enumerate(slots):
|
||||
@@ -279,6 +283,33 @@ def _select_discharge_export_slots(
|
||||
break
|
||||
selected.add(t)
|
||||
cum += per_slot_wh
|
||||
|
||||
max_sell = max((float(s.sell_price) for s in slots), default=0.0)
|
||||
if max_sell > 0:
|
||||
for t, s in enumerate(slots):
|
||||
if float(s.sell_price) >= max_sell - degrad and float(s.sell_price) > sell_min:
|
||||
selected.add(t)
|
||||
|
||||
first_neg = next(
|
||||
(i for i, s in enumerate(slots) if float(s.sell_price) < 0),
|
||||
None,
|
||||
)
|
||||
preneg_min_soc = min_soc_wh + max(per_slot_wh, 1000.0)
|
||||
if (
|
||||
first_neg is not None
|
||||
and first_neg > 0
|
||||
and current_soc_wh >= preneg_min_soc
|
||||
):
|
||||
neg_day = _prague_date(slots[first_neg])
|
||||
positive = [
|
||||
i
|
||||
for i in range(first_neg)
|
||||
if float(slots[i].sell_price) >= 0 and _prague_date(slots[i]) == neg_day
|
||||
]
|
||||
if positive:
|
||||
peak_t = max(positive, key=lambda i: (float(slots[i].sell_price), i))
|
||||
selected.add(peak_t)
|
||||
|
||||
return selected
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user