Commit a3cfa895 authored by Eric Duminil's avatar Eric Duminil
Browse files

With plot

parent 63ab5d0a
...@@ -2,6 +2,7 @@ from pathlib import Path ...@@ -2,6 +2,7 @@ from pathlib import Path
import shutil import shutil
from xml.etree import ElementTree as et from xml.etree import ElementTree as et
import pandas as pd import pandas as pd
import matplotlib.pyplot as plt
from run_simstadt_workflow import find_simstadt, SCRIPT_DIR, run_workflow from run_simstadt_workflow import find_simstadt, SCRIPT_DIR, run_workflow
...@@ -13,7 +14,7 @@ logging.getLogger().setLevel(logging.WARN) ...@@ -13,7 +14,7 @@ logging.getLogger().setLevel(logging.WARN)
SIMSTADT2_GLOB = 'Desktop/SimStadt2_0.*/' SIMSTADT2_GLOB = 'Desktop/SimStadt2_0.*/'
REPO_PATH = Path.home() / 'git' / 'simstadt2' / 'TestRepository' REPO_PATH = Path.home() / 'git' / 'simstadt2' / 'TestRepository'
PROJECT_NAME = 'Gruenbuehl' PROJECT_NAME = 'Gruenbuehl'
CITYGMLS = ['Gruenbuehl_LOD2_ALKIS_1010.gml'] CITYGML = 'Gruenbuehl_LOD2_ALKIS_1010.gml'
SURFACES = ['outWalls', 'pitchedRoof'] SURFACES = ['outWalls', 'pitchedRoof']
WINDOW_RATIOS = [0, 0.5, 1] WINDOW_RATIOS = [0, 0.5, 1]
# Heat demand, with custom BuildingPhysics # Heat demand, with custom BuildingPhysics
...@@ -79,25 +80,36 @@ def parse_results(window_ratio, heat_demand_csv): ...@@ -79,25 +80,36 @@ def parse_results(window_ratio, heat_demand_csv):
decimal=',' decimal=','
) )
heat_demand_MWh = df['Yearly Heating demand'].sum() / 1000 heating_demand_MWh = df['Yearly Heating demand'].sum() / 1000
cool_demand_MWh = df['Yearly Cooling demand'].sum() / 1000 cooling_demand_MWh = df['Yearly Cooling demand'].sum() / 1000
print(f"Window Ratio : {window_ratio * 100} %") print(f"Window Ratio : {window_ratio * 100} %")
print(f"Total heating demand : {heat_demand_MWh:.0f} MWh / a") print(f"Total heating demand : {heating_demand_MWh:.0f} MWh / a")
print(f"Total cooling demand : {cool_demand_MWh:.0f} MWh / a") print(f"Total cooling demand : {cooling_demand_MWh:.0f} MWh / a")
return {'WindowRatio': window_ratio,
'HeatingDemand': heating_demand_MWh,
'CoolingDemand': cooling_demand_MWh}
workflow_path, physics_processor_step = copy_workflow_from_template(TEMPLATE_NAME, PROJECT_PATH) workflow_path, physics_processor_step = copy_workflow_from_template(TEMPLATE_NAME, PROJECT_PATH)
custom_library_path = set_custom_library(physics_processor_step) custom_library_path = set_custom_library(physics_processor_step)
lib_tree = parse_library(custom_library_path) lib_tree = parse_library(custom_library_path)
all_results = []
for window_ratio in WINDOW_RATIOS: for window_ratio in WINDOW_RATIOS:
# TODO: Status quo too # TODO: Status quo too
set_custom_window_ratio(lib_tree, window_ratio, custom_library_path) set_custom_window_ratio(lib_tree, window_ratio, custom_library_path)
output_files = run_workflow(find_simstadt(SIMSTADT2_GLOB), workflow_path, CITYGMLS) output_files = run_workflow(find_simstadt(SIMSTADT2_GLOB), workflow_path, [CITYGML])
heat_demand_csv = next(file for file in output_files if 'HEATING_AND_COOLING.csv' in file.name) heat_demand_csv = next(file for file in output_files if 'HEATING_AND_COOLING.csv' in file.name)
################### Parse heat demand ######################## ################### Parse heat demand ########################
parse_results(window_ratio, heat_demand_csv) all_results.append(parse_results(window_ratio, heat_demand_csv))
df = pd.DataFrame(all_results).set_index('WindowRatio')
print(df)
df.plot()
plt.ylabel('MWh')
plt.title("Demands depending on Window Ratio")
plt.show()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment