Skip to content

Conversation

@dallan-keylogic
Copy link
Contributor

Summary/Motivation:

Adds scaler object for the SLSeparator and tests the existing PressureChangerScaler on the Valve unit model.

Depends on #1688.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@dallan-keylogic dallan-keylogic changed the title SlSeperator and Valve Scaling SlSeparator and Valve Scaling Oct 29, 2025
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.39%. Comparing base (0c29d86) to head (7336d26).
⚠️ Report is 1 commits behind head on scaling_toolbox.

Files with missing lines Patch % Lines
...erties/modular_properties/base/generic_property.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           scaling_toolbox    #1693   +/-   ##
================================================
  Coverage            77.39%   77.39%           
================================================
  Files                  395      395           
  Lines                64581    64592   +11     
  Branches             10851    10851           
================================================
+ Hits                 49983    49993   +10     
- Misses               12092    12093    +1     
  Partials              2506     2506           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dallan-keylogic dallan-keylogic marked this pull request as ready for review October 30, 2025 13:38
from idaes.core.solvers import get_solver
from pyomo.util.check_units import assert_units_consistent, assert_units_equivalent

# from pyomo.util.check_units import assert_units_consistent, assert_units_equivalent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment on lines +302 to +313
# Unscaled
jac, _ = get_jacobian(valve_model, scaled=False)
assert (jacobian_cond(jac=jac, scaled=False)) == pytest.approx(
5.34657e5, rel=1e-3
)

# Scaled
sm = TransformationFactory("core.scale_model").create_using(
valve_model, rename=False
)
jac, _ = get_jacobian(sm, scaled=False)
assert (jacobian_cond(jac=jac, scaled=False)) == pytest.approx(27.270, rel=1e-3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, it might be nice wrap this in a helper function that just takes in (1) the model, (2) unscaled cond number, and (3) scaled cond number as required inputs. Tolerances for unscaled and scaled values could be optional, with default of 1e-3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I want to rework get_jacobian to have separate options for 1) applying user scaling factors and 2) performing IPOPT's gradient-based autoscaling. Then we won't even need to do the scaling transformation (which is slow).

Copy link
Contributor

@adam-a-a adam-a-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -just a commented import to delete and a comment to consider for the future.

Copy link

@Ryan-Hughes-8 Ryan-Hughes-8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dallan-keylogic dallan-keylogic merged commit 5b20e31 into IDAES:scaling_toolbox Oct 31, 2025
45 checks passed
@dallan-keylogic dallan-keylogic deleted the slseperator_scaler branch October 31, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants