feature: add converting to csv to simultaneity factor calculations
This commit is contained in:
parent
2a4dfb71c0
commit
a8adfb0282
36
main.py
36
main.py
|
@ -16,22 +16,22 @@ file_path = (Path(__file__).parent / 'input_files' / 'processed_output.geojson')
|
|||
output_path = (Path(__file__).parent / 'out_files').resolve()
|
||||
|
||||
# Create city object from GeoJSON file
|
||||
# city = GeometryFactory('geojson',
|
||||
# path=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
|
||||
#
|
||||
# # Enrich city data
|
||||
# ConstructionFactory('nrcan', city).enrich()
|
||||
# UsageFactory('nrcan', city).enrich()
|
||||
# WeatherFactory('epw', city).enrich()
|
||||
#
|
||||
# energy_plus_workflow(city)
|
||||
#
|
||||
# processor = DemandShiftProcessor(city)
|
||||
# processor.process_demands()
|
||||
city = GeometryFactory('geojson',
|
||||
path=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
|
||||
|
||||
# Enrich city data
|
||||
ConstructionFactory('nrcan', city).enrich()
|
||||
UsageFactory('nrcan', city).enrich()
|
||||
WeatherFactory('epw', city).enrich()
|
||||
|
||||
energy_plus_workflow(city)
|
||||
|
||||
processor = DemandShiftProcessor(city)
|
||||
processor.process_demands()
|
||||
|
||||
location = [45.436749057834206, -73.66282803816682]
|
||||
|
||||
|
@ -44,5 +44,5 @@ networkx_to_geojson(network_graph)
|
|||
|
||||
dhn_creator.plot_network_graph()
|
||||
|
||||
# print("Simultaneity Factor Heating:", city.simultaneity_factor_heating)
|
||||
# print("Simultaneity Factor Cooling:", city.simultaneity_factor_cooling)
|
||||
print("Simultaneity Factor Heating:", city.simultaneity_factor_heating)
|
||||
print("Simultaneity Factor Cooling:", city.simultaneity_factor_cooling)
|
|
@ -30,6 +30,9 @@ class DemandShiftProcessor:
|
|||
self.calculate_and_set_simultaneity_factor(combined_heating_df, 'heating')
|
||||
self.calculate_and_set_simultaneity_factor(combined_cooling_df, 'cooling')
|
||||
|
||||
self.save_demands_to_csv(combined_heating_df, 'heating_demands.csv')
|
||||
self.save_demands_to_csv(combined_cooling_df, 'cooling_demands.csv')
|
||||
|
||||
def convert_building_to_dataframe(self, building, demand_type):
|
||||
if demand_type == 'heating':
|
||||
data = {
|
||||
|
@ -78,3 +81,6 @@ class DemandShiftProcessor:
|
|||
self.city.simultaneity_factor_heating = peak_total_demand_original / sum_individual_peak_demands
|
||||
else: # cooling
|
||||
self.city.simultaneity_factor_cooling = peak_total_demand_original / sum_individual_peak_demands
|
||||
|
||||
def save_demands_to_csv(self, df, filename):
|
||||
df.to_csv(filename)
|
||||
|
|
Loading…
Reference in New Issue
Block a user