From 8aa838429192f35398b507cb422577f2d0529f8f Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 25 Jan 2024 13:18:16 -0700 Subject: [PATCH 1/5] downselect geojson to only include buildings from sys-params file --- thermalnetwork/network.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/thermalnetwork/network.py b/thermalnetwork/network.py index 7043bae..236720e 100644 --- a/thermalnetwork/network.py +++ b/thermalnetwork/network.py @@ -512,6 +512,24 @@ def run_sizer_from_cli_worker( system_parameters_data = json.loads(system_parameter_path.read_text()) # print(f"system_parameters_data: {system_parameters_data}") + # List the building ids from the system parameters file + building_id_list = [] + for building in system_parameters_data["buildings"]: + building_id_list.append(building["geojson_id"]) + + # Select the buildings in the geojson that are in the system parameters file + building_features = [ + feature + for feature in geojson_data["features"] + if feature["properties"]["type"] == "Building" and feature["properties"]["id"] in building_id_list + ] + + # Rebuild the geojson data using only the buildings in the system parameters file + geojson_data["features"] = [ + feature for feature in geojson_data["features"] if feature["properties"]["type"] != "Building" + ] + geojson_data["features"].extend(building_features) + # load all input data version: int = system_parameters_data["district_system"]["fifth_generation"]["ghe_parameters"]["version"] if version != VERSION: From a24d379789a51435e104e97e3c531989a4e7b37d Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 29 Feb 2024 08:32:21 -0700 Subject: [PATCH 2/5] update GHED & ruff versions --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c5145ad..6067c0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: # - id: check-hooks-apply # Fails if a hook doesn't apply to any file # Run the Ruff linter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.3.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -34,6 +34,6 @@ repos: # Run the Ruff formatter # https://docs.astral.sh/ruff/integrations/#pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.3.0 hooks: - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 8ac8b95..f275e6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ ] dependencies = [ 'click ~= 8.1', - 'ghedesigner ~= 1.3', + 'ghedesigner ~= 1.4', 'pandas ~= 2.1', "rich ~= 13.6", ] @@ -40,7 +40,7 @@ dev = [ "pytest >= 6.0", "pytest-cov ~= 4.1", "pre-commit ~= 3.5", - "ruff ~= 0.1", + "ruff ~= 0.3", "jupyterlab ~= 4.0", ] From 08b718385880735c81d4a8c0d368b23c277aaac7 Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 29 Feb 2024 08:47:37 -0700 Subject: [PATCH 3/5] use new continue_if_design_unmet parameter of GHED --- thermalnetwork/ground_heat_exchanger.py | 1 + 1 file changed, 1 insertion(+) diff --git a/thermalnetwork/ground_heat_exchanger.py b/thermalnetwork/ground_heat_exchanger.py index f8183c6..4ec8c9c 100644 --- a/thermalnetwork/ground_heat_exchanger.py +++ b/thermalnetwork/ground_heat_exchanger.py @@ -55,6 +55,7 @@ def ghe_size(self, total_space_loads, output_path: Path) -> float: min_eft=self.json_data["design"]["min_eft"], max_height=self.json_data["geometric_constraints"]["max_height"], min_height=self.json_data["geometric_constraints"]["min_height"], + continue_if_design_unmet=True, ) ghe.set_ground_loads_from_hourly_list(self.json_data["loads"]["ground_loads"]) ghe.set_geometry_constraints_rectangle( From 3bde3fa2a3052143ff4ff6a98aca1344a55aa5ec Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 29 Feb 2024 09:43:20 -0700 Subject: [PATCH 4/5] add more comments to building downselect code --- thermalnetwork/network.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/thermalnetwork/network.py b/thermalnetwork/network.py index b1d3460..b3b7458 100644 --- a/thermalnetwork/network.py +++ b/thermalnetwork/network.py @@ -510,7 +510,8 @@ def run_sizer_from_cli_worker( return 1 system_parameters_data = json.loads(system_parameter_path.read_text()) - # print(f"system_parameters_data: {system_parameters_data}") + + # Downselect the buildings in the geojson that are in the system parameters file # List the building ids from the system parameters file building_id_list = [] @@ -525,9 +526,12 @@ def run_sizer_from_cli_worker( ] # Rebuild the geojson data using only the buildings in the system parameters file + # Put in everything that isn't a building geojson_data["features"] = [ feature for feature in geojson_data["features"] if feature["properties"]["type"] != "Building" ] + # Only add the buildings in the system parameters file back to the geojson data + # This has the effect of removing buildings that are not in the system parameters file geojson_data["features"].extend(building_features) # load all input data From 7b723abe9613e073ce47c179d44cfe69a26d8a73 Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 29 Feb 2024 10:02:53 -0700 Subject: [PATCH 5/5] point test sys-param file to the test buildings that exist --- .../run/baseline_scenario/ghe_dir/sys_params.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/sdk_output_skeleton_1_ghe/run/baseline_scenario/ghe_dir/sys_params.json b/demos/sdk_output_skeleton_1_ghe/run/baseline_scenario/ghe_dir/sys_params.json index 3e867a1..77e45c1 100644 --- a/demos/sdk_output_skeleton_1_ghe/run/baseline_scenario/ghe_dir/sys_params.json +++ b/demos/sdk_output_skeleton_1_ghe/run/baseline_scenario/ghe_dir/sys_params.json @@ -1,7 +1,7 @@ { "buildings": [ { - "geojson_id": "2", + "geojson_id": "8", "load_model": "time_series", "load_model_parameters": { "time_series": { @@ -43,7 +43,7 @@ } }, { - "geojson_id": "5", + "geojson_id": "9", "load_model": "time_series", "load_model_parameters": { "time_series": {