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 ############# 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): 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()