From 453f50488270944dd5a3599ebf0df063fbf0fa2a Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Fri, 25 Oct 2024 18:07:55 +0200 Subject: [PATCH 1/3] Fix the name of the parameter --- src/tespy/components/heat_exchangers/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tespy/components/heat_exchangers/base.py b/src/tespy/components/heat_exchangers/base.py index 31a8445a..52651e07 100644 --- a/src/tespy/components/heat_exchangers/base.py +++ b/src/tespy/components/heat_exchangers/base.py @@ -769,7 +769,7 @@ def eff_cold_deriv(self, increment_filter, k): self.jacobian[k, c.h.J_col] = self.numeric_deriv(f, 'h', c) if self.is_variable(i2.h): - self.jacobian[k, i2.h.J_col] = 1 - self.eta_cold.val + self.jacobian[k, i2.h.J_col] = 1 - self.eff_cold.val def calc_dh_max_hot(self): r"""Calculate the theoretical maximum enthalpy decrease on the hot side @@ -828,7 +828,7 @@ def eff_hot_deriv(self, increment_filter, k): i2 = self.inl[1] if self.is_variable(i1.h): - self.jacobian[k, i1.h.J_col] = 1 - self.eta_hot.val + self.jacobian[k, i1.h.J_col] = 1 - self.eff_hot.val for c in [o1, i2]: if self.is_variable(c.p, increment_filter): From 3e1f4d9277944bf9a095ec8fea3a1fe0ba3d86cb Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Sun, 27 Oct 2024 21:02:15 +0100 Subject: [PATCH 2/3] Update What's New --- docs/whats_new/v0-7-7.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/whats_new/v0-7-7.rst b/docs/whats_new/v0-7-7.rst index 15d1269c..536a611c 100644 --- a/docs/whats_new/v0-7-7.rst +++ b/docs/whats_new/v0-7-7.rst @@ -7,7 +7,9 @@ Bug Fixes Furthermore, it is checked whether a file is represented by a class available in the namespace via the :code:`@component_registry` decorator (`PR #536 `__). - +- Fixed a typo in the Jacobian of the hot side and cold side + :code:`HeatExchanger` effectiveness + (`PR #563 `__). Other Changes ############# From 123230c403bf0eaf32ac3a2cc2cfdc28f5b4ca93 Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Sun, 27 Oct 2024 21:09:00 +0100 Subject: [PATCH 3/3] Test the fix --- tests/test_components/test_heat_exchangers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_components/test_heat_exchangers.py b/tests/test_components/test_heat_exchangers.py index b4479a2d..eee9b871 100644 --- a/tests/test_components/test_heat_exchangers.py +++ b/tests/test_components/test_heat_exchangers.py @@ -460,7 +460,10 @@ def test_HeatExchanger(self, tmp_path): ) assert round(instance.eff_cold.val, 1) == 0.9, msg - self.c3.set_attr(m=None) + self.c1.set_attr(p=None) + self.c2.set_attr(p=3) + self.c3.set_attr(m=None, p=None) + self.c4.set_attr(p=5) instance.set_attr(eff_max=None, eff_hot=0.9, eff_cold=0.9) self.nw.solve("design") self.nw._convergence_check()