From 1220e6fe36405c78075df8f41d034d56c2c9636d Mon Sep 17 00:00:00 2001 From: tolga-akan Date: Mon, 9 Feb 2026 14:06:04 +0100 Subject: [PATCH 1/2] heat transfer coefficient is read from discharge efficiency --- src/mesido/esdl/esdl_heat_model.py | 13 ++++++++++++- .../component_library/milp/heat/heat_buffer.py | 2 +- ...t_case_small_network_with_ates_buffer_geo.esdl | 2 +- tests/test_max_size_and_optional_assets.py | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/mesido/esdl/esdl_heat_model.py b/src/mesido/esdl/esdl_heat_model.py index 40b1f35a7..02cdb08aa 100644 --- a/src/mesido/esdl/esdl_heat_model.py +++ b/src/mesido/esdl/esdl_heat_model.py @@ -428,12 +428,23 @@ def convert_heat_buffer(self, asset: Asset) -> Tuple[Type[HeatBuffer], MODIFIERS else 10.0e6 ) + # Todo: Currently esdl does not have "heatTransferCoefficient" attribute for + # heat_buffer asset. Temporarily we are using "dischargeEfficiency" attribute + # of HeatStorage asset attribute in ESDL to define heat_transfer_coeff. + # Once, "heatTransferCoefficient" attribute is added into esdl, + # we can update this part. + heat_transfer_coeff = ( + asset.attributes.get("heatTransferCoefficient") + or asset.attributes.get("dischargeEfficiency") + or 1.0 + ) + q_nominal = self._get_connected_q_nominal(asset) modifiers = dict( height=r, radius=r, - heat_transfer_coeff=1.0, + heat_transfer_coeff=heat_transfer_coeff, min_fraction_tank_volume=min_fraction_tank_volume, Stored_heat=dict(min=min_heat, max=max_heat), Heat_buffer=dict(min=-hfr_discharge_max, max=hfr_charge_max), diff --git a/src/mesido/pycml/component_library/milp/heat/heat_buffer.py b/src/mesido/pycml/component_library/milp/heat/heat_buffer.py index d9b700876..69e69d675 100644 --- a/src/mesido/pycml/component_library/milp/heat/heat_buffer.py +++ b/src/mesido/pycml/component_library/milp/heat/heat_buffer.py @@ -32,7 +32,7 @@ def __init__(self, name, **modifiers): self.component_type = "heat_buffer" - self.heat_transfer_coeff = 1.0 + self.heat_transfer_coeff = nan self.height = 5.0 self.radius = 10.0 self.volume = math.pi * self.radius**2 * self.height diff --git a/tests/models/test_case_small_network_with_ates_buffer_geo/model/test_case_small_network_with_ates_buffer_geo.esdl b/tests/models/test_case_small_network_with_ates_buffer_geo/model/test_case_small_network_with_ates_buffer_geo.esdl index 10bb4d086..a41a0822f 100644 --- a/tests/models/test_case_small_network_with_ates_buffer_geo/model/test_case_small_network_with_ates_buffer_geo.esdl +++ b/tests/models/test_case_small_network_with_ates_buffer_geo/model/test_case_small_network_with_ates_buffer_geo.esdl @@ -401,7 +401,7 @@ - + diff --git a/tests/test_max_size_and_optional_assets.py b/tests/test_max_size_and_optional_assets.py index 01a263696..444150aef 100644 --- a/tests/test_max_size_and_optional_assets.py +++ b/tests/test_max_size_and_optional_assets.py @@ -30,6 +30,7 @@ def test_max_size_and_aggr_count(self): assets should not be placed by the optmizer because of heat losses. Checks: + - Check that heat_transfer_coeff can be read from esdl - Check that source 1 is utilized and also placed - Check that source 2 is utilized and placed - Check that the geothermal source is not placed @@ -60,6 +61,20 @@ def test_max_size_and_aggr_count(self): results = solution.extract_results() parameters = solution.parameters(0) + # Test that heat_transfer_coeff can be read from esdl + esdl_asset = solution.esdl_assets[solution.esdl_asset_name_to_id_map["HeatStorage_74c1"]] + try: + heat_transfer_coeff = esdl_asset.attributes["heatTransferCoefficient"] + except KeyError: + # Currently, "heatTransferCoefficient" attribute is not available in esdl. + # We are temporariliy using "dischargeEfficiency" attribute in esdl + # to define heat_transfer_coeff + heat_transfer_coeff = esdl_asset.attributes["dischargeEfficiency"] + + np.testing.assert_allclose( + parameters["HeatStorage_74c1.heat_transfer_coeff"], heat_transfer_coeff + ) + # Producer 1 and geothermal source should not produce due to higher cost # Producer 2 should produce heat_1 = results["HeatProducer_1.Heat_source"] From 2035f7faaffd3a438c150981d8462e7346b80484 Mon Sep 17 00:00:00 2001 From: tolga-akan Date: Mon, 9 Feb 2026 14:09:16 +0100 Subject: [PATCH 2/2] change log is updated --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d604ff29..569b08aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ -# [Unreleased-main] - 2026-02-05 +# [Unreleased-main] - 2026-02-09 ## Added -- xxx +- heat_transfer_coeff variable of HeatStorage is read from dischargeEfficiency attribute in esdl ## Changed - xxx