Skip to content
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

ADM1/ASM2d Translator Update #1435

Merged
merged 87 commits into from
Jul 18, 2024

Conversation

MarcusHolly
Copy link
Contributor

Summary/Motivation:

Correctly builds the translator block based on c-code from Flores-Alsina

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.

@MarcusHolly MarcusHolly added the Priority:Normal Normal Priority Issue or PR label Jun 13, 2024
@MarcusHolly MarcusHolly self-assigned this Jun 13, 2024
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 99.34211% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.67%. Comparing base (a15e125) to head (d240381).
Report is 1 commits behind head on main.

Files Patch % Lines
...ter_resource_recovery_facility/BSM2_P_extension.py 97.91% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1435   +/-   ##
=======================================
  Coverage   93.66%   93.67%           
=======================================
  Files         286      286           
  Lines       30697    30756   +59     
=======================================
+ Hits        28753    28810   +57     
- Misses       1944     1946    +2     

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

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.

I have a few comments/questions on this.



"Biomass concentration", ":math:`bio = X_{su, in} + X_{aa, in} + X_{fa, in} + X_{c4, in} + X_{pro, in} + X_{ac, in} + X_{h2, in} + X_{PAO, in}`"
"S_ac concentration", ":math:`S_{ac, 1} = S_{ac, in} + X_{PHA, in}`"
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the 1 and 2 subscripts meant to represent (e.g., S_{ac, 1} or S_{ac, 2})?

Copy link
Contributor Author

@MarcusHolly MarcusHolly Jun 27, 2024

Choose a reason for hiding this comment

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

Yes - the 1 and 2 subscripts correspond to the concentration of the given component at steps 1 and 2 (named like Sac_AD1 in the code). This translator only has 2 steps (whereas the other translator has 5).

Copy link
Contributor

Choose a reason for hiding this comment

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

A little bit confused here, e.g., I see you set X_{PP,1} = 0 and then there are some conversion equations like S_IP will add X_{PP,1}, but it is set as 0, so what is the purpose for this conversion? Add 0 does not seem to have any impacts of the outcome. and where does X_PP convert to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have done that just to be explicit, and the c-code also leaves in such terms even when they are set equal to 0. I wanted to avoid somebody cross-checking our code with the c-code and wondering why a term is missing from an expression

Copy link
Contributor Author

Choose a reason for hiding this comment

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

X_PP is converted into S_Mg, S_K, and S_IP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is correct. It has no effect since it's zero. But is it possible that in the future we want to change X_PP from 0 to something else? If so, I think it's worth keeping this zero term here in the documentation and in the code itself. It's also just the most accurate representation of these equations.

Copy link
Contributor

Choose a reason for hiding this comment

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

@adam-a-a hope you could also join the talk, I am confused because I believe X_PP should be important components of the system, right now, it seems no matter the initial value of X_PP is, it will directly set to 0 and no actual conversion happens to the system. Same conditions to X_PHA and X_PAO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh... yea there's a mistake here. S_{IP, 1} should be X_{PP, in) + ... and not S_{IP, in) + ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch @luohezhiming. This may or may not screw up the flowsheet again, but I'll test it out now...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do a line-by-line review of the new translator file after this, which I just haven't had the time to do yet

watertap/unit_models/translators/translator_adm1_asm2d.py Outdated Show resolved Hide resolved
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.

Still work to do, but at least we have this passing checks without costing!

@adam-a-a
Copy link
Contributor

@luohezhiming let's merge this through once all checks pass and I will continue troubleshooting on PR #1467 while you work on modified ADM1 flowsheet

Copy link
Contributor

@luohezhiming luohezhiming left a comment

Choose a reason for hiding this comment

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

The BSM2_electroNP.py needs to be deleted!

@luohezhiming luohezhiming self-assigned this Jul 18, 2024
@adam-a-a adam-a-a enabled auto-merge (squash) July 18, 2024 18:28
@adam-a-a adam-a-a merged commit f94f21d into watertap-org:main Jul 18, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:High High Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants