Wastewater nutrient concentration (g/use) #81
+305
−132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #80 #79 #76
This PR focuses on addressing the incorrect implementation of nutrient concentrations to discharge flow. The key change being that input statistics are provided in
g/use
. Implying that regardless of the discharge volume for and enduse discharge event, the same volume of nutrients will be deposited. As per the norm with pysimdeum, stochastic behaviour is implemented by using input data as an average to sample from a normal distribution. This is then used to calculate the specific concentration ing/L
for each discharge event.This work uncovered a gap in how the
Wc
enduse data is provided. The use of half-flush and full flush, though strongly correlated with, does not necessarily imply directly faeces or urine use. Though this isn't relevant at simulation stages for flows (you just care whether it is full or half flush as that changes flow volume), we do care whether a urine or faeces use is sampled when calculating nutrient concentrations. So this is added as metadata to the discharge event. Similarly other enduses with usage subtypes (e.g.KitchenTap
drinking water or dishes) have their enduse usage tracked through metadata. The nutrient config file allows the user to provide specific stats for each usage subtype.To accomodate this metadata I thought it made sense to not alter the discharge data array directly since this metadata would just add dimensions and bulk out the file even more. So I embedded the existing discharge object datarray within a
xarray.Dataset
. Thedischarge
data array anddischarge_events
are stored within this. So the discharge object return by a command likeconsumption, discharge = house.simulate(duration='1 day', num_patterns=1, simulate_discharge=True)
is actually axarray.Dataset
.Simple to access by
discharge.discharge
ordischarge.discharge_events
. This newdischarge_events
metadata is a simple structure of a list of dictionaries for each discharge event of the structure;To run the code simply provide the discharge dataset as an argument to the function
assign_discharge_nutrients