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

Nutrient concentrations #72

Merged
merged 8 commits into from
Mar 5, 2025
Merged

Nutrient concentrations #72

merged 8 commits into from
Mar 5, 2025

Conversation

val-ismaili
Copy link
Collaborator

@val-ismaili val-ismaili commented Feb 25, 2025

This PR makes an addition for calculating nutrient concentrations of discharge flows. This first pass makes some simplistic assumptions that:

  • All enduses have the same nutrient types (though different values)
  • Nutrient concentrations per enduse in ww_nutrients.toml are given in g/l

Firstly, a small addition is made that categorises the wastewater of each enduse into blackwater or greywater discharge types. This allows for summarising across discharge types such as discharge.sum(["enduse","user"]).sel(dischargetypes="greywater").plot()

f5b641d1-63ef-4539-a1d7-74c6b0dc402f

Nutrient concentrations

The main section of this PR is an addition to calculate nutrient concentrations from the discharge flows of each enduse. You can think of this as post-processing analysis applied after the simulation stage. As this occurs after the simulation, I thought it would be better to not edit the discharge object directly. Instead with process_discharge_nutrients I've made use of the xarray.Dataset which allows you to store a xarray.DataArray (the discharge object) in it as well as a number of other variables. dataset_to_df converts these Dataset variables back to a pd.DataFrame

I've included a notebook pysim-nutrients.ipynb showing how to run this for you to check more easily. will tidy before merging.

Note that values in ww_nutrients.toml are just dummy values for now.

Screenshot 2025-02-25 at 09 25 07

@BramHillebrand
Copy link
Contributor

I have added Mirjam Blokker as a reviewer since she has more experience with the nutrients part of simdeum

Copy link
Collaborator

Choose a reason for hiding this comment

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

for the Wc, I can imagine you would have different values for a full flush (faeces) and half flush (urine). For the dishwasher and washing machine you may also want to discern between first discharge (dirt and grease), second discharge (soap residu added) and 3rd + 4th discharge (mainly water). This may be too much detail for now, but would be nice to at least have a simple solution in a later version. We may want to discuss this next week

Copy link
Collaborator Author

@val-ismaili val-ismaili Mar 5, 2025

Choose a reason for hiding this comment

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

This makes sense. Wc we think we've got the data to do that quite easily. For WashingMachine and Dishwasher we're looking around. I've set up an issue about this which we'll address next week so we can get this PR closed. #76

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the greywater and blackwater type. In the future this may be extended to light grey and dark grey, blue, green and yellow water :-)

xr.Dataset: The updated xarray.Dataset containing the discharge data and the nutrient concentrations.
"""

toml_file_path = os.path.join(DATA_DIR, 'NL', 'ww_nutrients.toml')
Copy link
Collaborator

Choose a reason for hiding this comment

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

The hard coded 'NL' will need an update with the roll out of PR 73, as well as a new config file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, we'll address that in your PR when pulling from master #77

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a useful addition!

@val-ismaili val-ismaili merged commit 5d19ef5 into master Mar 5, 2025
2 checks passed
@val-ismaili val-ismaili deleted the wq branch March 5, 2025 13:57
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.

None yet

4 participants