Skip to content

Conversation

@MarcusHolly
Copy link
Contributor

Summary/Motivation:

Addresses a comment made here to add the smooth_heaviside function into IDAES rather than WaterTAP

Changes proposed in this PR:

  • Adds the smooth_heaviside function to math
  • Updates the testing

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.

@codecov
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.85%. Comparing base (6e72af3) to head (5cee0bc).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1603      +/-   ##
==========================================
- Coverage   76.85%   76.85%   -0.01%     
==========================================
  Files         394      394              
  Lines       63241    63244       +3     
  Branches    10359    10359              
==========================================
  Hits        48604    48604              
- Misses      12188    12192       +4     
+ Partials     2449     2448       -1     

☔ 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.

Copy link
Contributor

@dallan-keylogic dallan-keylogic left a comment

Choose a reason for hiding this comment

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

Could we augment this function with an additional function that is a drop-in replacement for expr_if? Maybe have two expr_if replacements, depending on whether the underlying expression is continuous (when we can use smooth_max or smooth_min or discontinuous, when we use smooth_heaviside.

@MarcusHolly
Copy link
Contributor Author

Could we augment this function with an additional function that is a drop-in replacement for expr_if? Maybe have two expr_if replacements, depending on whether the underlying expression is continuous (when we can use smooth_max or smooth_min or discontinuous, when we use smooth_heaviside.

After thinking about this a bit more (and trying to implement it), I'm finding it difficult to cover all the possible scenarios since there's not necessarily uniformity in how the conditional statement is set up (number of terms on the LHS and RHS). If we do assume a simple if x > y or x < y, I feel that it is fairly straightforward for the users to replace the Expr_if themselves. That way we don't need to keep Expr_ifs in the code at all (i.e. "the drop-in replacement" function would need to be passed the Expr_if)

Copy link
Contributor

@dallan-keylogic dallan-keylogic left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Morgan88888888 Morgan88888888 left a comment

Choose a reason for hiding this comment

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

Everything looks good.

@dallan-keylogic dallan-keylogic merged commit 8311609 into IDAES:main Apr 10, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority:Normal Normal Priority Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants