Compare commits
5 Commits
summercour
...
main
Author | SHA1 | Date | |
---|---|---|---|
04a56b5695 | |||
082c44b38d | |||
428b31354e | |||
5cb01fc74c | |||
a2b2ba890c |
@ -1,249 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"id": 1,
|
||||
"properties": {
|
||||
"heightmax": 9,
|
||||
"ANNEE_CONS": 1978,
|
||||
"CODE_UTILI": "residential"
|
||||
},
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
34.95217088371581,
|
||||
29.56694805860026
|
||||
],
|
||||
[
|
||||
34.95262396587913,
|
||||
29.566952667742285
|
||||
],
|
||||
[
|
||||
34.95261999147337,
|
||||
29.567024109421467
|
||||
],
|
||||
[
|
||||
34.952169558914704,
|
||||
29.567019500282157
|
||||
],
|
||||
[
|
||||
34.95217088371581,
|
||||
29.56694805860026
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"id": 3,
|
||||
"properties": {
|
||||
"heightmax": 16,
|
||||
"ANNEE_CONS": 2012,
|
||||
"CODE_UTILI": "dormitory"
|
||||
},
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
34.95176644317411,
|
||||
29.56827388702702
|
||||
],
|
||||
[
|
||||
34.95176550020565,
|
||||
29.568180388329026
|
||||
],
|
||||
[
|
||||
34.95179850408434,
|
||||
29.568180388329026
|
||||
],
|
||||
[
|
||||
34.95179850408434,
|
||||
29.5681303582886
|
||||
],
|
||||
[
|
||||
34.95176644317411,
|
||||
29.5681303582886
|
||||
],
|
||||
[
|
||||
34.95176644317411,
|
||||
29.568038499789708
|
||||
],
|
||||
[
|
||||
34.951874884488376,
|
||||
29.568038499789708
|
||||
],
|
||||
[
|
||||
34.951874884488376,
|
||||
29.568058183760357
|
||||
],
|
||||
[
|
||||
34.95192391882168,
|
||||
29.568058183760357
|
||||
],
|
||||
[
|
||||
34.951922032885705,
|
||||
29.56804178045124
|
||||
],
|
||||
[
|
||||
34.95205216246262,
|
||||
29.568042600617147
|
||||
],
|
||||
[
|
||||
34.952051219494166,
|
||||
29.568129538124154
|
||||
],
|
||||
[
|
||||
34.95201821561636,
|
||||
29.5681303582886
|
||||
],
|
||||
[
|
||||
34.95201821561636,
|
||||
29.568176287507143
|
||||
],
|
||||
[
|
||||
34.95204839059062,
|
||||
29.568176287507143
|
||||
],
|
||||
[
|
||||
34.95205027652662,
|
||||
29.56827552735433
|
||||
],
|
||||
[
|
||||
34.95195503676348,
|
||||
29.568274707190284
|
||||
],
|
||||
[
|
||||
34.95195597973188,
|
||||
29.56825830391628
|
||||
],
|
||||
[
|
||||
34.951849424353696,
|
||||
29.56825830391628
|
||||
],
|
||||
[
|
||||
34.951849424353696,
|
||||
29.568274707190284
|
||||
],
|
||||
[
|
||||
34.95176644317411,
|
||||
29.56827388702702
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"id": 2,
|
||||
"properties": {
|
||||
"heightmax": 24,
|
||||
"ANNEE_CONS": 2002,
|
||||
"CODE_UTILI": "Hotel employ"
|
||||
},
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
34.94972280674813,
|
||||
29.566224752287738
|
||||
],
|
||||
[
|
||||
34.94974316291999,
|
||||
29.56597561012454
|
||||
],
|
||||
[
|
||||
34.94989147217407,
|
||||
29.565980668855033
|
||||
],
|
||||
[
|
||||
34.94987402402688,
|
||||
29.566233605043536
|
||||
],
|
||||
[
|
||||
34.94972280674813,
|
||||
29.566224752287738
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"id": 4,
|
||||
"properties": {
|
||||
"heightmax": 24,
|
||||
"ANNEE_CONS": 2002,
|
||||
"CODE_UTILI": "Hotel employ"
|
||||
},
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
34.9492572120038,
|
||||
29.565899295950373
|
||||
],
|
||||
[
|
||||
34.949411568175805,
|
||||
29.565906093785898
|
||||
],
|
||||
[
|
||||
34.94939398329561,
|
||||
29.56615761339161
|
||||
],
|
||||
[
|
||||
34.94924158099852,
|
||||
29.566149116117728
|
||||
],
|
||||
[
|
||||
34.9492572120038,
|
||||
29.565899295950373
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"id": 5,
|
||||
"properties": {
|
||||
"heightmax": 9,
|
||||
"ANNEE_CONS": 1978,
|
||||
"CODE_UTILI": "residential"
|
||||
},
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
34.95213398400861,
|
||||
29.567197394967593
|
||||
],
|
||||
[
|
||||
34.95258172690612,
|
||||
29.56720586098278
|
||||
],
|
||||
[
|
||||
34.95258172690612,
|
||||
29.56727217807996
|
||||
],
|
||||
[
|
||||
34.952132361751325,
|
||||
29.56726935607685
|
||||
],
|
||||
[
|
||||
34.95213398400861,
|
||||
29.567197394967593
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
1541
input_files/output_buildings.geojson
Normal file
1541
input_files/output_buildings.geojson
Normal file
File diff suppressed because it is too large
Load Diff
2473
input_files/summerschool_all_buildings.geojson
Normal file
2473
input_files/summerschool_all_buildings.geojson
Normal file
File diff suppressed because it is too large
Load Diff
27
main.py
27
main.py
@ -12,10 +12,9 @@ from sra_engine import SraEngine
|
||||
|
||||
|
||||
try:
|
||||
file_path = (Path(__file__).parent / 'input_files' / 'eilat.geojson')
|
||||
climate_reference_city = 'Montreal'
|
||||
construction_format = 'eilat'
|
||||
usage_format = 'eilat'
|
||||
file_path = (Path(__file__).parent / 'input_files' / 'output_buildings.geojson')
|
||||
construction_format = 'nrcan'
|
||||
usage_format = 'nrcan'
|
||||
energy_systems_format = 'montreal_custom'
|
||||
|
||||
out_path = (Path(__file__).parent / 'output_files')
|
||||
@ -24,26 +23,30 @@ try:
|
||||
print('[simulation start]')
|
||||
city = GeometryFactory('geojson',
|
||||
path=file_path,
|
||||
height_field='heightmax',
|
||||
year_of_construction_field='ANNEE_CONS',
|
||||
function_field='CODE_UTILI',
|
||||
function_to_hub=Dictionaries().eilat_function_to_hub_function).city
|
||||
height_field='height',
|
||||
year_of_construction_field='year_of_construction',
|
||||
function_field='function',
|
||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
||||
|
||||
print(f'city created from {file_path}')
|
||||
ConstructionFactory(construction_format, city).enrich()
|
||||
print('enrich constructions... done')
|
||||
UsageFactory(usage_format, city).enrich()
|
||||
print('enrich usage... done')
|
||||
i = 1
|
||||
x = len(city.buildings)
|
||||
for building in city.buildings:
|
||||
building.energy_systems_archetype_name = 'system 1 gas pv'
|
||||
if i < x:
|
||||
building.energy_systems_archetype_name = 'system 1 gas'
|
||||
else:
|
||||
building.energy_systems_archetype_name = 'system 6 gas'
|
||||
i = i + 1
|
||||
EnergySystemsFactory(energy_systems_format, city).enrich()
|
||||
print('enrich systems... done')
|
||||
|
||||
print('exporting:')
|
||||
sra_file = (tmp_folder / f'{city.name}_sra.xml').resolve()
|
||||
SraEngine(city, sra_file, tmp_folder)
|
||||
SraEngine(city, tmp_folder)
|
||||
print(' sra processed...')
|
||||
|
||||
MonthlyEnergyBalanceEngine(city, tmp_folder)
|
||||
print(' insel processed...')
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
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
|
233
results.py
233
results.py
@ -9,68 +9,50 @@ class Results:
|
||||
self._path = path
|
||||
|
||||
def print(self):
|
||||
print_results = None
|
||||
file = 'city name: ' + self._city.name + '\n'
|
||||
array = [None] * 12
|
||||
for building in self._city.buildings:
|
||||
if cte.MONTH in building.heating_demand.keys():
|
||||
heating_results = building.heating_demand[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} heating Wh'})
|
||||
heating_results = building.heating_demand[cte.MONTH]
|
||||
else:
|
||||
heating_results = pd.DataFrame(array, columns=[f'{building.name} heating demand Wh'])
|
||||
heating_results = [None] * 12
|
||||
if cte.MONTH in building.cooling_demand.keys():
|
||||
cooling_results = building.cooling_demand[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} cooling Wh'})
|
||||
cooling_results = building.cooling_demand[cte.MONTH]
|
||||
else:
|
||||
cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling demand Wh'])
|
||||
cooling_results = [None] * 12
|
||||
if cte.MONTH in building.lighting_electrical_demand.keys():
|
||||
lighting_results = building.lighting_electrical_demand[cte.MONTH]\
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} lighting electrical demand Wh'})
|
||||
lighting_results = building.lighting_electrical_demand[cte.MONTH]
|
||||
else:
|
||||
lighting_results = pd.DataFrame(array, columns=[f'{building.name} lighting electrical demand Wh'])
|
||||
lighting_results = [None] * 12
|
||||
if cte.MONTH in building.appliances_electrical_demand.keys():
|
||||
appliances_results = building.appliances_electrical_demand[cte.MONTH]\
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} appliances electrical demand Wh'})
|
||||
appliances_results = building.appliances_electrical_demand[cte.MONTH]
|
||||
else:
|
||||
appliances_results = pd.DataFrame(array, columns=[f'{building.name} appliances electrical demand Wh'])
|
||||
appliances_results = [None] * 12
|
||||
if cte.MONTH in building.domestic_hot_water_heat_demand.keys():
|
||||
dhw_results = building.domestic_hot_water_heat_demand[cte.MONTH]\
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} domestic hot water demand Wh'})
|
||||
dhw_results = building.domestic_hot_water_heat_demand[cte.MONTH]
|
||||
else:
|
||||
dhw_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water demand Wh'])
|
||||
dhw_results = [None] * 12
|
||||
|
||||
if cte.MONTH in building.heating_consumption.keys():
|
||||
heating_consumption_results = pd.DataFrame(building.heating_consumption[cte.MONTH],
|
||||
columns=[f'{building.name} heating consumption Wh'])
|
||||
heating_consumption_results = building.heating_consumption[cte.MONTH]
|
||||
else:
|
||||
heating_consumption_results = pd.DataFrame(array, columns=[f'{building.name} heating consumption Wh'])
|
||||
heating_consumption_results = [None] * 12
|
||||
if cte.MONTH in building.cooling_consumption.keys():
|
||||
cooling_consumption_results = pd.DataFrame(building.cooling_consumption[cte.MONTH],
|
||||
columns=[f'{building.name} cooling consumption Wh'])
|
||||
cooling_consumption_results = building.cooling_consumption[cte.MONTH]
|
||||
else:
|
||||
cooling_consumption_results = pd.DataFrame(array, columns=[f'{building.name} cooling consumption Wh'])
|
||||
cooling_consumption_results = [None] * 12
|
||||
if cte.MONTH in building.domestic_hot_water_consumption.keys():
|
||||
dhw_consumption_results = pd.DataFrame(building.domestic_hot_water_consumption[cte.MONTH],
|
||||
columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||
dhw_consumption_results = building.domestic_hot_water_consumption[cte.MONTH]
|
||||
else:
|
||||
dhw_consumption_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||
dhw_consumption_results = [None] * 12
|
||||
|
||||
if cte.MONTH in building.heating_peak_load.keys():
|
||||
heating_peak_load_results = pd.DataFrame(building.heating_peak_load[cte.MONTH],
|
||||
columns=[f'{building.name} heating peak load W'])
|
||||
heating_peak_load_results = building.heating_peak_load[cte.MONTH]
|
||||
else:
|
||||
heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W'])
|
||||
heating_peak_load_results = [None] * 12
|
||||
if cte.MONTH in building.cooling_peak_load.keys():
|
||||
cooling_peak_load_results = pd.DataFrame(building.cooling_peak_load[cte.MONTH],
|
||||
columns=[f'{building.name} cooling peak load W'])
|
||||
cooling_peak_load_results = building.cooling_peak_load[cte.MONTH]
|
||||
else:
|
||||
cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W'])
|
||||
|
||||
if cte.MONTH in building.onsite_electrical_production.keys():
|
||||
monthly_onsite_electrical_production = building.onsite_electrical_production[cte.MONTH]
|
||||
onsite_electrical_production = pd.DataFrame(monthly_onsite_electrical_production,
|
||||
columns=[f'{building.name} onsite electrical production Wh'])
|
||||
else:
|
||||
onsite_electrical_production = pd.DataFrame(array, columns=[f'{building.name} onsite electrical production Wh'])
|
||||
|
||||
cooling_peak_load_results = [None] * 12
|
||||
heating = 0
|
||||
cooling = 0
|
||||
for system in building.energy_systems:
|
||||
@ -82,7 +64,7 @@ class Results:
|
||||
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:
|
||||
thermal_zone = building.thermal_zones_from_internal_zones[0]
|
||||
lighting = thermal_zone.lighting
|
||||
for schedule in lighting.schedules:
|
||||
for value in schedule.values:
|
||||
@ -103,25 +85,36 @@ class Results:
|
||||
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'])
|
||||
electricity_peak_load_results = monthly_electricity_peak
|
||||
else:
|
||||
electricity_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} electricity peak load W'])
|
||||
electricity_peak_load_results = [None] * 12
|
||||
|
||||
if cte.MONTH in building.onsite_electrical_production.keys():
|
||||
monthly_onsite_electrical_production = building.onsite_electrical_production[cte.MONTH]
|
||||
onsite_electrical_production = monthly_onsite_electrical_production
|
||||
else:
|
||||
onsite_electrical_production = [None] * 12
|
||||
|
||||
if cte.MONTH in building.distribution_systems_electrical_consumption.keys():
|
||||
extra_electrical_consumption = pd.DataFrame(building.distribution_systems_electrical_consumption[cte.MONTH],
|
||||
columns=[
|
||||
f'{building.name} electrical consumption for distribution Wh'])
|
||||
extra_electrical_consumption = building.distribution_systems_electrical_consumption[cte.MONTH]
|
||||
else:
|
||||
extra_electrical_consumption = pd.DataFrame(array,
|
||||
columns=[
|
||||
f'{building.name} electrical consumption for distribution Wh'])
|
||||
extra_electrical_consumption = [None] * 12
|
||||
|
||||
if print_results is None:
|
||||
print_results = heating_results
|
||||
else:
|
||||
print_results = pd.concat([print_results, heating_results], axis='columns')
|
||||
print_results = pd.concat([print_results,
|
||||
columns_names = [f'{building.name} heating demand J',
|
||||
f'{building.name} cooling demand J',
|
||||
f'{building.name} lighting demand J',
|
||||
f'{building.name} appliances demand J',
|
||||
f'{building.name} domestic hot water demand J',
|
||||
f'{building.name} heating consumption J',
|
||||
f'{building.name} cooling consumption J',
|
||||
f'{building.name} domestic hot water consumption J',
|
||||
f'{building.name} heating peak load W',
|
||||
f'{building.name} cooling peak load W',
|
||||
f'{building.name} electricity peak load W',
|
||||
f'{building.name} onsite electrical production J',
|
||||
f'{building.name} extra electrical consumption J'
|
||||
]
|
||||
print_results = pd.DataFrame([heating_results,
|
||||
cooling_results,
|
||||
lighting_results,
|
||||
appliances_results,
|
||||
@ -133,7 +126,8 @@ class Results:
|
||||
cooling_peak_load_results,
|
||||
electricity_peak_load_results,
|
||||
onsite_electrical_production,
|
||||
extra_electrical_consumption], axis='columns')
|
||||
extra_electrical_consumption]).T
|
||||
print_results.columns = columns_names
|
||||
file += '\n'
|
||||
file += f'name: {building.name}\n'
|
||||
file += f'year of construction: {building.year_of_construction}\n'
|
||||
@ -145,137 +139,8 @@ class Results:
|
||||
file += f'storeys: n/a\n'
|
||||
file += f'volume: {building.volume}\n'
|
||||
|
||||
full_path_results = Path(self._path / 'demand.csv').resolve()
|
||||
full_path_results = Path(self._path / f'demand_{building.name}.csv').resolve()
|
||||
print_results.to_csv(full_path_results, na_rep='null')
|
||||
full_path_metadata = Path(self._path / 'metadata.csv').resolve()
|
||||
with open(full_path_metadata, 'w') as metadata_file:
|
||||
metadata_file.write(file)
|
||||
|
||||
def outputsforgraph(self):
|
||||
outputs_energy =pd.DataFrame()
|
||||
array = [None] * 12
|
||||
for building in self._city.buildings:
|
||||
if cte.MONTH in building.heating_demand.keys():
|
||||
heating_results = building.heating_demand[cte.MONTH].rename(
|
||||
columns={cte.INSEL_MEB: f'{building.name} heating Wh'})
|
||||
else:
|
||||
heating_results = pd.DataFrame(array, columns=[f'{building.name} heating demand Wh'])
|
||||
if cte.MONTH in building.cooling_demand.keys():
|
||||
cooling_results = building.cooling_demand[cte.MONTH].rename(
|
||||
columns={cte.INSEL_MEB: f'{building.name} cooling Wh'})
|
||||
else:
|
||||
cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling demand Wh'])
|
||||
if cte.MONTH in building.lighting_electrical_demand.keys():
|
||||
lighting_results = building.lighting_electrical_demand[cte.MONTH] \
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} lighting electrical demand Wh'})
|
||||
else:
|
||||
lighting_results = pd.DataFrame(array, columns=[f'{building.name} lighting electrical demand Wh'])
|
||||
if cte.MONTH in building.appliances_electrical_demand.keys():
|
||||
appliances_results = building.appliances_electrical_demand[cte.MONTH] \
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} appliances electrical demand Wh'})
|
||||
else:
|
||||
appliances_results = pd.DataFrame(array, columns=[f'{building.name} appliances electrical demand Wh'])
|
||||
if cte.MONTH in building.domestic_hot_water_heat_demand.keys():
|
||||
dhw_results = building.domestic_hot_water_heat_demand[cte.MONTH] \
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} domestic hot water demand Wh'})
|
||||
else:
|
||||
dhw_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water demand Wh'])
|
||||
|
||||
if cte.MONTH in building.heating_consumption.keys():
|
||||
heating_consumption_results = pd.DataFrame(building.heating_consumption[cte.MONTH],
|
||||
columns=[f'{building.name} heating consumption Wh'])
|
||||
else:
|
||||
heating_consumption_results = pd.DataFrame(array, columns=[f'{building.name} heating consumption Wh'])
|
||||
if cte.MONTH in building.cooling_consumption.keys():
|
||||
cooling_consumption_results = pd.DataFrame(building.cooling_consumption[cte.MONTH],
|
||||
columns=[f'{building.name} cooling consumption Wh'])
|
||||
else:
|
||||
cooling_consumption_results = pd.DataFrame(array, columns=[f'{building.name} cooling consumption Wh'])
|
||||
if cte.MONTH in building.domestic_hot_water_consumption.keys():
|
||||
dhw_consumption_results = pd.DataFrame(building.domestic_hot_water_consumption[cte.MONTH],
|
||||
columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||
else:
|
||||
dhw_consumption_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||
|
||||
if cte.MONTH in building.heating_peak_load.keys():
|
||||
heating_peak_load_results = pd.DataFrame(building.heating_peak_load[cte.MONTH],
|
||||
columns=[f'{building.name} heating peak load W'])
|
||||
else:
|
||||
heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W'])
|
||||
if cte.MONTH in building.cooling_peak_load.keys():
|
||||
cooling_peak_load_results = pd.DataFrame(building.cooling_peak_load[cte.MONTH],
|
||||
columns=[f'{building.name} cooling peak load W'])
|
||||
else:
|
||||
cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W'])
|
||||
|
||||
if cte.MONTH in building.onsite_electrical_production.keys():
|
||||
monthly_onsite_electrical_production = building.onsite_electrical_production[cte.MONTH]
|
||||
onsite_electrical_production = pd.DataFrame(monthly_onsite_electrical_production,
|
||||
columns=[f'{building.name} onsite electrical production Wh'])
|
||||
else:
|
||||
onsite_electrical_production = pd.DataFrame(array,
|
||||
columns=[f'{building.name} onsite electrical production Wh'])
|
||||
|
||||
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'])
|
||||
|
||||
if cte.MONTH in building.distribution_systems_electrical_consumption.keys():
|
||||
extra_electrical_consumption = pd.DataFrame(building.distribution_systems_electrical_consumption[cte.MONTH],
|
||||
columns=[
|
||||
f'{building.name} electrical consumption for distribution Wh'])
|
||||
else:
|
||||
extra_electrical_consumption = pd.DataFrame(array,
|
||||
columns=[
|
||||
f'{building.name} electrical consumption for distribution Wh'])
|
||||
|
||||
listgraph = [lighting_results.values.sum(),
|
||||
appliances_results.values.sum(),
|
||||
heating_consumption_results.values.sum(),
|
||||
cooling_consumption_results.values.sum(),
|
||||
dhw_consumption_results.values.sum(),
|
||||
extra_electrical_consumption.values.sum()
|
||||
]
|
||||
outputs_energy[f'building {building.name}'] = listgraph
|
||||
outputs_energy.index = ['Lighting consumption', 'Appliances consumption', 'Heating consumption',
|
||||
'Cooling consumption', 'DHW consumption', 'Extra electrical consumption']
|
||||
total_final_energy = (lighting_results.values.sum() + appliances_results.values.sum() + \
|
||||
heating_consumption_results.values.sum() + cooling_consumption_results.values.sum() + \
|
||||
dhw_consumption_results.values.sum() + extra_electrical_consumption.values.sum())/1000
|
||||
|
||||
return outputs_energy, total_final_energy
|
||||
|
||||
|
||||
|
@ -7,14 +7,13 @@ from hub.imports.results_factory import ResultFactory
|
||||
|
||||
|
||||
class SraEngine:
|
||||
def __init__(self, city, file_path, output_file_path):
|
||||
def __init__(self, city, output_file_path):
|
||||
"""
|
||||
SRA class
|
||||
:param file_path: _sra.xml file path
|
||||
:param city: City
|
||||
:param output_file_path: path to output the sra calculation
|
||||
"""
|
||||
self._city = city
|
||||
self._file_path = file_path
|
||||
self._output_file_path = output_file_path
|
||||
if platform.system() == 'Linux':
|
||||
self._executable = 'sra'
|
||||
@ -29,6 +28,8 @@ class SraEngine:
|
||||
Calls the software
|
||||
"""
|
||||
try:
|
||||
subprocess.run([self._executable, str(self._file_path)], stdout=subprocess.DEVNULL)
|
||||
subprocess.run([self._executable,
|
||||
(self._output_file_path / f'{self._city.name}_sra.xml')],
|
||||
stdout=subprocess.DEVNULL)
|
||||
except (SubprocessError, TimeoutExpired, CalledProcessError) as error:
|
||||
raise Exception(error)
|
||||
|
0
test_problems
Normal file
0
test_problems
Normal file
Loading…
Reference in New Issue
Block a user