aquakin.Aeration#
- class aquakin.Aeration(kla=None, do_setpoint=None, do_sat=8.0, species='SO', controller=None, sensor=None, gain=1.0, Kp=25.0, Ti=0.002, Tt=0.001, kla_offset=120.0, kla_min=0.0, kla_max=360.0, temperature_correction=False, ref_T=293.15, alpha=1.0, beta=1.0, pressure_factor=1.0, kla_theta=1.024, saturation_model='benson_krause')[source]#
Bases:
objectAeration / dissolved-oxygen spec for a
CSTRUnit.The quantity a designer actually thinks in, instead of a raw mass-transfer coefficient on a state variable. Choose exactly one mode.
Open loop – a fixed mass-transfer coefficient (the saturation defaults sensibly, so the common case is one number):
Aeration(kla=120) # do_sat defaults to 8.0 gO2/m3 Aeration(kla=120, do_sat=9.0)
Closed loop – a dissolved-oxygen setpoint. The plant auto-wires a PI controller that manipulates this tank’s kLa to hold the setpoint:
Aeration(do_setpoint=2.0) # this tank holds DO = 2.0 on its own
Several tanks share one controller by giving the same
controllerid – the BSM2 design, one sensor driving several reactors at per-tank gains:Aeration(do_setpoint=2.0, controller="do", sensor="tank4", gain=1.0) Aeration(do_setpoint=2.0, controller="do", sensor="tank4", gain=0.5)
- Parameters:
kla (float, optional) – Open-loop mass-transfer coefficient (1/time). Mutually exclusive with
do_setpoint.do_setpoint (float, optional) – Closed-loop dissolved-oxygen target (same units as
species).do_sat (float) – Saturation concentration in the aeration term
kLa*(do_sat - C). Default 8.0 (gO2/m3, the usual ASM oxygen saturation).species (str) – The aerated species (default
"SO").controller (str, optional) – Closed-loop only. Shared-controller id: tanks giving the same id share one PI controller (and the controller unit takes this name).
None(the default) gives this tank its own dedicated controller.sensor (str, optional) – Closed-loop only. Name of the unit whose oxygen the controller measures. Defaults to the controlled tank itself (per-tank control).
gain (float) – Closed-loop only. This tank’s share of the controller’s kLa output (default 1.0), so one shared controller can drive tanks at different rates.
Kp (float) – Closed-loop PI tuning and output bounds. Defaults are the BSM2 DO loop: Kp=25, Ti=0.002 d, Tt=0.001 d, offset 120, bounds [0, 360] d^-1.
Ti (float) – Closed-loop PI tuning and output bounds. Defaults are the BSM2 DO loop: Kp=25, Ti=0.002 d, Tt=0.001 d, offset 120, bounds [0, 360] d^-1.
Tt (float) – Closed-loop PI tuning and output bounds. Defaults are the BSM2 DO loop: Kp=25, Ti=0.002 d, Tt=0.001 d, offset 120, bounds [0, 360] d^-1.
kla_offset (float) – Closed-loop PI tuning and output bounds. Defaults are the BSM2 DO loop: Kp=25, Ti=0.002 d, Tt=0.001 d, offset 120, bounds [0, 360] d^-1.
kla_min (float) – Closed-loop PI tuning and output bounds. Defaults are the BSM2 DO loop: Kp=25, Ti=0.002 d, Tt=0.001 d, offset 120, bounds [0, 360] d^-1.
kla_max (float) – Closed-loop PI tuning and output bounds. Defaults are the BSM2 DO loop: Kp=25, Ti=0.002 d, Tt=0.001 d, offset 120, bounds [0, 360] d^-1.
temperature_correction (bool) – First of the oxygen-transfer corrections – all off / identity by default, so a default
Aerationis bit-faithful to the IWA benchmark constant-saturation, constant-kLa definition. WhenTrue, temperature-correct the oxygen driving force using the tank’s operating temperature (the flow-weighted inletTthe kinetics already use, falling back to the staticTcondition). The saturation is scaled by the clean-water ratioC_s(T)/C_s(ref_T)(oxygen_saturation()) and – for an open-loop fixedkla– the transfer coefficient bykla_theta**(T - ref_T).False(default) leaves both constant. Removes the internal inconsistency whereby a warm run already speeds the (Arrhenius) biology while the oxygen saturation stays pinned. A closed-loop controlledklais not theta-scaled (the controller already manipulates it to hold the setpoint), but its driving-force saturation still gets theC_s(T)correction.ref_T (float) – Reference temperature (Kelvin) at which
do_satandklaare specified, so the correction is unity there. Default 293.15 (20 degC).alpha (float) – Process kLa-transfer factor (alpha_F): a constant multiplier on
kla(clean-water -> process water; typically 0.4-0.7 in activated sludge). Default 1.0. Applied to the open-loopklaonly.beta (float) – Salinity saturation factor: a constant multiplier on
do_sat(typically 0.95-0.99). Default 1.0.pressure_factor (float) – Elevation / barometric saturation factor: a constant multiplier on
do_sat(< 1at altitude). Default 1.0.kla_theta (float) – Arrhenius base for the open-loop
kla(T) = kla*kla_theta**(T-ref_T)correction (only used whentemperature_correctionis on). Default 1.024, the standard value.saturation_model (str) – Which clean-water saturation correlation supplies the temperature- correction ratio
C_s(T)/C_s(ref_T):"benson_krause"(default, the APHA correlation) or"bsm2"(the IWA benchmark van’t Hoff formula,oxygen_saturation_bsm2()). Use"bsm2"to match the benchmark’s oxygen driving force exactly; the two differ by ~0.5 % in shape. Only used whentemperature_correctionis on.
- __init__(kla=None, do_setpoint=None, do_sat=8.0, species='SO', controller=None, sensor=None, gain=1.0, Kp=25.0, Ti=0.002, Tt=0.001, kla_offset=120.0, kla_min=0.0, kla_max=360.0, temperature_correction=False, ref_T=293.15, alpha=1.0, beta=1.0, pressure_factor=1.0, kla_theta=1.024, saturation_model='benson_krause')#
- Parameters:
kla (float | None)
do_setpoint (float | None)
do_sat (float)
species (str)
controller (str | None)
sensor (str | None)
gain (float)
Kp (float)
Ti (float)
Tt (float)
kla_offset (float)
kla_min (float)
kla_max (float)
temperature_correction (bool)
ref_T (float)
alpha (float)
beta (float)
pressure_factor (float)
kla_theta (float)
saturation_model (str)
- Return type:
None
Methods
__init__([kla, do_setpoint, do_sat, ...])controller_id(unit_name)The id that groups tanks onto one controller: the shared
controllerif given, else the tank's own name (a dedicated per-tank controller).signal_name(unit_name)The control-signal name the controlled tank reads and its controller publishes.
Attributes
KpTiTtalphabetacontrollerdo_satdo_setpointgainis_closed_loopklakla_maxkla_minkla_offsetkla_thetapressure_factorref_Tsaturation_modelsensorspeciestemperature_correction