Skip to content

Commit

Permalink
Updates to msx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklise committed Dec 13, 2023
1 parent 033a675 commit 7ea6a6e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 52 deletions.
2 changes: 1 addition & 1 deletion documentation/advancedsim.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ reference.
... """J. B. Burkhardt, et al. (2020) https://doi.org/10.1061/(asce)wr.1943-5452.0001304"""
... )
>>> msx
MultispeciesQualityModel(name='lead_ppm')
MsxModel(name='lead_ppm')

Model options are added as follows:

Expand Down
37 changes: 24 additions & 13 deletions documentation/waterquality_msx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
>>> import wntr
>>> try:
... wn = wntr.network.model.WaterNetworkModel('../examples/networks/Net3.inp')
... msx_filename = '../examples/data/something.msx'
... wn.msx = wntr.msx.MsxModel('../examples/data/Net3_arsenic.msx')
... except:
... wn = wntr.network.model.WaterNetworkModel('examples/networks/Net3.inp')
... msx_filename = 'examples/data/something.msx'
... wn.msx = wntr.msx.MsxModel('examples/data/Net3_arsenic.msx')

.. _msx_water_quality:

Expand All @@ -28,11 +28,13 @@ In this example, the MsxModel is created from a MSX file (see [SRU23]_ for more

.. doctest::

>>> msx_filename = 'data/something.msx') # doctest: +SKIP
>>> wn.msx = wntr.msx.MsxModel(msx_filename)
>>> import wntr # doctest: +SKIP

>>> wn = wntr.network.WaterNetworkModel('networks/Net3.inp') # doctest: +SKIP
>>> wn.msx = wntr.msx.MsxModel('data/Net3_arsenic.msx') # doctest: +SKIP

>>> sim = wntr.sim.EpanetSimulator(wn)
>>> results = sim.run_sim()
[TODO add an msx file that uses Net3 to the examples folder for documentation examples]

The results include a quality value for each node, link, and species
(see :ref:`simulation_results` for more details).
Expand Down Expand Up @@ -74,20 +76,29 @@ Examples that illustrate how to build MSX models in WNTR are included in :ref:`a

Reaction library
-----------------
WNTR also contains a library of MSX models that are accessed through the :class:`~wntr.msx.library.ReactionLibrary`.
WNTR also contains a library of MSX models that are accessed through the
:class:`~wntr.msx.library.ReactionLibrary`.
This includes the following models:

* `Arsenic Chloramine model <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/arsenic_chloramine.json>`_ [SRU23]_
* `Lead Plumbosolvency model <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/lead_ppm.json>`_ [BWMS20]_
[TODO change the 2 links to usepa, add other models if they are referenced]
* `Arsenic oxidation/adsorption <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/arsenic_chloramine.json>`_ [SRU23]_
* `Batch chloramine decay <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/batch_chloramine_decay.json>`_
* `Lead plumbosolvency <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/lead_ppm.json>`_ [BWMS20]_
* `Nicotine/chlorine reaction <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/nicotine.json>`_
* `Nicotine/chlorine reaction with reactive intermediate <https://github.com/dbhart/WNTR/blob/msx/wntr/msx/_library_data/nicotine_ri.json>`_

The models are stored in JSON format.
Additional models can be loaded into the library by setting a user specified path.
Additional models could also be added to the WNTR Reactions library.
Additional models could also be added directly to the WNTR Reactions library.

The following example loads a MsxModel from the ReactionLibrary.
The following example loads the Lead plumbosolvency model (lead_ppm) from the ReactionLibrary.

.. doctest::

>>> msx_model = ...
[TODO finish this example]
>>> reaction_library = wntr.msx.library.ReactionLibrary()

>>> print(reaction_library.model_name_list())
['arsenic_chloramine', 'batch_chloramine_decay', 'lead_ppm', 'nicotine', 'nicotine_ri']

>>> lead_ppm = reaction_library.get_model("lead_ppm")
>>> print(lead_ppm)
MsxModel(name='lead_ppm')
4 changes: 2 additions & 2 deletions examples/msx/example.msx → examples/data/Net3_arsenic.msx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Arsenic Oxidation/Adsorption Example

[QUALITY]
;Initial conditions (= 0 if not specified here)
NODE Source AS3 10.0
NODE Source NH2CL 2.5
NODE River AS3 10.0
NODE River NH2CL 2.5

[REPORT]
NODES C D ;Report results for nodes C and D
Expand Down
36 changes: 0 additions & 36 deletions examples/msx/example.inp

This file was deleted.

0 comments on commit 7ea6a6e

Please sign in to comment.