44 lines
1.9 KiB
Python
44 lines
1.9 KiB
Python
|
from pathlib import Path
|
||
|
import pandas as pd
|
||
|
import hub.helpers.constants as cte
|
||
|
|
||
|
def Peak_load (building):
|
||
|
array = [None] * 12
|
||
|
heating = 0
|
||
|
cooling = 0
|
||
|
for system in building.energy_systems:
|
||
|
for demand_type in system.demand_types:
|
||
|
if demand_type == cte.HEATING:
|
||
|
heating = 1
|
||
|
if demand_type == cte.COOLING:
|
||
|
cooling = 1
|
||
|
if cte.MONTH in building.heating_peak_load.keys() and cte.MONTH in building.cooling_peak_load.keys():
|
||
|
peak_lighting = 0
|
||
|
peak_appliances = 0
|
||
|
for thermal_zone in building.internal_zones[0].thermal_zones:
|
||
|
lighting = thermal_zone.lighting
|
||
|
for schedule in lighting.schedules:
|
||
|
for value in schedule.values:
|
||
|
if value * lighting.density * thermal_zone.total_floor_area > peak_lighting:
|
||
|
peak_lighting = value * lighting.density * thermal_zone.total_floor_area
|
||
|
appliances = thermal_zone.appliances
|
||
|
for schedule in appliances.schedules:
|
||
|
for value in schedule.values:
|
||
|
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances:
|
||
|
peak_appliances = value * appliances.density * thermal_zone.total_floor_area
|
||
|
|
||
|
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
|
||
|
conditioning_peak = []
|
||
|
for i, value in enumerate(building.heating_peak_load[cte.MONTH]):
|
||
|
if cooling * building.cooling_peak_load[cte.MONTH][i] > heating * value:
|
||
|
conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH][i])
|
||
|
else:
|
||
|
conditioning_peak.append(heating * value)
|
||
|
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
||
|
|
||
|
electricity_peak_load_results = pd.DataFrame(monthly_electricity_peak
|
||
|
, columns=[f'{building.name} electricity peak load W'])
|
||
|
else:
|
||
|
electricity_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} electricity peak load W'])
|
||
|
|
||
|
return electricity_peak_load_results
|