Explain the balance equations from the rainwater harvesting paper posted to this week's reading.
The two balance equations are:
from IPython.display import Image
Image(filename = "balance.png", width=800, height=800)
Vt in Equation 1 represents the volume of rainwater in the cistern on any given day indexed with t ∈ T (t is a daily index rather than monthly or yearly.
Equation 2 models tank capacity (Cap) with a minimum/maximum approach where the amount of overflow is ignored.
The parameters of the equations are as follows:
C : captured supply of rainwater from the roof
D : demand for purified water
O : Overflow
Equation 1 basically says that on a certain day, the volume of water in the cistern equals the maximum of 0 or the volume in the previous day plus captured rainwater (if it rains) minus the demand of the day (water used from the cistern) minus any overflow (as that volume is not stored).
Equation 2 assumes no overflow and states the volume in the cistern should be the minimum of the volume derived from equation 1 (again assuming overflow is zero) or the capacity of the tank.
Share some code from last week that was particularly rewarding or frustrating. We will comment on it
In chapter 6, we called certain values using the following code:
t_0 = get_first_label(census) t_end = get_last_label(census) elapsed_time = t_end - t_0
p_0 = get_first_value(census) p_end = get_last_value(census) total_growth = p_end - p_0
I found this method of calling objects particularly frustrating. It limits me to only calling first and last objects. Also, what if there is more than one label? I find the usual python way of slicing easier to follow.
#Example of slicing
a = ("a", "b", "c", "d", "e", "f", "g", "h")
a[-1] #returns last object