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

Update cdc.py #312

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 3 additions & 61 deletions aguaclara/design/cdc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""The chemical dose controller (CDC) of an AguaClara plant uses the linear
relation between flow rate and entrance tank water level (set by the LFOM) to
dose the correct amount of coagulant and chlorine into the entrance tank.

Example:
>>> from aguaclara.design.cdc import *
>>> cdc = CDC(q = 20 * u.L/u.s, coag_type = 'pacl')
Expand All @@ -18,7 +17,6 @@

class CDC(Component):
"""Design an AguaClara plant's chemical dose controller.

Design Inputs:
- ``q (float * u.L / u.s)``: Flow rate (required)
"""
Expand All @@ -30,7 +28,6 @@ def __init__(self, **kwargs):

self.coag_dose_conc_max=100 * u.mg / u.L
self.coag_stock_conc=150 * u.g / u.L
self.coag_stock_conc_est=150 * u.g / u.L # Deprecated since January 2021
self.coag_stock_min_est_time=1 * u.day
self.chem_tank_vol_supplier=[208.198, 450, 600, 750, 1100, 2500] * u.L
self.chem_tank_dimensions_supplier=[
Expand All @@ -52,7 +49,6 @@ def __init__(self, **kwargs):
def alum_nu(self, coag_conc):
"""
Return the dynamic viscosity of water at a given temperature.

If given units, the function will automatically convert to Kelvin.
If not given units, the function will assume Kelvin.
This function assumes that the temperature dependence can be explained
Expand All @@ -63,57 +59,22 @@ def alum_nu(self, coag_conc):
(1 + (4.255 * 10 ** -6) * coag_conc.magnitude ** 2.289) * \
pc.viscosity_kinematic_water(self.temp)
return alum_nu

def _alum_nu(self, coag_conc):
"""
.. deprecated::
`_alum_nu` is deprecated; use `alum_nu` instead.
"""
# Deprecated since January 2021
warnings.warn('_alum_nu is deprecated; use alum_nu instead.',
UserWarning)

return self.alum_nu(coag_conc)


def pacl_nu(self, coag_conc):
"""Return the dynamic viscosity of water at a given temperature.

If given units, the function will automatically convert to Kelvin.
If not given units, the function will assume Kelvin.
This function assumes that the temperature dependence can be explained
based on the effect on water and that there is no confounding effect
based on the effect on water and that there is no confounding effect
from the coagulant.
"""
pacl_nu = \
(1 + (2.383 * 10 ** -5) * (coag_conc).magnitude ** 1.893) * \
pc.viscosity_kinematic_water(self.temp)
return pacl_nu

def _pacl_nu(self, coag_conc):
"""
.. deprecated::
`_pacl_nu` is deprecated; use `pacl_nu` instead.
"""
# Deprecated since January 2021
warnings.warn('_pacl_nu is deprecated; use pacl_nu instead.',
UserWarning)

return self.pacl_nu(coag_conc)

def _coag_nu(self, coag_conc, coag_type):
"""
.. deprecated::
`_coag_nu` is deprecated; use `coag_nu` instead.
"""
# Deprecated since January 2021
warnings.warn('_coag_nu is deprecated; use coag_nu instead.',
UserWarning)

return self.coag_nu(coag_conc, coag_type)

def coag_nu(self, coag_conc, coag_type):
"""Return the dynamic viscosity of water at a given temperature.

If given units, the function will automatically convert to Kelvin.
If not given units, the function will assume Kelvin.
"""
Expand All @@ -123,25 +84,6 @@ def coag_nu(self, coag_conc, coag_type):
coag_nu = self.pacl_nu(coag_conc)
return coag_nu

@property
def coag_q_max_est(self):
"""The estimated maximum permissible flow rate of the coagulant stock,
based on a whole number of sacks of coagulant used.

.. deprecated::
`coag_q_max_est` is deprecated; use `coag_q_max` instead, which is
based on the exact user-defined coagulant stock concentration,
`coag_stock_conc`.
"""
# Deprecated since January 2021
warnings.warn('coag_q_max_est is deprecated; use coag_q_max instead,\
which is based on the exact user-defined coagulant stock \
concentration, coag_stock_conc.', UserWarning)

coag_q_max_est = self.q * self.coag_dose_conc_max / \
self.coag_stock_conc_est
return coag_q_max_est

@property
def coag_q_max(self):
"""The maximum permissible flow rate of the coagulant stock."""
Expand Down Expand Up @@ -207,7 +149,7 @@ def coag_tubes_active_n(self):

@property
def coag_tubes_n(self):
"""The number of coagulant tubes in use, plus a spare tube for
"""The number of coagulant tubes in use, plus a spare tube for
maintenance.
"""
coag_tubes_n = self.coag_tubes_active_n + 1
Expand Down