Skip to content

Commit

Permalink
Fix remaining issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dalonsoa committed Jan 10, 2024
1 parent c6cd604 commit 07906ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion wsimod/arcs/arcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def update_queue(self, direction=None, backflow_enabled=True):
vqip_ = self.v_change_vqip(vqip, removed)
total_removed = self.sum_vqip(total_removed, vqip_)

# Assume that any water that cannot arrive at destination this
# Assume that any water that cannot arrive at destination this
# timestep is backflow
rejected = self.v_change_vqip(vqip, vqip["volume"] - removed)

Expand Down
28 changes: 14 additions & 14 deletions wsimod/nodes/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def get_direction_arcs(self, direction, of_type=None):
Examples:
>>> arcs_to_push_to = my_node.get_direction_arcs('push')
>>> arcs_to_pull_from = my_node.get_direction_arcs('pull')
>>> arcs_from_reservoirs = my_node.get_direction_arcs('pull', of_type =
>>> arcs_from_reservoirs = my_node.get_direction_arcs('pull', of_type =
'Reservoir')
"""
if of_type is None:
Expand Down Expand Up @@ -427,7 +427,7 @@ def push_distributed(self, vqip, of_type=None, tag="default"):
connected = self.get_connected(direction="push", of_type=of_type, tag=tag)
iter_ = 0
if not_pushed > connected["avail"]:
# If more water than can be pushed, ignore preference and allocate all
# If more water than can be pushed, ignore preference and allocate all
# available based on capacity
connected["priority"] = connected["avail"]
connected["allocation"] = connected["capacity"]
Expand Down Expand Up @@ -801,7 +801,7 @@ def pull_ponded(self):
Examples:
>>> constants.ADDITIVE_POLLUTANTS = ['phosphate']
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 10,
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 10,
'phosphate' : 0.2})
>>> print(my_tank.storage)
{'volume' : 10, 'phosphate' : 0.2}
Expand All @@ -828,7 +828,7 @@ def get_avail(self, vqip=None):
Examples:
>>> constants.ADDITIVE_POLLUTANTS = ['phosphate']
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 10,
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 10,
'phosphate' : 0.2})
>>> print(my_tank.storage)
{'volume' : 10, 'phosphate' : 0.2}
Expand Down Expand Up @@ -858,7 +858,7 @@ def get_excess(self, vqip=None):
Examples:
>>> constants.ADDITIVE_POLLUTANTS = ['phosphate']
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
'phosphate' : 0.2})
>>> print(my_tank.get_excess())
{'volume' : 4, 'phosphate' : 0.16}
Expand All @@ -870,7 +870,7 @@ def get_excess(self, vqip=None):
vol = min(vqip["volume"], vol)

# Adjust storage pollutants to match volume in vqip
# TODO the v_change_vqip in the reply here is a weird default (if a VQIP is not
# TODO the v_change_vqip in the reply here is a weird default (if a VQIP is not
# provided)
return self.v_change_vqip(self.storage, vol)

Expand All @@ -890,7 +890,7 @@ def push_storage(self, vqip, force=False):
>>> constants.ADDITIVE_POLLUTANTS = ['phosphate']
>>> constants.POLLUTANTS = ['phosphate']
>>> constants.NON_ADDITIVE_POLLUTANTS = []
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
'phosphate' : 0.2})
>>> my_push = {'volume' : 10, 'phosphate' : 0.5}
>>> reply = my_tank.push_storage(my_push)
Expand Down Expand Up @@ -933,7 +933,7 @@ def pull_storage(self, vqip):
Examples:
>>> constants.ADDITIVE_POLLUTANTS = ['phosphate']
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
'phosphate' : 0.2})
>>> print(my_tank.pull_storage({'volume' : 6}))
{'volume': 5.0, 'phosphate': 0.2}
Expand Down Expand Up @@ -967,7 +967,7 @@ def pull_pollutants(self, vqip):
Examples:
>>> constants.ADDITIVE_POLLUTANTS = ['phosphate']
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
>>> my_tank = Tank(capacity = 9, initial_storage = {'volume' : 5,
'phosphate' : 0.2})
>>> print(my_tank.pull_pollutants({'volume' : 2, 'phosphate' : 0.15}))
{'volume': 2.0, 'phosphate': 0.15}
Expand Down Expand Up @@ -1056,7 +1056,7 @@ def push_total_c(self, vqip):
Returns:
"""
# Push vqip to storage where pollutants are given as a concentration rather
# Push vqip to storage where pollutants are given as a concentration rather
# than storage
vqip = self.concentration_to_total(self.vqip)
self.storage = self.sum_vqip(self.storage, vqip)
Expand Down Expand Up @@ -1114,8 +1114,8 @@ def __init__(self, decays={}, parent=None, **kwargs):
beginning of the timestep.
Args:
decays (dict): A dict of dicts containing a key for each pollutant that
decays and, within that, a key for each parameter (a constant and
decays (dict): A dict of dicts containing a key for each pollutant that
decays and, within that, a key for each parameter (a constant and
exponent)
parent (object): An object that can be used to read temperature data from
"""
Expand Down Expand Up @@ -1177,7 +1177,7 @@ def __init__(self, number_of_timesteps=0, **kwargs):
self.internal_arc = AltQueueArc(
in_port=self, out_port=self, number_of_timesteps=self.number_of_timesteps
)
# TODO should mass balance call internal arc (is this arc called in arc mass
# TODO should mass balance call internal arc (is this arc called in arc mass
# balance?)

def get_avail(self):
Expand Down Expand Up @@ -1351,7 +1351,7 @@ def __init__(self, decays={}, parent=None, number_of_timesteps=1, **kwargs):
def _end_timestep(self):
"""End timestep wrapper that removes decayed pollutants and calls internal
arc."""
# TODO Should the active storage decay if decays are given (probably.. though
# TODO Should the active storage decay if decays are given (probably.. though
# that sounds like a nightmare)?
self.storage = self.extract_vqip(self.storage, self.internal_arc.total_decayed)
self.storage_ = self.copy_vqip(self.storage)
Expand Down
14 changes: 7 additions & 7 deletions wsimod/nodes/wtw.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def treat_current_input(self):
# Calculate effluent, liquor and solids
discharge_holder = self.empty_vqip()

# Assume non-additive pollutants are unchanged in discharge and are
# Assume non-additive pollutants are unchanged in discharge and are
# proportionately mixed in liquor
for key in constants.NON_ADDITIVE_POLLUTANTS:
discharge_holder[key] = influent[key]
Expand All @@ -124,9 +124,9 @@ def treat_current_input(self):
+ influent["volume"] * self.liquor_multiplier["volume"]
)

# TODO this should probably just be for process_parameters.keys() to avoid
# TODO this should probably just be for process_parameters.keys() to avoid
# having to declare non changing parameters
# TODO should the liquoring be temperature sensitive too? As it is the solids
# TODO should the liquoring be temperature sensitive too? As it is the solids
# will take the brunt of the temperature variability which maybe isn't sensible
for key in constants.ADDITIVE_POLLUTANTS + ["volume"]:
if key != "volume":
Expand Down Expand Up @@ -244,7 +244,7 @@ def calculate_discharge(self):
# Run WWTW model

# Try to clear stormwater
# TODO (probably more tidy to use push_set_sewer? though maybe less
# TODO (probably more tidy to use push_set_sewer? though maybe less
# computationally efficient)
excess = self.get_excess_throughput()
if (self.stormwater_tank.get_avail()["volume"] > constants.FLOAT_ACCURACY) & (
Expand Down Expand Up @@ -409,7 +409,7 @@ def __init__(
- See `wtw.py/WTW` for treatment.
- Stores treated water in a service reservoir tank, with a single tank
per `FWTW` node.
- Aims to satisfy a throughput that would top up the service reservoirs
- Aims to satisfy a throughput that would top up the service reservoirs
until full.
- Currently, will not allow a deficit, thus introducing water from
'other measures' if pulls cannot fulfil demand. Behaviour under a
Expand Down Expand Up @@ -452,9 +452,9 @@ def __init__(
datum=self.service_reservoir_storage_elevation,
initial_storage=self.service_reservoir_initial_storage,
)
# self.service_reservoir_tank.storage['volume'] =
# self.service_reservoir_tank.storage['volume'] =
# self.service_reservoir_inital_storage
# self.service_reservoir_tank.storage_['volume'] =
# self.service_reservoir_tank.storage_['volume'] =
# self.service_reservoir_inital_storage

# Mass balance
Expand Down

0 comments on commit 07906ac

Please sign in to comment.