aquakin.ThresholdSplitter#

class aquakin.ThresholdSplitter(name, model, threshold, threshold_port, remainder_port)[source]#

Bases: _SplitterBase

Diverts inlet flow above a threshold, passing the rest through.

Inlet flow above threshold goes to threshold_port (max(Q_in - threshold, 0)) and the rest (min(Q_in, threshold)) to remainder_port. This is the BSM2 hydraulic influent bypass (flow above a limit diverted around the treatment). The split is piecewise-linear (a kink at threshold), so the exact recycle-flow solve (Plant._resolve_flows()) is only exact when the inlet flow is independent of the recycle flows – e.g. fed directly by an external influent, as in build_bsm2(). The threshold is a FlowSetpoint, so a plant is differentiable w.r.t. it.

Parameters:
  • name (str) – Unit identifier.

  • model (CompiledModel)

  • threshold (float) – Inlet-flow limit (m³/d).

  • threshold_port (str) – The output port carrying the above-threshold flow.

  • remainder_port (str) – The output port carrying the remaining (below-threshold) flow. Must differ from threshold_port.

__init__(name, model, threshold, threshold_port, remainder_port)#
Parameters:
  • name (str)

  • model (CompiledModel)

  • threshold (float)

  • threshold_port (str)

  • remainder_port (str)

Return type:

None

Methods

__init__(name, model, threshold, ...)

compute_outputs(t, state, inputs, params[, ...])

coupling_pattern()

No state -> no structural Jacobian contribution.

flow_outputs(input_flows, params[, ctx])

Output port flows: the above/below-threshold split (piecewise-linear).

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

threshold

threshold_port

remainder_port

name

model

flow_outputs(input_flows, params, ctx=None)[source]#

Output port flows: the above/below-threshold split (piecewise-linear).

Parameters:
  • input_flows (dict)

  • params (Array)

Return type:

dict