Debugging solar api for missing panel config

This commit is contained in:
Khalim Conn-Kowlessar 2024-08-19 21:54:33 +01:00
parent 01c688da23
commit 9436bfe7d6

View file

@ -309,7 +309,7 @@ class GoogleSolarApi:
}
)
panel_performance = pd.DataFrame(panel_performance)
panel_performance = pd.DataFrame([panel_performance])
if panel_performance.empty:
self.panel_performance = pd.DataFrame(
@ -329,12 +329,30 @@ class GoogleSolarApi:
return
# We can have duplicate configurations
panel_performance = panel_performance.drop_duplicates()
# If we look at the building level, we don't include any projects fewer than 10 panels, otherwise the
# minimum is 4
min_panels = 10 if is_building else 4
panel_performance = panel_performance[panel_performance["n_panels"] >= min_panels]
if panel_performance.empty:
self.panel_performance = pd.DataFrame(
columns=[
"n_panels",
"yearly_dc_energy",
"total_cost",
"panneled_roof_area",
"array_wattage",
"initial_ac_kwh_per_year",
"lifetime_ac_kwh",
"roi",
"expected_payback_years",
"lifetime_dc_kwh"
]
)
return
panel_performance["initial_ac_kwh_per_year"] = panel_performance["yearly_dc_energy"] * self.dc_to_ac_rate
# Remove anything where the total ac energy is less than half of the array wattage