aquakin.SetpointSplitter#

class aquakin.SetpointSplitter(name, model, output_port_flows, remainder_port)[source]#

Bases: _SplitterBase

Splits 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_port takes 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 – see build_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 affine Q_in Σsetpoints remainder (which the linear recycle solve requires); the two coincide whenever Q_in Σsetpoints, true at any steady state. The setpoints are FlowSetpoint s, 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_ports

output_ports

state_size

output_port_flows

remainder_port

name

model

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 in compute_outputs(), and the two agree wherever the unit is not starved.

Parameters:
  • input_flows (dict)

  • params (Array)

Return type:

dict