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

Trying to run with different window ratios

parent 54fc986f
from pathlib import Path
import shutil
from xml.etree import ElementTree as et
import logging
import pandas as pd
import re
from run_simstadt_workflow import find_simstadt, SCRIPT_DIR, run_workflow
# logging.getLogger().setLevel(logging.WARN)
SIMSTADT2_GLOB = 'Desktop/SimStadt2_0.*/'
REPO_PATH = Path.home() / 'git' / 'simstadt2' / 'TestRepository'
PROJECT_NAME = 'Gruenbuehl'
......@@ -15,7 +19,7 @@ PARAMS = 'params.xml'
BUILDING_PHYSICS_LIBRARY = 'GermanBuildingTypologyLibrary_IWU.xml'
print(find_simstadt(SIMSTADT2_GLOB))
WINDOW_RATIOS = [0, 0.5, 1]
TEMPLATE_NAME = '99_HeatDemand'
......@@ -43,17 +47,36 @@ tree.write(physics_processor_params)
##########################################################
output_files = run_workflow(find_simstadt(SIMSTADT2_GLOB), workflow_path, CITYGMLS)
for window_ratio in WINDOW_RATIOS:
#################### Update lib with custom values ############################
with open(custom_library_path) as library_file:
content = library_file.read()
new_content = re.sub(r"<name>[\w ]+</name>",
f"<name>Custom Physics Library with Window Ratio : {window_ratio}</name>",
content,
1)
new_content = re.sub(r"<windowRatio>[\d\.]+</windowRatio>",
f"<windowRatio>{window_ratio}</windowRatio>",
content)
with open(custom_library_path, 'w') as library_file:
library_file.write(new_content)
#################################################################################
output_files = run_workflow(find_simstadt(SIMSTADT2_GLOB), workflow_path, CITYGMLS)
heat_demand_csv = next(file for file in output_files if 'HEATING.csv' in file.name)
heat_demand_csv = next(file for file in output_files if 'HEATING.csv' in file.name)
################### Parse heat demand ########################
################### Parse heat demand ########################
df = pd.read_csv(heat_demand_csv,
df = pd.read_csv(heat_demand_csv,
skiprows=list(range(19)) + [20],
sep=';',
decimal=','
)
heat_demand_MWh = df['Yearly Heating demand'].sum() / 1000
print(f"Total heat demand : {heat_demand_MWh:.0f} MWh / a")
heat_demand_MWh = df['Yearly Heating demand'].sum() / 1000
print(f"Window Ratio : {window_ratio * 100} %")
print(f"Total heat demand : {heat_demand_MWh:.0f} MWh / a")
Supports Markdown
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