aquakin.CSTRUnit#
- class aquakin.CSTRUnit(name, model, volume, input_port_names, conditions=<factory>, aeration=None, output_port='out')[source]#
Bases:
AerationUnit,CouplingAwareA single continuous-flow stirred tank with kinetics + aeration.
- Parameters:
name (str) – Unit identifier.
model (CompiledModel) – Kinetic model whose rate functions provide the chemistry term.
volume (float) – Tank liquid volume.
input_port_names (list[str]) – Names of the incoming-stream ports. Multiple inflows are summed (treated as a built-in mixer) before the mass balance.
conditions (dict[str, float]) – Spatially-uniform condition values (e.g.
{"T": 293.15}). One value per condition declared by the model.aeration (Aeration, optional) – How the tank is aerated.
None(default) is an anoxic/anaerobic tank (no aeration).Aeration(kla=120)is open-loop aeration at a fixed mass-transfer coefficient;Aeration(do_setpoint=2.0)is closed-loop dissolved-oxygen control, for which the plant auto-wires a PI controller on this tank’s kLa (seeAeration).output_port (str) – Name of the single output port.
- __init__(name, model, volume, input_port_names, conditions=<factory>, aeration=None, output_port='out')#
- Parameters:
name (str)
model (CompiledModel)
volume (float)
input_port_names (list[str])
conditions (dict[str, float])
aeration (Aeration | None)
output_port (str)
- Return type:
None
Methods
__init__(name, model, volume, input_port_names)compute_outputs(t, state, inputs, params[, ...])Structural Jacobian sparsity.
flow_outputs(input_flows, params[, ctx])Outflow equals total inflow (constant-volume reactor).
initial_state()rhs(t, state, inputs, params[, signals])set_temperature(temperature_K)Set this reactor's static operating temperature (Kelvin).
Attributes
aerationinput_portsoutput_portoutput_portsrequired_signalsControl-signal names this unit reads from the bus in
rhs(the closed-loop aeration signal, if any).state_sizenamemodelvolumeinput_port_namesconditions- set_temperature(temperature_K)[source]#
Set this reactor’s static operating temperature (Kelvin).
Updates the
Tcondition (and its precomputed rate-evaluation array) in place, so a re-solve runs the kinetics – including any Arrheniustemperature_corrections– at the new temperature. A no-op for a model that declares noTcondition. The plant clears its compiled- solve cache after calling this; on a bare unit, rebuild any cached solve.- Parameters:
temperature_K (float)
- Return type:
None
- coupling_pattern()[source]#
Structural Jacobian sparsity.
selfis the reaction kinetics’ coupling from the rate AST (a saturated Monod term is numerically invisible at any single state, so the syntactic dependency is needed, not a probe).inletis the convective dilution(Q/V)(C_in - C), which couples each species’ derivative to its own inlet concentration only – the identity.