aquakin.SetpointSplitter#
- class aquakin.SetpointSplitter(name, model, output_port_flows, remainder_port)[source]#
Bases:
_SplitterBaseSplits the inlet flow into fixed absolute setpoint flows plus a remainder.
The named outputs are flow-controlled pumps delivering fixed absolute setpoint flows (m³/d);
remainder_porttakes whatever is left (Q_in - sum(setpoints)). This is the correct model for the BSM recycle pumps (internal recycle, RAS, wastage), whose volumetric flows are held constant regardless of influent – seebuild_bsm1(). A fixed fraction of throughput (RatioSplitter), by contrast, makes the recycle-flow loop gain near-singular off the design influent and the plant blows up under dynamic flow.If the feed transiently drops below the total setpoint the material streams (
compute_outputs()) share the available flow proportionally (q·min(1, Q_in/Σsetpoints)) with a zero remainder, so the unit never carries more than it receives. The recycle-flow rule (flow_outputs()) stays the exact affineQ_in − Σsetpointsremainder (which the linear recycle solve requires); the two coincide wheneverQ_in ≥ Σsetpoints, true at any steady state. The setpoints areFlowSetpoints, so a plant is differentiable w.r.t. them (SRT / recycle-ratio design sweeps).- Parameters:
name (str) – Unit identifier.
model (CompiledModel)
output_port_flows (dict[str, float]) – Output port name -> fixed setpoint flow (m³/d).
remainder_port (str) – The output port carrying the remaining flow. Must not also be a setpoint port.
- __init__(name, model, output_port_flows, remainder_port)#
- Parameters:
name (str)
model (CompiledModel)
output_port_flows (dict[str, float])
remainder_port (str)
- Return type:
None
Methods
__init__(name, model, output_port_flows, ...)compute_outputs(t, state, inputs, params[, ...])coupling_pattern()No state -> no structural Jacobian contribution.
flow_outputs(input_flows, params[, ctx])Output port flows: the fixed setpoints plus the exact AFFINE remainder
Q_in - sum(setpoints)(which the linear recycle solve requires).flow_param_defaults()Ordered default setpoint values (the unit's flow-parameter block).
flow_param_local_names()Ordered setpoint names, used to address the flow parameters by name.
initial_state()rhs(t, state, inputs, params[, signals])Attributes
input_portsoutput_portsstate_sizeoutput_port_flowsremainder_portnamemodel- flow_outputs(input_flows, params, ctx=None)[source]#
Output port flows: the fixed setpoints plus the exact AFFINE remainder
Q_in - sum(setpoints)(which the linear recycle solve requires). The remainder may go negative in a transient starve, harmless for the linear flow solve; the conserving scale-down lives incompute_outputs(), and the two agree wherever the unit is not starved.- Parameters:
input_flows (dict)
params (Array)
- Return type:
dict