optimization #17
|
@ -92,9 +92,8 @@ for building in city.buildings:
|
|||
fuel_tariffs=['Electricity-D', 'Gas-Energir']).life_cycle
|
||||
lcc_dataframe.to_csv(cost_analysis_output_path / f'{building.name}_retrofitted_lcc.csv')
|
||||
retrofitted_life_cycle_cost[f'{building.name}'] = cost_data(building, lcc_dataframe, cost_retrofit_scenario)
|
||||
for i in range(12):
|
||||
dhw_consumption = 0
|
||||
for building in city.buildings:
|
||||
dhw_consumption += building.domestic_hot_water_consumption[cte.MONTH][i] / 3.6e6
|
||||
EnergySystemRetrofitReport(city, output_path, 'PV Implementation and System Retrofit',
|
||||
current_status_energy_consumption, retrofitted_energy_consumption,
|
||||
current_status_life_cycle_cost, retrofitted_life_cycle_cost).create_report()
|
||||
|
||||
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
-73.58000127109773,
|
||||
45.49613461675315
|
||||
],
|
||||
[
|
||||
-73.57962787855432,
|
||||
45.496524875557746
|
||||
],
|
||||
[
|
||||
-73.57996357265695,
|
||||
45.49668114195629
|
||||
],
|
||||
[
|
||||
-73.57996427397713,
|
||||
45.496680342403664
|
||||
],
|
||||
[
|
||||
-73.58034707390021,
|
||||
45.49625804233725
|
||||
],
|
||||
[
|
||||
-73.58034697395713,
|
||||
45.496257942524835
|
||||
],
|
||||
[
|
||||
-73.58000127109773,
|
||||
45.49613461675315
|
||||
]
|
||||
]
|
||||
]
|
||||
},
|
||||
"id": 179764,
|
||||
"properties": {
|
||||
"name": "01119274",
|
||||
"address": "rue Guy (MTL) 2157",
|
||||
"function": "Mixed use",
|
||||
"mixed_type_1": "commercial",
|
||||
"mixed_type_1_percentage": 50,
|
||||
"mixed_type_2": "6000",
|
||||
"mixed_type_2_percentage": 50,
|
||||
"height": 62,
|
||||
"year_of_construction": 1954
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
-73.58000127109773,
|
||||
45.49613461675315
|
||||
],
|
||||
[
|
||||
-73.57962787855432,
|
||||
45.496524875557746
|
||||
],
|
||||
[
|
||||
-73.57996357265695,
|
||||
45.49668114195629
|
||||
],
|
||||
[
|
||||
-73.57996427397713,
|
||||
45.496680342403664
|
||||
],
|
||||
[
|
||||
-73.58034707390021,
|
||||
45.49625804233725
|
||||
],
|
||||
[
|
||||
-73.58034697395713,
|
||||
45.496257942524835
|
||||
],
|
||||
[
|
||||
-73.58000127109773,
|
||||
45.49613461675315
|
||||
]
|
||||
]
|
||||
]
|
||||
},
|
||||
"id": 179764,
|
||||
"properties": {
|
||||
"name": "01119274",
|
||||
"address": "rue Guy (MTL) 2157",
|
||||
"function": "Mixed use",
|
||||
"usages": [{"usage": "commercial", "percentage": 50}, {"usage": "6000", "percentage": 50}],
|
||||
"height": 62,
|
||||
"year_of_construction": 1954
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
8
main.py
8
main.py
|
@ -27,8 +27,8 @@ import numpy as np
|
|||
data = {}
|
||||
input_files_path = (Path(__file__).parent / 'input_files')
|
||||
input_files_path.mkdir(parents=True, exist_ok=True)
|
||||
# geojson_file = process_geojson(x=-73.58001358793511, y=45.496445294438715, diff=0.0001)
|
||||
geojson_file_path = input_files_path / 'test_geojson1.geojson'
|
||||
geojson_file = process_geojson(x=-73.58001358793511, y=45.496445294438715, diff=0.0001)
|
||||
geojson_file_path = input_files_path / 'output_buildings.geojson'
|
||||
output_path = (Path(__file__).parent / 'out_files').resolve()
|
||||
output_path.mkdir(parents=True, exist_ok=True)
|
||||
energy_plus_output_path = output_path / 'energy_plus_outputs'
|
||||
|
@ -45,8 +45,8 @@ city = GeometryFactory(file_type='geojson',
|
|||
year_of_construction_field='year_of_construction',
|
||||
function_field='function',
|
||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
||||
# ConstructionFactory('nrcan', city).enrich()
|
||||
# UsageFactory('nrcan', city).enrich()
|
||||
ConstructionFactory('nrcan', city).enrich()
|
||||
UsageFactory('nrcan', city).enrich()
|
||||
# WeatherFactory('epw', city).enrich()
|
||||
# energy_plus_workflow(city, energy_plus_output_path)
|
||||
# data[f'{city.buildings[0].function}'] = city.buildings[0].heating_demand[cte.YEAR][0] / 3.6e9
|
||||
|
|
26
scripts/optimization/energy_system_sizing_optimization.py
Normal file
26
scripts/optimization/energy_system_sizing_optimization.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import random
|
||||
import numpy as np
|
||||
import hub.helpers.constants as cte
|
||||
|
||||
class EnergySystemOptimizer:
|
||||
def __init__(self, building, objectives, population_size=20, number_of_generations=100, crossover_rate=0.8,
|
||||
mutation_rate=0.1):
|
||||
self.building = building
|
||||
self.objectives = objectives
|
||||
self.population_size = population_size
|
||||
self.num_gen = number_of_generations
|
||||
self.crossover_rate = crossover_rate
|
||||
self.mutation_rate = mutation_rate
|
||||
|
||||
# Initialize population
|
||||
def initialize_population(self):
|
||||
population = []
|
||||
for _ in range(self.population_size):
|
||||
individual = [
|
||||
random.uniform(0.1, 10.0), # hp_size
|
||||
random.uniform(0.1, 10.0), # boiler_size
|
||||
random.uniform(0.1, 10.0), # tes_size
|
||||
random.uniform(40, 60) # cutoff_temp
|
||||
]
|
||||
population.append(individual)
|
||||
return population
|
16
scripts/optimization/objectives.py
Normal file
16
scripts/optimization/objectives.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Objective functions
|
||||
MINIMUM_LCC = 1
|
||||
MINIMUM_EC = 2
|
||||
MINIMUM_EMISSIONS = 3
|
||||
MINIMUM_LCC_MINIMUM_EC = 4
|
||||
MINIMUM_LCC_MINIMUM_EMISSIONS = 5
|
||||
MINIMUM_EC_MINIMUM_EMISSIONS = 6
|
||||
MINIMUM_LCC_MINIMUM_EC_MINIMUM_EMISSIONS = 7
|
||||
OBJECTIVE_FUNCTIONS = [MINIMUM_LCC,
|
||||
MINIMUM_EC,
|
||||
MINIMUM_EMISSIONS,
|
||||
MINIMUM_LCC_MINIMUM_EC,
|
||||
MINIMUM_LCC_MINIMUM_EMISSIONS,
|
||||
MINIMUM_EC_MINIMUM_EMISSIONS,
|
||||
MINIMUM_LCC_MINIMUM_EC_MINIMUM_EMISSIONS]
|
||||
|
|
@ -28,8 +28,8 @@ residential_systems_percentage = {'system 1 gas': 15,
|
|||
'system 8 gas': 15,
|
||||
'system 8 electricity': 35}
|
||||
|
||||
residential_new_systems_percentage = {'PV+ASHP+GasBoiler+TES': 100,
|
||||
'PV+4Pipe+DHW': 0,
|
||||
residential_new_systems_percentage = {'PV+ASHP+GasBoiler+TES': 0,
|
||||
'PV+4Pipe+DHW': 100,
|
||||
'PV+ASHP+ElectricBoiler+TES': 0,
|
||||
'PV+GSHP+GasBoiler+TES': 0,
|
||||
'PV+GSHP+ElectricBoiler+TES': 0,
|
||||
|
|
|
@ -16,7 +16,8 @@ class Archetype1:
|
|||
self._domestic_hot_water_peak_load = building.domestic_hot_water_peak_load[cte.YEAR][0]
|
||||
self._hourly_heating_demand = [0] + [demand / 3600 for demand in building.heating_demand[cte.HOUR]]
|
||||
self._hourly_cooling_demand = [demand / 3600 for demand in building.cooling_demand[cte.HOUR]]
|
||||
self._hourly_dhw_demand = building.domestic_hot_water_heat_demand[cte.HOUR]
|
||||
self._hourly_dhw_demand = [demand / cte.WATTS_HOUR_TO_JULES for demand in
|
||||
building.domestic_hot_water_heat_demand[cte.HOUR]]
|
||||
self._output_path = output_path
|
||||
self._t_out = [0] + building.external_temperature[cte.HOUR]
|
||||
self.results = {}
|
||||
|
@ -27,9 +28,9 @@ class Archetype1:
|
|||
heat_pump = self._hvac_system.generation_systems[0]
|
||||
boiler = self._hvac_system.generation_systems[1]
|
||||
thermal_storage = heat_pump.energy_storage_systems[0]
|
||||
heat_pump.nominal_heat_output = round(0.5 * self._heating_peak_load / 3600)
|
||||
heat_pump.nominal_cooling_output = round(self._cooling_peak_load / 3600)
|
||||
boiler.nominal_heat_output = round(0.5 * self._heating_peak_load / 3600)
|
||||
heat_pump.nominal_heat_output = round(0.5 * self._heating_peak_load)
|
||||
heat_pump.nominal_cooling_output = round(self._cooling_peak_load)
|
||||
boiler.nominal_heat_output = round(0.5 * self._heating_peak_load)
|
||||
thermal_storage.volume = round(
|
||||
(self._heating_peak_load * storage_factor * cte.WATTS_HOUR_TO_JULES) /
|
||||
(cte.WATER_HEAT_CAPACITY * cte.WATER_DENSITY * 25))
|
||||
|
|
|
@ -5,7 +5,7 @@ from hub.helpers.monthly_values import MonthlyValues
|
|||
|
||||
|
||||
class Archetype13:
|
||||
def __init__(self, building, output_path):
|
||||
def __init__(self, building, output_path, csv_output=True,):
|
||||
self._building = building
|
||||
self._name = building.name
|
||||
self._pv_system = building.energy_systems[0]
|
||||
|
@ -25,6 +25,7 @@ class Archetype13:
|
|||
self._t_out = building.external_temperature[cte.HOUR]
|
||||
self.results = {}
|
||||
self.dt = 900
|
||||
self.csv_output = csv_output
|
||||
|
||||
def hvac_sizing(self):
|
||||
storage_factor = 3
|
||||
|
@ -374,10 +375,11 @@ class Archetype13:
|
|||
MonthlyValues.get_total_month(self._building.domestic_hot_water_consumption[cte.HOUR]))
|
||||
self._building.domestic_hot_water_consumption[cte.YEAR] = [
|
||||
sum(self._building.domestic_hot_water_consumption[cte.MONTH])]
|
||||
file_name = f'energy_system_simulation_results_{self._name}.csv'
|
||||
with open(self._output_path / file_name, 'w', newline='') as csvfile:
|
||||
output_file = csv.writer(csvfile)
|
||||
# Write header
|
||||
output_file.writerow(self.results.keys())
|
||||
# Write data
|
||||
output_file.writerows(zip(*self.results.values()))
|
||||
if self.csv_output:
|
||||
file_name = f'energy_system_simulation_results_{self._name}.csv'
|
||||
with open(self._output_path / file_name, 'w', newline='') as csvfile:
|
||||
output_file = csv.writer(csvfile)
|
||||
# Write header
|
||||
output_file.writerow(self.results.keys())
|
||||
# Write data
|
||||
output_file.writerows(zip(*self.results.values()))
|
||||
|
|
Loading…
Reference in New Issue
Block a user