mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Sub-Ladder rungs fill from the highest-yield segment first 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0b33f7dc65
commit
c1a8c27bc1
1 changed files with 11 additions and 5 deletions
|
|
@ -195,13 +195,19 @@ _MIN_SUB_LADDER_PANELS = 2
|
|||
def _resized_to(
|
||||
config: SolarPanelConfiguration, panels: int
|
||||
) -> SolarPanelConfiguration:
|
||||
"""A copy of ``config`` filled to ``panels`` panels, each kept segment's
|
||||
yearly energy scaled pro-rata (conservative: Google places panels
|
||||
best-first within a segment, so the kept panels' true yield is at least
|
||||
the pro-rata figure)."""
|
||||
"""A copy of ``config`` filled to ``panels`` panels — taken from the
|
||||
highest per-panel-yield segments first (the ADR-0038 fill-by-generation
|
||||
precedent) — each kept segment's yearly energy scaled pro-rata
|
||||
(conservative: Google places panels best-first within a segment, so the
|
||||
kept panels' true yield is at least the pro-rata figure)."""
|
||||
by_yield: list[SolarRoofSegment] = sorted(
|
||||
config.segments,
|
||||
key=lambda s: s.yearly_energy_dc_kwh / s.panels_count,
|
||||
reverse=True,
|
||||
)
|
||||
kept: list[SolarRoofSegment] = []
|
||||
remaining: int = panels
|
||||
for segment in config.segments:
|
||||
for segment in by_yield:
|
||||
if remaining <= 0:
|
||||
break
|
||||
take: int = min(segment.panels_count, remaining)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue