feat: action plan code added
This commit is contained in:
parent
a143100b39
commit
f48f118443
@ -28,12 +28,12 @@ class ArchetypeCluster1:
|
||||
|
||||
def heating_system_simulation(self):
|
||||
building_heating_hourly_consumption = []
|
||||
boiler = self.building.energy_systems[1].generation_systems[0]
|
||||
hp = self.building.energy_systems[1].generation_systems[1]
|
||||
tes = self.building.energy_systems[1].generation_systems[0].energy_storage_systems[0]
|
||||
boiler = self.building.energy_systems[0].generation_systems[0]
|
||||
hp = self.building.energy_systems[0].generation_systems[1]
|
||||
tes = self.building.energy_systems[0].generation_systems[0].energy_storage_systems[0]
|
||||
heating_demand_joules = self.building.heating_demand[cte.HOUR]
|
||||
heating_peak_load_watts = self.building.heating_peak_load[cte.YEAR][0]
|
||||
upper_limit_tes_heating = 55
|
||||
upper_limit_tes_heating = 45
|
||||
outdoor_temperature = self.building.external_temperature[cte.HOUR]
|
||||
results = HeatPumpBoilerTesHeating(hp=hp,
|
||||
boiler=boiler,
|
||||
@ -55,7 +55,7 @@ class ArchetypeCluster1:
|
||||
return results, building_heating_hourly_consumption
|
||||
|
||||
def cooling_system_simulation(self):
|
||||
hp = self.building.energy_systems[2].generation_systems[0]
|
||||
hp = self.building.energy_systems[1].generation_systems[0]
|
||||
cooling_demand_joules = self.building.cooling_demand[cte.HOUR]
|
||||
cooling_peak_load = self.building.cooling_peak_load[cte.YEAR][0]
|
||||
cutoff_temperature = 11
|
||||
|
@ -62,41 +62,54 @@ class HeatPumpBoilerTesHeating:
|
||||
ambient_temperature=t_out[i],
|
||||
dt=self.dt)
|
||||
# hp operation
|
||||
if t_tank[i + 1] < 40:
|
||||
q_hp[i + 1] = hp.nominal_heat_output
|
||||
m_ch[i + 1] = q_hp[i + 1] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
|
||||
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t_tank[i + 1]
|
||||
elif 40 <= t_tank[i + 1] < self.upper_limit_tes and q_hp[i] == 0:
|
||||
q_hp[i + 1] = 0
|
||||
m_ch[i + 1] = 0
|
||||
t_sup_hp[i + 1] = t_tank[i + 1]
|
||||
elif 40 <= t_tank[i + 1] < self.upper_limit_tes and q_hp[i] > 0:
|
||||
q_hp[i + 1] = hp.nominal_heat_output
|
||||
m_ch[i + 1] = q_hp[i + 1] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
|
||||
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t_tank[i + 1]
|
||||
else:
|
||||
q_hp[i + 1], m_ch[i + 1], t_sup_hp[i + 1] = 0, 0, t_tank[i + 1]
|
||||
if q_hp[i + 1] > 0:
|
||||
if hp.source_medium == cte.AIR and self.hp.supply_medium == cte.WATER:
|
||||
hp_cop[i + 1] = self.hp_characteristics.air_to_water_cop(source_temperature[i + 1], t_tank[i + 1], mode=cte.HEATING)
|
||||
hp_electricity[i + 1] = q_hp[i + 1] / hp_cop[i + 1]
|
||||
else:
|
||||
hp_cop[i + 1] = 0
|
||||
hp_electricity[i + 1] = 0
|
||||
# boiler operation
|
||||
if q_hp[i + 1] > 0:
|
||||
if t_sup_hp[i + 1] < 45:
|
||||
q_boiler[i + 1] = boiler.nominal_heat_output
|
||||
elif demand[i + 1] > 0.5 * self.heating_peak_load / self.dt:
|
||||
q_boiler[i + 1] = 0.5 * boiler.nominal_heat_output
|
||||
boiler_energy_consumption[i + 1] = q_boiler[i + 1] / float(boiler.heat_efficiency)
|
||||
if boiler.fuel_type == cte.ELECTRICITY:
|
||||
boiler_fuel_consumption[i + 1] = boiler_energy_consumption[i + 1]
|
||||
if t_out[i + 1] > -20:
|
||||
if t_tank[i + 1] < 40:
|
||||
q_hp[i + 1] = hp.nominal_heat_output
|
||||
m_ch[i + 1] = q_hp[i + 1] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
|
||||
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t_tank[i + 1]
|
||||
elif 40 <= t_tank[i + 1] < self.upper_limit_tes and q_hp[i] == 0:
|
||||
q_hp[i + 1] = 0
|
||||
m_ch[i + 1] = 0
|
||||
t_sup_hp[i + 1] = t_tank[i + 1]
|
||||
elif 40 <= t_tank[i + 1] < self.upper_limit_tes and q_hp[i] > 0:
|
||||
q_hp[i + 1] = hp.nominal_heat_output
|
||||
m_ch[i + 1] = q_hp[i + 1] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
|
||||
t_sup_hp[i + 1] = (q_hp[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY)) + t_tank[i + 1]
|
||||
else:
|
||||
# TODO: Other fuels should be considered
|
||||
boiler_fuel_consumption[i + 1] = (q_boiler[i + 1] * self.dt) / (
|
||||
float(boiler.heat_efficiency) * cte.NATURAL_GAS_LHV)
|
||||
q_hp[i + 1], m_ch[i + 1], t_sup_hp[i + 1] = 0, 0, t_tank[i + 1]
|
||||
if q_hp[i + 1] > 0:
|
||||
if hp.source_medium == cte.AIR and self.hp.supply_medium == cte.WATER:
|
||||
hp_cop[i + 1] = self.hp_characteristics.air_to_water_cop(source_temperature[i + 1], t_tank[i + 1], mode=cte.HEATING)
|
||||
hp_electricity[i + 1] = q_hp[i + 1] / hp_cop[i + 1]
|
||||
else:
|
||||
hp_cop[i + 1] = 0
|
||||
hp_electricity[i + 1] = 0
|
||||
else:
|
||||
q_hp[i + 1] = 0
|
||||
t_sup_hp[i + 1] = t_tank[i + 1]
|
||||
if t_tank[i + 1] < 40:
|
||||
q_boiler[i + 1] = boiler.nominal_heat_output
|
||||
m_ch[i + 1] = q_boiler[i + 1] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
|
||||
elif 40 <= t_tank[i + 1] < self.upper_limit_tes and q_boiler[i] == 0:
|
||||
q_boiler[i + 1] = 0
|
||||
m_ch[i + 1] = 0
|
||||
elif 40 <= t_tank[i + 1] < self.upper_limit_tes and q_boiler[i] > 0:
|
||||
q_boiler[i + 1] = boiler.nominal_heat_output
|
||||
m_ch[i + 1] = q_boiler[i + 1] / (cte.WATER_HEAT_CAPACITY * hp_delta_t)
|
||||
else:
|
||||
q_boiler[i + 1], m_ch[i + 1] = 0, 0
|
||||
|
||||
boiler_energy_consumption[i + 1] = q_boiler[i + 1] / float(boiler.heat_efficiency)
|
||||
if boiler.fuel_type == cte.ELECTRICITY:
|
||||
boiler_fuel_consumption[i + 1] = boiler_energy_consumption[i + 1]
|
||||
else:
|
||||
# TODO: Other fuels should be considered
|
||||
boiler_fuel_consumption[i + 1] = (q_boiler[i + 1] * self.dt) / (
|
||||
float(boiler.heat_efficiency) * cte.NATURAL_GAS_LHV)
|
||||
if m_ch[i + 1] > 0:
|
||||
t_sup_boiler[i + 1] = t_sup_hp[i + 1] + (q_boiler[i + 1] / (m_ch[i + 1] * cte.WATER_HEAT_CAPACITY))
|
||||
else:
|
||||
t_sup_boiler[i + 1] = t_sup_hp[i + 1]
|
||||
# heating coil operation
|
||||
if t_tank[i + 1] < 35:
|
||||
q_coil[i + 1] = heating_coil_nominal_output
|
||||
|
@ -78,7 +78,7 @@ class PeakLoadSizing:
|
||||
generation_system.nominal_cooling_output = design_load
|
||||
else:
|
||||
if demand_type == cte.HEATING or demand_type == cte.DOMESTIC_HOT_WATER:
|
||||
generation_system.nominal_heat_output = round(((1 - default_primary_unit_percentage) * design_load /
|
||||
generation_system.nominal_heat_output = round((default_primary_unit_percentage * design_load /
|
||||
(len(energy_system.generation_systems) - 1)))
|
||||
elif demand_type == cte.COOLING and cooling_equipments_number > 1:
|
||||
generation_system.nominal_cooling_output = round(((1 - default_primary_unit_percentage) * design_load /
|
||||
|
@ -650,7 +650,7 @@
|
||||
<nominal_heat_output/>
|
||||
<minimum_heat_output/>
|
||||
<maximum_heat_output/>
|
||||
<heat_efficiency>0.95</heat_efficiency>
|
||||
<heat_efficiency>1</heat_efficiency>
|
||||
<reversible>False</reversible>
|
||||
<fuel_type>electricity</fuel_type>
|
||||
<source_medium/>
|
||||
|
8761
input_files/cbt_data.csv
Normal file
8761
input_files/cbt_data.csv
Normal file
File diff suppressed because it is too large
Load Diff
95
input_files/rf_building.geojson
Normal file
95
input_files/rf_building.geojson
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
-73.64073884959656,
|
||||
45.45877247795022
|
||||
],
|
||||
[
|
||||
-73.64086100464694,
|
||||
45.45862178887526
|
||||
],
|
||||
[
|
||||
-73.64105216087044,
|
||||
45.45869645702069
|
||||
],
|
||||
[
|
||||
-73.64104414833393,
|
||||
45.45871090890856
|
||||
],
|
||||
[
|
||||
-73.64114029876905,
|
||||
45.45874864437542
|
||||
],
|
||||
[
|
||||
-73.64131199597576,
|
||||
45.45853026004602
|
||||
],
|
||||
[
|
||||
-73.6412181348363,
|
||||
45.45849413020409
|
||||
],
|
||||
[
|
||||
-73.64123314695125,
|
||||
45.45847517640908
|
||||
],
|
||||
[
|
||||
-73.64113756981872,
|
||||
45.45843937477906
|
||||
],
|
||||
[
|
||||
-73.64119661747132,
|
||||
45.45836250649597
|
||||
],
|
||||
[
|
||||
-73.64108252539663,
|
||||
45.45831757886663
|
||||
],
|
||||
[
|
||||
-73.64101346966737,
|
||||
45.45840252013562
|
||||
],
|
||||
[
|
||||
-73.6408593452855,
|
||||
45.45834214866821
|
||||
],
|
||||
[
|
||||
-73.64078214107344,
|
||||
45.458449110498606
|
||||
],
|
||||
[
|
||||
-73.64076509395674,
|
||||
45.458468507887375
|
||||
],
|
||||
[
|
||||
-73.64088276379393,
|
||||
45.45851271533863
|
||||
],
|
||||
[
|
||||
-73.64069790898249,
|
||||
45.4587603867237
|
||||
],
|
||||
[
|
||||
-73.64073884959656,
|
||||
45.45877247795022
|
||||
]
|
||||
]
|
||||
]
|
||||
},
|
||||
"id": 200054,
|
||||
"properties": {
|
||||
"name": "03065114",
|
||||
"address": "rue Sherbrooke Ouest (MTL+MTO+WMT) 7141",
|
||||
"function": "6821",
|
||||
"height": 8,
|
||||
"year_of_construction": 1916
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
59
loyola.py
Normal file
59
loyola.py
Normal file
@ -0,0 +1,59 @@
|
||||
from pathlib import Path
|
||||
|
||||
from energy_system_modelling_package.energy_system_modelling_factories.energy_system_sizing_factory import \
|
||||
EnergySystemsSizingFactory
|
||||
from energy_system_modelling_package.energy_system_modelling_factories.montreal_energy_system_archetype_modelling_factory import \
|
||||
MontrealEnergySystemArchetypesSimulationFactory
|
||||
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
||||
from hub.imports.geometry_factory import GeometryFactory
|
||||
from hub.helpers.dictionaries import Dictionaries
|
||||
from hub.imports.construction_factory import ConstructionFactory
|
||||
from hub.imports.usage_factory import UsageFactory
|
||||
from hub.imports.weather_factory import WeatherFactory
|
||||
import pandas as pd
|
||||
import hub.helpers.constants as cte
|
||||
from costing_package.constants import *
|
||||
from costing_package.cost import Cost
|
||||
# Specify the GeoJSON file path
|
||||
input_files_path = (Path(__file__).parent / 'input_files')
|
||||
input_files_path.mkdir(parents=True, exist_ok=True)
|
||||
geojson_file_path = input_files_path / 'rf_building.geojson'
|
||||
output_path = (Path(__file__).parent / 'out_files').resolve()
|
||||
output_path.mkdir(parents=True, exist_ok=True)
|
||||
simulation_results_path = (Path(__file__).parent / 'out_files' / 'simulation_results').resolve()
|
||||
simulation_results_path.mkdir(parents=True, exist_ok=True)
|
||||
cost_analysis_output_path = output_path / 'cost_analysis'
|
||||
cost_analysis_output_path.mkdir(parents=True, exist_ok=True)
|
||||
city = GeometryFactory(file_type='geojson',
|
||||
path=geojson_file_path,
|
||||
height_field='height',
|
||||
year_of_construction_field='year_of_construction',
|
||||
function_field='function',
|
||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
||||
demands = pd.read_csv(input_files_path / 'cbt_data.csv')
|
||||
city.buildings[0].heating_demand[cte.HOUR] = [x * cte.WATTS_HOUR_TO_JULES * 1000 / 4 for x in demands['total'].to_list()]
|
||||
city.buildings[0].cooling_demand[cte.HOUR] = [0] * 8760
|
||||
city.buildings[0].domestic_hot_water_heat_demand[cte.HOUR] = [0] * 8760
|
||||
city.buildings[0].lighting_electrical_demand[cte.HOUR] = [0] * 8760
|
||||
city.buildings[0].lighting_electrical_demand[cte.YEAR] = [0]
|
||||
city.buildings[0].appliances_electrical_demand[cte.YEAR] = [0]
|
||||
city.buildings[0].appliances_electrical_demand[cte.HOUR] = [0] * 8760
|
||||
ConstructionFactory('nrcan', city).enrich()
|
||||
UsageFactory('nrcan', city).enrich()
|
||||
WeatherFactory('epw', city).enrich()
|
||||
for building in city.buildings:
|
||||
building.energy_systems_archetype_name = ('Central Hydronic Air and Electricity Source Heating System with Unitary '
|
||||
'Split and Air Source HP DHW')
|
||||
EnergySystemsFactory('montreal_future', city).enrich()
|
||||
EnergySystemsSizingFactory('peak_load_sizing', city).enrich()
|
||||
for building in city.buildings:
|
||||
MontrealEnergySystemArchetypesSimulationFactory(f'archetype_cluster_{building.energy_systems_archetype_cluster_id}',
|
||||
building,
|
||||
simulation_results_path).enrich()
|
||||
for building in city.buildings:
|
||||
cost_retrofit_scenario = SYSTEM_RETROFIT
|
||||
lcc_dataframe = Cost(building=building,
|
||||
retrofit_scenario=cost_retrofit_scenario,
|
||||
fuel_tariffs=['Electricity-D', 'Gas-Energir']).life_cycle
|
||||
lcc_dataframe.to_csv(cost_analysis_output_path / f'{building.name}_retrofitted_lcc.csv')
|
||||
print('test')
|
Loading…
Reference in New Issue
Block a user