Compare commits
6 Commits
main
...
summercour
Author | SHA1 | Date | |
---|---|---|---|
4c49d51a26 | |||
d48d811787 | |||
b74e0f21b5 | |||
95698d61ed | |||
44dff9b47e | |||
6c4559b3d6 |
249
input_files/eilat.geojson
Normal file
249
input_files/eilat.geojson
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
main.py
17
main.py
@ -3,7 +3,6 @@ from pathlib import Path
|
|||||||
from hub.imports.geometry_factory import GeometryFactory
|
from hub.imports.geometry_factory import GeometryFactory
|
||||||
from hub.imports.construction_factory import ConstructionFactory
|
from hub.imports.construction_factory import ConstructionFactory
|
||||||
from hub.imports.usage_factory import UsageFactory
|
from hub.imports.usage_factory import UsageFactory
|
||||||
from hub.imports.weather_factory import WeatherFactory
|
|
||||||
from hub.helpers.dictionaries import Dictionaries
|
from hub.helpers.dictionaries import Dictionaries
|
||||||
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
@ -13,14 +12,11 @@ from sra_engine import SraEngine
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file_path = (Path(__file__).parent / 'input_files' / '195_v1.geojson')
|
file_path = (Path(__file__).parent / 'input_files' / 'eilat.geojson')
|
||||||
climate_reference_city = 'Montreal'
|
climate_reference_city = 'Montreal'
|
||||||
weather_format = 'epw'
|
construction_format = 'eilat'
|
||||||
construction_format = 'nrcan'
|
usage_format = 'eilat'
|
||||||
usage_format = 'nrcan'
|
|
||||||
energy_systems_format = 'montreal_custom'
|
energy_systems_format = 'montreal_custom'
|
||||||
attic_heated_case = 0
|
|
||||||
basement_heated_case = 1
|
|
||||||
|
|
||||||
out_path = (Path(__file__).parent / 'output_files')
|
out_path = (Path(__file__).parent / 'output_files')
|
||||||
tmp_folder = (Path(__file__).parent / 'tmp')
|
tmp_folder = (Path(__file__).parent / 'tmp')
|
||||||
@ -31,12 +27,9 @@ try:
|
|||||||
height_field='heightmax',
|
height_field='heightmax',
|
||||||
year_of_construction_field='ANNEE_CONS',
|
year_of_construction_field='ANNEE_CONS',
|
||||||
function_field='CODE_UTILI',
|
function_field='CODE_UTILI',
|
||||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
function_to_hub=Dictionaries().eilat_function_to_hub_function).city
|
||||||
city.climate_reference_city = climate_reference_city
|
|
||||||
city.climate_file = (tmp_folder / f'{climate_reference_city}.cli').resolve()
|
|
||||||
print(f'city created from {file_path}')
|
print(f'city created from {file_path}')
|
||||||
WeatherFactory(weather_format, city).enrich()
|
|
||||||
print('enrich weather... done')
|
|
||||||
ConstructionFactory(construction_format, city).enrich()
|
ConstructionFactory(construction_format, city).enrich()
|
||||||
print('enrich constructions... done')
|
print('enrich constructions... done')
|
||||||
UsageFactory(usage_format, city).enrich()
|
UsageFactory(usage_format, city).enrich()
|
||||||
|
44
peak_load_class.py
Normal file
44
peak_load_class.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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
|
50
results.py
50
results.py
@ -152,7 +152,7 @@ class Results:
|
|||||||
metadata_file.write(file)
|
metadata_file.write(file)
|
||||||
|
|
||||||
def outputsforgraph(self):
|
def outputsforgraph(self):
|
||||||
file = 'city name: ' + self._city.name + '\n'
|
outputs_energy =pd.DataFrame()
|
||||||
array = [None] * 12
|
array = [None] * 12
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
if cte.MONTH in building.heating_demand.keys():
|
if cte.MONTH in building.heating_demand.keys():
|
||||||
@ -262,36 +262,20 @@ class Results:
|
|||||||
columns=[
|
columns=[
|
||||||
f'{building.name} electrical consumption for distribution Wh'])
|
f'{building.name} electrical consumption for distribution Wh'])
|
||||||
|
|
||||||
if print_results is None:
|
listgraph = [lighting_results.values.sum(),
|
||||||
print_results = heating_results
|
appliances_results.values.sum(),
|
||||||
else:
|
heating_consumption_results.values.sum(),
|
||||||
print_results = pd.concat([print_results, heating_results], axis='columns')
|
cooling_consumption_results.values.sum(),
|
||||||
print_results = pd.concat([print_results,
|
dhw_consumption_results.values.sum(),
|
||||||
cooling_results,
|
extra_electrical_consumption.values.sum()
|
||||||
lighting_results,
|
]
|
||||||
appliances_results,
|
outputs_energy[f'building {building.name}'] = listgraph
|
||||||
dhw_results,
|
outputs_energy.index = ['Lighting consumption', 'Appliances consumption', 'Heating consumption',
|
||||||
heating_consumption_results,
|
'Cooling consumption', 'DHW consumption', 'Extra electrical consumption']
|
||||||
cooling_consumption_results,
|
total_final_energy = (lighting_results.values.sum() + appliances_results.values.sum() + \
|
||||||
dhw_consumption_results,
|
heating_consumption_results.values.sum() + cooling_consumption_results.values.sum() + \
|
||||||
heating_peak_load_results,
|
dhw_consumption_results.values.sum() + extra_electrical_consumption.values.sum())/1000
|
||||||
cooling_peak_load_results,
|
|
||||||
electricity_peak_load_results,
|
return outputs_energy, total_final_energy
|
||||||
onsite_electrical_production,
|
|
||||||
extra_electrical_consumption], axis='columns')
|
|
||||||
file += '\n'
|
|
||||||
file += f'name: {building.name}\n'
|
|
||||||
file += f'year of construction: {building.year_of_construction}\n'
|
|
||||||
file += f'function: {building.function}\n'
|
|
||||||
file += f'floor area: {building.floor_area}\n'
|
|
||||||
if building.average_storey_height is not None and building.eave_height is not None:
|
|
||||||
file += f'storeys: {int(building.eave_height / building.average_storey_height)}\n'
|
|
||||||
else:
|
|
||||||
file += f'storeys: n/a\n'
|
|
||||||
file += f'volume: {building.volume}\n'
|
|
||||||
|
|
||||||
full_path_results = Path(self._path / 'demand.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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user