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

Add EPANET MSX enhancements #426

Open
wants to merge 103 commits into
base: main
Choose a base branch
from
Open

Add EPANET MSX enhancements #426

wants to merge 103 commits into from

Conversation

dbhart
Copy link
Collaborator

@dbhart dbhart commented May 20, 2024

This provides updates to WNTR that integrate EPANET-MSX into the EpanetSimulator.

In addition to the new simulation options, this provides MSX model objects, such as species, terms, etc., that can be added to a water network model in a similar way to how WNTR works currently.

Demonstration is located in examples/demos/

dbhart and others added 30 commits August 17, 2023 14:37
The class will be similar to the WaterNetworkModel in terms of its
structure and options.
Merge main into development branch
Update to add basic citation class
* Update to exception documentation

* Update documentation for EN errors
dbhart and others added 11 commits March 11, 2024 10:31
* Updated MSX binaries, PR issued to EPANETMSX main
* Updated toolkit to match modified code in MSX DLL
* Fixed an error in the filename encoding
* Move library to new directory
* Updates to documentation
* New ipynb demo
* various bug fixes
@kaklise kaklise requested a review from kbonney June 7, 2024 21:03
Copy link
Collaborator

@kbonney kbonney left a comment

Choose a reason for hiding this comment

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

Overall, PR is well organized and well written. The MSX code and API follows the current WNTR style and is integrated clearly with the existing code base. Documentation and examples are provided to help users learn to use the new MSX features. A test suite is provided, but should be expanded to cover more of the code and common use cases.

I have commented on some minor items throughout. Aside from a typo preventing correct code execution in the example, nothing is of high importance. I recommend that we expand the test suite before merging, which I'd be happy to help with.

documentation/conf.py Outdated Show resolved Hide resolved

The EpanetSimulator can use EPANET-MSX 2.0 :cite:p:`shang2023` to run
multi-species water quality simulations.
Additional multi-species simulation options are discussed in :ref:`advanced_simulation`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could link directly to the "Building MSX models" section here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

:class:`~wntr.msx.library.ReactionLibrary`.
This includes the following models:

* `Arsenic oxidation/adsorption <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/arsenic_chloramine.json>`_ :cite:p:`shang2023`
Copy link
Collaborator

Choose a reason for hiding this comment

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

These links are broken. I assume we will want to update these to point to the corresponding files in the USEPA main branch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dbhart update links

and **parameters**. Constants have a single value in every expression. Parameters have a global value
that is used by default, but which can be modified on a per-pipe or per-tank basis.

Pre-defined hydraulic variable can be found in
Copy link
Collaborator

@kbonney kbonney Jun 26, 2024

Choose a reason for hiding this comment

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

variable -> variables

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dbhart typo

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Suggest adding a direct link to epa msx user manual.
  • Suggest making T/T1 consistent (choose one or the other instead of having both throughout) .
  • In Cell 11, recommend removal of leftover testing comment.
  • Suggest adding axes labels for last figure from cell 9 .
  • Cell 17 naming error, need to lowercase mutlisource-cl.

wntr/msx/model.py Outdated Show resolved Hide resolved
wntr/epanet/msx/io.py Show resolved Hide resolved
wntr/msx/options.py Show resolved Hide resolved
@@ -575,8 +589,8 @@ class Registry(MutableMapping):
"""

def __init__(self, wn):
if not isinstance(wn, AbstractModel):
raise ValueError('Registry must be initialized with a model')
# if not isinstance(wn, AbstractModel):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this removed to allow use with MSX classes? If so, I suggest keeping and extending the allowed instance types to cover MSX.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dbhart remove this change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest adding additional checks for options, pipes, tanks, sources, and initial conditions.

logger = logging.getLogger(__name__)


class MsxLibrary:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be worth abstracting part of the MsxLibrary interface to allow for extensions to librarys for other purposes (eg demand pattern library). Not sure how this might look but I'd be interested in discussing it further.

documentation/conf.py Outdated Show resolved Hide resolved
@kbonney kbonney mentioned this pull request Sep 23, 2024
1 task
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.

3 participants