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

[WIP] ADM1 Model #627

Closed
wants to merge 298 commits into from
Closed

[WIP] ADM1 Model #627

wants to merge 298 commits into from

Conversation

adam-a-a
Copy link
Contributor

@adam-a-a adam-a-a commented Jul 18, 2022

Fixes/Resolves:

Summary/Motivation:

Implement Anaerobic Digestion Model No. 1 (ADM1) for detailed wastewater treatment processes.

Checklist:

  • add Petersen matrix values
  • add process rate equations
  • add inhibition functions, which are included in process rate equations
  • verify Petersen matrix values
  • Add quasi-steady-state components and related constraints and verify for a known state
  • If possible without VLE piece, verify rate equations 
  • Add the necessary properties for VLE to the thermo package
  • Build the anaerobic digestor unit model and verify the whole system

Changes proposed in this PR:

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.

@adam-a-a adam-a-a self-assigned this Jul 18, 2022
@adam-a-a adam-a-a added iedo Priority:Normal Normal Priority Issue or PR WIP Work in Progress labels Jul 18, 2022
@adam-a-a
Copy link
Contributor Author

@andrewlee94 @luohezhiming I will be committing to this model bit by bit. Right now, I have some version of the property model in place and getting to work on the reaction model (added stoich parameters and stoichiometric coefficients for a couple of the reactions so far). Feel free to check out what I have so far.

@codecov
Copy link

codecov bot commented Jul 18, 2022

Codecov Report

Merging #627 (4001a07) into main (3b2e256) will decrease coverage by 0.53%.
The diff coverage is 30.37%.

❗ Current head 4001a07 differs from pull request most recent head 6d39d63. Consider uploading reports for the commit 6d39d63 to get more accurate results

@@            Coverage Diff             @@
##             main     #627      +/-   ##
==========================================
- Coverage   94.81%   94.27%   -0.54%     
==========================================
  Files         217      216       -1     
  Lines       20357    19691     -666     
==========================================
- Hits        19301    18564     -737     
- Misses       1056     1127      +71     
Impacted Files Coverage Δ
...roperty_models/activated_sludge/asm1_properties.py 95.55% <ø> (-1.06%) ⬇️
...erty_models/anaerobic_digestion/adm1_properties.py 28.57% <28.57%> (ø)
...perty_models/anaerobic_digestion/adm1_reactions.py 33.33% <33.33%> (ø)
watertap/unit_models/uv_aop.py 88.44% <0.00%> (-6.26%) ⬇️
watertap/edb/db_api.py 80.76% <0.00%> (-4.24%) ⬇️
...RO_with_energy_recovery/RO_with_energy_recovery.py 90.43% <0.00%> (-0.52%) ⬇️
watertap/property_models/ion_DSPMDE_prop_pack.py 91.33% <0.00%> (-0.29%) ⬇️
...awater_RO_desalination/seawater_RO_desalination.py 96.12% <0.00%> (-0.20%) ⬇️
watertap/unit_models/electrodialysis_1D.py 95.33% <0.00%> (-0.09%) ⬇️
... and 40 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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.

Excellant work, will continue reviewing it.

TimBartholomew and others added 25 commits September 30, 2022 09:43
* cleaned up tutorials

* fixed tutorials
…g#780)

* Register 3 of the recently merged flowsheet UI modules

* Remove nonessential CI checks and integration tests while WIP

* Use str() instead of .name to generate the key for the exported object

* Try setting default value for is_readonly based on obj if not specified

* Ensure obj is a supported Pyomo object

* Store model_export key as instance attr to access it when obj is None

* Add check to ensure valid Pyomo object if specified

* Tweak is_readonly definition and validator with more explicit failure

* Register next batch of UI modules from watertap-org#767, watertap-org#769, watertap-org#772, watertap-org#775

* Fix wrong module name

* Add UI module from watertap-org#776

* Apply fix for test failure due to USD_2018 and USD_2020 units

* Revert "Remove nonessential CI checks and integration tests while WIP"

This reverts commit 24f362e.

* Try setting USD_20XX units the other way round

* Tweak expected results to make tests pass

* Add logic to map flowsheet names to pytests markers to be applied

* Add requires_idaes_solvers as optional FlowsheetExport field

* Apply marker based on requires_idaes_solver attribute

* Apply marker per-parametrized-testfunction instead of per-testclass

* Register swine_wwt entry point

* Increase FlowsheetExport API default version number

* Revert mostly-clueless attempts at addressing hrcs costing failures

* Add explicit conversion of watertap_costing exprs for hrcs_ui export()

* fixing 1690 for macOS

* Remove requirement for IDAES solver after changes from watertap-org#786

Co-authored-by: Bernard Knueven <Bernard.Knueven@nrel.gov>
* Add support for Python 3.10

* Try to see if 3.10 dep resolution errors are due to dev dependencies

* Try if Python 3.10 incompatibility is due to scipy

* Try disabling other requirements

* Reduce number of jobs while debugging

* Try changing python_requires constraint

* Restore h5py requirement

* Restore scipy requirement

* Revert "Reduce number of jobs while debugging"

This reverts commit a3917fd.

* Restore nbformat requirement

* Update setup.py

Co-authored-by: bknueven <30801372+bknueven@users.noreply.github.com>

Co-authored-by: bknueven <30801372+bknueven@users.noreply.github.com>
* save work

* save unfinished work- nonohmic, diffusion layer in places

* save work

* save work, initial solvable version!

* save work

* membrane diffusion and water osmosis under polarizaiontion refined

* save work, all working property

* first finalized ed1d refinement with tests

* save work

* save work

* save work, all components in

* save work, solving debug

* update by main

* update from main

* typo corr
* save work

* save unfinished work- nonohmic, diffusion layer in places

* save work

* save work, initial solvable version!

* save work

* membrane diffusion and water osmosis under polarizaiontion refined

* save work, all working property

* first finalized ed1d refinement with tests

* typo correction

* improve fs opt

* test opt bound

* rename i_lim configvalue

* typo fix  and rename set
* save work

* save work

* refinement key content added

* format debug

* format debug

* format debug

* improvement

* improvement

* add figure

* add figure

* add figure

* fix a reused letter

* fix a reused letter

* rewording to avoid confusion

* minor format improvement
* ed doc init

* ed doc work save

* doc saving

* text draft

* add figure_png

* format, index added

* modify figure cap

* fix build issues

* fix building issue 2nd

* LaTex format fix

* LaTex format 2

* LaTex debug 3

* LaTex debug

* Addresses review comments from @aladshaw3

* LaTex debug

* another hopfully last math display fix

* equation fix

* added extension content

* add image

* format fix

* change cotrol vol block  names

* typo corr

Co-authored-by: Austin Ladshaw <ladshawap@ornl.gov>
* Replace doctest directive with code-block directive

* Add testcode directives

* Use keyword arguments instead of default dict

* Use keyword arguments

* Add deprecation warnings to testoutput

* Remove deprecate warning from testoutput

* Use keyword argument

* Display output from example

* Add traceback exception to testoutput

* Use keyword arguments

* Fix example for RO model

* Fix state_block and RO model setup

* Add ellipsis to testoutput for property model example

Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
* Add GLSD AD model

* Add tests for flowsheet

* Update watertap/data/techno_economic/anaerobic_digestion_reactive.yaml

Co-authored-by: Adam Atia <aatia@keylogic.com>

* Update watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/GLSD_anaerobic_digester/GLSD_anaerobic_digestion.py

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>

* Revise file

* Revise subtype

* Update watertap/examples/flowsheets/case_studies/wastewater_resource_recovery/GLSD_anaerobic_digester/GLSD_anaerobic_digestion_global_costing.yaml

Co-authored-by: Adam Atia <aatia@keylogic.com>

* Revise test values

Co-authored-by: Adam Atia <aatia@keylogic.com>
Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>
* Add gui

* Add gui for 1669

* Register GUI
* Changes GUI cost factors from None to TIC

* Start addressing some test failures

* fix AMO flowsheet costing tests

* fix ZO model unit tests

* Fixes HTGZO testing failure

* add direct_capital_cost

* black

* using direct_capital_cost

* patch hydrothermal_gasification_zo test

* adding helpful comment

* kick off GHA

* fixing location of _add_cost_factor

Co-authored-by: tarnold17 <travis.arnold17@gmail.com>
Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
Co-authored-by: Bernard Knueven <Bernard.Knueven@nrel.gov>
* TDS yaml removal_frac_mass_comp to 0, update test

* fix tds removal to 0.9 in muni ex for test pass
…ram objects (watertap-org#798)

* Restore re-raising exceptions within FlowsheetInterface.build()

* Ensure more explicit errors are generated during validation

* Tweak validation checks

* Reduce number of checks while WIP

* Remove redundant higher-precedence option

* Fix and refactor fsapi unit test

* Ensure all "dynamic default" validators have always=True

This issue was detected by test_actions[model_export_dict_data_kwarg]

* Enable fsapi export for Param objects

* Fix entry points for Python 3.7

* Remove duplicated export

* Fix typo in attribute name

* Fix conversion between incompatible units

* Extend is_readonly logic to support Param objects

* Revert "Reduce number of checks while WIP"

This reverts commit 8fa3c7e.

* Tweak Codecov thresholds
* Test that each ZO model has a ZO doc

* Adds files that were missed in original commit

* Incorporates Ludovico's suggestions

* Minor changes to address comments

* Excel updatted properly now

* Constructed wetlands rst update

* revert changes made in last commit

* Revert "revert changes made in last commit"

This reverts commit 91711ed.

* hardcoding list place

Co-authored-by: Bernard Knueven <Bernard.Knueven@nrel.gov>
Address most of IDAES v2 deprecations
@agarciadiego agarciadiego mentioned this pull request Nov 25, 2022
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iedo Priority:Normal Normal Priority Issue or PR WIP Work in Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet