Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/MichaelPesce/watertap into …
Browse files Browse the repository at this point in the history
…add-initialize-func
  • Loading branch information
MichaelPesce committed Oct 15, 2024
2 parents ebccb46 + 74c6518 commit 34c82f6
Show file tree
Hide file tree
Showing 20 changed files with 425 additions and 2,063 deletions.
6 changes: 3 additions & 3 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Create a Conda environment (in this example, named ``watertap``) where WaterTAP

.. code-block:: shell
conda create --name watertap --yes python=3.8 pip=21.1
conda create --name watertap --yes python=3.11
Activate the ``watertap`` environment using the command given below. If the environment was activated successfully, the environment's name will be displayed in the terminal prompt such as ``(watertap) project-directory $``.

Expand Down Expand Up @@ -58,7 +58,7 @@ Create a Conda environment (in this example, named ``watertap``) where WaterTAP

.. code-block:: shell
conda create --name watertap --yes python=3.8 pip=21.1
conda create --name watertap --yes python=3.11
Activate the ``watertap`` environment using the command given below. If the environment was activated successfully, the environment's name will be displayed in the terminal prompt such as ``(watertap) project-directory $``.

Expand Down Expand Up @@ -143,7 +143,7 @@ Create a Conda environment (in this example, named ``watertap-dev``) where Water

.. code-block:: shell
conda create --name watertap-dev --yes python=3.8 pip=21.1 && conda activate watertap-dev
conda create --name watertap-dev --yes python=3.11 && conda activate watertap-dev
Clone the WaterTAP repository to your local development machine using ``git clone``, then enter the newly created ``watertap`` subdirectory:

Expand Down
2 changes: 0 additions & 2 deletions docs/technical_reference/flowsheets/extended_BSM2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ Additional Variables
"Reactor 7 oxygen mass transfer coefficient",":math:`KLa_{R7}`", "240", ":math:`\text{hr}^{-1}`"
"Dissolved oxygen concentration at equilibrium",":math:`S_{O, eq}`", "8e-3", ":math:`\text{hr}^{-1}`"



Additional Constraints
----------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def main(bio_P=False):
m.fs.R6.outlet.conc_mass_comp[:, "S_O2"].unfix()
m.fs.R7.outlet.conc_mass_comp[:, "S_O2"].unfix()

# Resolve with controls in place
# Re-solve with controls in place
results = solve(m)

pyo.assert_optimal_termination(results)
Expand Down Expand Up @@ -548,6 +548,10 @@ def scale_variables(m):
)
iscale.set_scaling_factor(block.control_volume.material_balances, 1e3)

iscale.set_scaling_factor(m.fs.AD.KH_co2, 1e1)
iscale.set_scaling_factor(m.fs.AD.KH_ch4, 1e1)
iscale.set_scaling_factor(m.fs.AD.KH_h2, 1e1)

# Apply scaling
scale_variables(m)
iscale.calculate_scaling_factors(m)
Expand Down Expand Up @@ -612,7 +616,7 @@ def initialize_system(m, bio_P=False, solver=None):
(0, "X_AUT"): 0.25,
(0, "X_H"): 23.0,
(0, "X_I"): 11.3,
(0, "X_PAO"): 10.8,
(0, "X_PAO"): 10.9,
(0, "X_PHA"): 0.0058,
(0, "X_PP"): 2.9,
(0, "X_S"): 3.8,
Expand Down Expand Up @@ -872,9 +876,82 @@ def display_performance_metrics(m):
pyo.units.get_units(m.fs.AD.liquid_phase.properties_in[0].flow_vol),
)

print("---- Feed Metrics----")
print(
"Feed TSS concentration",
pyo.value(m.fs.FeedWater.properties[0].TSS),
pyo.units.get_units(m.fs.FeedWater.properties[0].TSS),
)
print(
"Feed COD concentration",
pyo.value(m.fs.FeedWater.properties[0].COD),
pyo.units.get_units(m.fs.FeedWater.properties[0].COD),
)
print(
"BOD5 concentration",
pyo.value(m.fs.FeedWater.properties[0].BOD5["raw"]),
pyo.units.get_units(m.fs.FeedWater.properties[0].BOD5["raw"]),
)
print(
"TKN concentration",
pyo.value(m.fs.FeedWater.properties[0].TKN),
pyo.units.get_units(m.fs.FeedWater.properties[0].TKN),
)
print(
"SNOX concentration",
pyo.value(m.fs.FeedWater.properties[0].SNOX),
pyo.units.get_units(m.fs.FeedWater.properties[0].SNOX),
)
print(
"Organic phosphorus concentration",
pyo.value(m.fs.FeedWater.properties[0].SP_organic),
pyo.units.get_units(m.fs.FeedWater.properties[0].SP_organic),
)
print(
"Inorganic phosphorus concentration",
pyo.value(m.fs.FeedWater.properties[0].SP_inorganic),
pyo.units.get_units(m.fs.FeedWater.properties[0].SP_inorganic),
)

print("---- Effluent Metrics----")
print(
"TSS concentration",
pyo.value(m.fs.Treated.properties[0].TSS),
pyo.units.get_units(m.fs.Treated.properties[0].TSS),
)
print(
"COD concentration",
pyo.value(m.fs.Treated.properties[0].COD),
pyo.units.get_units(m.fs.Treated.properties[0].COD),
)
print(
"BOD5 concentration",
pyo.value(m.fs.Treated.properties[0].BOD5["effluent"]),
pyo.units.get_units(m.fs.Treated.properties[0].BOD5["effluent"]),
)
print(
"TKN concentration",
pyo.value(m.fs.Treated.properties[0].TKN),
pyo.units.get_units(m.fs.Treated.properties[0].TKN),
)
print(
"SNOX concentration",
pyo.value(m.fs.Treated.properties[0].SNOX),
pyo.units.get_units(m.fs.Treated.properties[0].SNOX),
)
print(
"Organic phosphorus concentration",
pyo.value(m.fs.Treated.properties[0].SP_organic),
pyo.units.get_units(m.fs.Treated.properties[0].SP_organic),
)
print(
"Inorganic phosphorus concentration",
pyo.value(m.fs.Treated.properties[0].SP_inorganic),
pyo.units.get_units(m.fs.Treated.properties[0].SP_inorganic),
)


if __name__ == "__main__":
# This method builds and runs a steady state activated sludge flowsheet.
m, results = main(bio_P=False)

stream_table = create_stream_table_dataframe(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def build(self):
domain=pyo.PositiveReals,
doc="Conversion factor applied for TSS calculation",
)
self.BOD5_factor = pyo.Var(
self.BOD5_factor = pyo.Param(
["raw", "effluent"],
initialize={"raw": 0.65, "effluent": 0.25},
units=pyo.units.dimensionless,
Expand Down
Loading

0 comments on commit 34c82f6

Please sign in to comment.