From 5316a01bebc7f8ba491e098ea7613876656b04f8 Mon Sep 17 00:00:00 2001 From: Bernard Knueven Date: Tue, 12 Dec 2023 15:21:07 -0700 Subject: [PATCH] return component instead of its name --- idaes/core/util/model_diagnostics.py | 2 +- .../core/util/tests/test_model_diagnostics.py | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/idaes/core/util/model_diagnostics.py b/idaes/core/util/model_diagnostics.py index 4df6e09fa8..2912c475ba 100644 --- a/idaes/core/util/model_diagnostics.py +++ b/idaes/core/util/model_diagnostics.py @@ -3356,7 +3356,7 @@ def b_rule(b, i): val = value(inf_prob.y[i]) if abs(val) < cutoff: break - ill_cond.append((components[i].name, val)) + ill_cond.append((components[i], val)) return ill_cond diff --git a/idaes/core/util/tests/test_model_diagnostics.py b/idaes/core/util/tests/test_model_diagnostics.py index 8022b15292..713f128562 100644 --- a/idaes/core/util/tests/test_model_diagnostics.py +++ b/idaes/core/util/tests/test_model_diagnostics.py @@ -3236,34 +3236,34 @@ def test_beta(self, model, caplog): @pytest.mark.solver def test_rows(self, model): assert check_ill_conditioning(model, direction="row") == [ - ("c4", pytest.approx(0.50000002, rel=1e-5)), - ("c1", pytest.approx(0.49999998, rel=1e-5)), + (model.c4, pytest.approx(0.50000002, rel=1e-5)), + (model.c4, pytest.approx(0.49999998, rel=1e-5)), ] @pytest.mark.component @pytest.mark.solver def test_rows(self, afiro): assert check_ill_conditioning(afiro, direction="row") == [ - ("R09", pytest.approx(0.5, rel=1e-5)), - ("R09b", pytest.approx(0.5, rel=1e-5)), + (afiro.R09, pytest.approx(0.5, rel=1e-5)), + (afiro.R09b, pytest.approx(0.5, rel=1e-5)), ] @pytest.mark.component @pytest.mark.solver def test_columns(self, afiro): assert check_ill_conditioning(afiro, direction="column") == [ - ("X39", pytest.approx(1.1955465, rel=1e-5)), - ("X23", pytest.approx(1.0668697, rel=1e-5)), - ("X25", pytest.approx(-1.0668697, rel=1e-5)), - ("X09", pytest.approx(-0.95897123, rel=1e-5)), - ("X13", pytest.approx(-0.95897123, rel=1e-5)), - ("X06", pytest.approx(0.91651956, rel=1e-5)), - ("X10", pytest.approx(0.91651956, rel=1e-5)), - ("X36", pytest.approx(0.76204977, rel=1e-5)), - ("X31", pytest.approx(-0.39674454, rel=1e-5)), - ("X35", pytest.approx(-0.39674454, rel=1e-5)), - ("X16", pytest.approx(0.14679548, rel=1e-5)), - ("X38", pytest.approx(-0.14679548, rel=1e-5)), - ("X15", pytest.approx(-0.042451666, rel=1e-5)), - ("X37", pytest.approx(-0.036752232, rel=1e-5)), + (afiro.X39, pytest.approx(1.1955465, rel=1e-5)), + (afiro.X23, pytest.approx(1.0668697, rel=1e-5)), + (afiro.X25, pytest.approx(-1.0668697, rel=1e-5)), + (afiro.X09, pytest.approx(-0.95897123, rel=1e-5)), + (afiro.X13, pytest.approx(-0.95897123, rel=1e-5)), + (afiro.X06, pytest.approx(0.91651956, rel=1e-5)), + (afiro.X10, pytest.approx(0.91651956, rel=1e-5)), + (afiro.X36, pytest.approx(0.76204977, rel=1e-5)), + (afiro.X31, pytest.approx(-0.39674454, rel=1e-5)), + (afiro.X35, pytest.approx(-0.39674454, rel=1e-5)), + (afiro.X16, pytest.approx(0.14679548, rel=1e-5)), + (afiro.X38, pytest.approx(-0.14679548, rel=1e-5)), + (afiro.X15, pytest.approx(-0.042451666, rel=1e-5)), + (afiro.X37, pytest.approx(-0.036752232, rel=1e-5)), ]