QSD-Group / EXPOsan

EXPOsition of sanitation and resource recovery systems
https://qsdsan.com
Other
16 stars 6 forks source link

Questions for POU disinfection #39

Closed yalinli2 closed 4 months ago

yalinli2 commented 9 months ago

@lsrowles Working on updating the POU disinfection module (see pou_disinfection branch), listing the potential bugs to be confirmed, because your original codes aren't on GitHub, I have to use screenshots here:


>>> def test(turbidity, hardness):
>>>     print(f'turbidity is {turbidity}, hardness is {hardness}')
>>>     if turbidity <= 10 and hardness <= 60:
>>>         print('lifetime is 2')
>>>     elif turbidity > 10 or hardness > 60:
>>>         print('lifetime is 1.5')
>>>     elif turbidity > 10 and hardness > 60:
>>>         print('lifetime is 0.5')

>>> test(5, 5)
turbidity is 5, hardness is 5
lifetime is 2
>>> test(15, 5)
turbidity is 15, hardness is 5
lifetime is 1.5
>>> test(15, 65)
turbidity is 15, hardness is 65
lifetime is 1.5

Instead, you should do this:

>>> def test2(turbidity, hardness):
>>>     print(f'turbidity is {turbidity}, hardness is {hardness}')
>>>     if turbidity <= 10 and hardness <= 60:
>>>         print('lifetime is 2')
>>>     elif turbidity > 10 and hardness > 60:
>>>         print('lifetime is 0.5')
>>>     else: print('lifetime is 1.5')

>>> test2(5, 5)
turbidity is 5, hardness is 5
lifetime is 2
>>> test2(15, 5)
turbidity is 15, hardness is 5
lifetime is 1.5
>>> test2(15, 65)
turbidity is 15, hardness is 65
lifetime is 0.5
yalinli2 commented 9 months ago

yalinli2 commented 9 months ago

lsrowles commented 9 months ago

@yalinli2 I agree with your edit for pou_disinfection. Good catch on that.

I will follow up with you on the other two points.

yalinli2 commented 9 months ago

yalinli2 commented 9 months ago

More explanation I'm referring to the household size distribution in the bwaise module,

    # Household size
    b = bw.household_size
    # 1.8/((844/4%)^0.5) is for standard error of a mean,
    # standard deviation divided by the square root of the population size,
    # 844 and 4% from Trimmer et al., changed from the distribution used in Trimmer et al.
    D = shape.Trunc(shape.Normal(mu=b, sigma=0.012), lower=1)
    @param(name='Household size', element=Toilet, kind='coupled', units='cap/household',
           baseline=b, distribution=D)
    def set_household_size(i):
        bw.household_size = i

The sigma value was reduced because how we used the household_size. We used it in the sense of an "average household size" to calculate how many toilets would be needed for a community:

number of toilets = total community population/household size/number of households served by one toilet

So the sigma should be adjusted.

Also note that the average household size does not have true uncertainty, i.e., if we survey the entire community, we can reduce the uncertainty to 0 because we'd know the how many households there are and calculate the average household size.

But for an individual household, true uncertainty exists - i.e., even if we survey the entire community, if we pick one household from the community, we still are not sure of its household size. If we don't use the household size in an average sense, e.g., assume we assign one toilet for one household (rather than calculating it from the total population), we should use the individual household distribution with the larger sigma value (i.e., 1.8).


yalinli2 commented 9 months ago

yalinli2 commented 9 months ago


yalinli2 commented 9 months ago

yalinli2 commented 8 months ago

yalinli2 commented 8 months ago

yalinli2 commented 4 months ago

All tasks done, closing this issue!