-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASM1 Property Package Re-Scaling #1519
Conversation
|
watertap/property_models/unit_specific/activated_sludge/asm1_properties.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure of current status on this, but I still would like to see things come in one at a time. My reasoning is that, ideally, if we only add a Scaler for ASM1, it might be easier to troubleshoot failed tests. Additionally, you could focus specifically on ASM1 tests and perhaps particular unit model tests that use ASM1. Moreover, adding a test for ASM1 Scaler could be helpful to gauge whether your default scaler class works better or worse with different settings. From there, we could move on to ADM1 and do the same for that.
Right now, for example, you might not be able to tell if ASM1, ADM1 liquid or ADM1 vapor properties have problematic scaling that cause checks to fail. |
I agree - I just haven't touched this since we had our last meeting since we're still waiting on IDAES/idaes-pse#1523 to go through. I'll make sure only one prop pack is changed at a time. |
@lbianchi-lbl It seems like Bumping the IDAES tag of Pyomo to check for issues IDAES/idaes-pse#1523 is close to being merged, so just sending a reminder that this PR needs a tag for a pre-release version of IDAES after the PR goes through. If the IDAES PR just needs one more rubber stamp, I could do that. |
…tertap into bsm2_prop_scaling
@@ -161,6 +167,121 @@ def check_units(self, model): | |||
assert_units_consistent(model) | |||
|
|||
|
|||
class TestASM1ReactionScaler(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thought that comes to mind--- I am hoping we can at least track some metric, even it doesn't adequately represent the shift in model states, to keep some record to quantify the performance of a scaler class (as well as the old calculate_scaling_factors method).
Perhaps the easiest thing to do is to use the DiagnosticToolbox, check the condition number and assert that value for the new Scaler, the old method-based approach, and any new Scaler classes (or revisions to existing ones) that we bring in. This way, we can get some idea of how impactful scaler additions/revisions are as we progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adam-a-a I should be able to add this relatively easily. Can you take a look at the AD tests I added here for comparing the old and new scaling methods:
# TODO: Remove test once iscale is deprecated |
That PR is still a WIP, but all I need to do is refine the scaling for the bio_P=False case in the BSM2_P flowsheet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and I am ready to approve. @MarcusHolly The one thing I think we should consider adding is some assertions to check condition number before/after applying scaler. Ideally we'd do this for the old calculate_scaling_factors approach too. This way, we can be mindful of model improvements as we go, rather than just depending on the model to solve, which doesn't necessarily tell us whether one scaler is better than the next (which might be a fool's errand in general anyway).
This discussion was continued offline - these tests will be updated in future PRs as we add more UnitModelScalers to WaterTAP. We will also consider the possibility of using the IPOPTConvergenceAnalysis to compare metrics from the old scaling routine to those of the new scaling routine. |
Summary/Motivation:
Reworks how the ASM1 property package is scaled according to the new IDAES scaling routine
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: