aquakin.ChlorineContactUnit#
- class aquakin.ChlorineContactUnit(name, model, volume, dose, ct_per_log, decay_rate=0.0, baffling_factor=0.5, max_log=None, inlet_density=0.0, initial_residual=0.0, dechlorinate=False, input_port='in', output_port='out')[source]#
Bases:
objectA chlorine contact tank: CT-driven log-removal with residual decay.
The applied chlorine residual is a dynamic state (a completely-mixed tank with first-order decay,
dCl/dt = (Q/V)(dose − Cl) − k_decay·Cl); the CT creditresidual × T10drives the log-removal. Passes the process stream through and reduces the indicator-organism density (Stream.org, elseinlet_density).dechlorinatereports the discharged residual as zero (the credit is already earned in the tank) – e.g. a downstream bisulfite dose.- Parameters:
name (str)
model (CompiledModel)
volume (float) – Contact-tank volume (m³).
dose (float) – Applied chlorine dose at the inlet (g Cl/m³ ≡ mg/L).
ct_per_log (float) – CT (residual × T10) that earns one log of inactivation, in the same units as
residual × time(from the regulatory CT tables for the organism / pH / temperature). Time-unit trap:T10 = baffling·V/Qis in the plant’s time unit (days for the BSM models, whose rate constants are1/d), while the regulatory CT tables are in mg·min/L. Supplyct_per_login the plant time unit – e.g. for a days-based plant multiply a mg·min/L table value by1/1440(min→day) – or both the CT and the credit are off by1440×.V/Qanddecay_rateare in that same plant time unit.decay_rate (float) – First-order chlorine-decay rate (1/time, plant time unit). Default 0.
baffling_factor (float) – T10/HRT factor for the contact time (
T10 = baffling·V/Q). Default 0.5.max_log (float, optional) – Cap on the log-removal.
None= uncapped.inlet_density (float) – Indicator density used when the inlet carries none. Default 0.
initial_residual (float) – Initial chlorine residual state (g/m³). Default 0.
dechlorinate (bool) – If true, the reported discharged residual is 0. Default False.
input_port (str)
output_port (str)
- __init__(name, model, volume, dose, ct_per_log, decay_rate=0.0, baffling_factor=0.5, max_log=None, inlet_density=0.0, initial_residual=0.0, dechlorinate=False, input_port='in', output_port='out')#
- Parameters:
name (str)
model (CompiledModel)
volume (float)
dose (float)
ct_per_log (float)
decay_rate (float)
baffling_factor (float)
max_log (float | None)
inlet_density (float)
initial_residual (float)
dechlorinate (bool)
input_port (str)
output_port (str)
- Return type:
None
Methods
__init__(name, model, volume, dose, ct_per_log)compute_outputs(t, state, inputs, params[, ...])ct(residual, flow)CT = residual × T10, with
T10 = baffling·V/Q(plant time unit).discharged_residual(state)The chlorine residual leaving the tank (0 if dechlorinated).
flow_outputs(input_flows, params[, ctx])initial_state()log_removal(residual, flow)The chlorine CT log-removal at the given residual and throughflow.
rhs(t, state, inputs, params[, signals])Attributes
baffling_factordecay_ratedechlorinateinitial_residualinlet_densityinput_portinput_portsmax_logoutput_portoutput_portsstate_sizenamemodelvolumedosect_per_log- ct(residual, flow)[source]#
CT = residual × T10, with
T10 = baffling·V/Q(plant time unit).- Return type:
Array