pump_controller
Class for PumpController
- class PumpController(net, edges, targets, setpoints, **kwargs)[source]
Bases:
Controller
Class for PumpController. The goal of the PumpController is to adjust the lift of controlled pumps such that the given setpoints are met. For each controlled pump, a pressure setpoint in a target node must be specified and a path must exist that starts at the network pressure boundary node, passes through the pump, and reaches the target node where the pressure setpoint is enforced.
The controller then tries to minimize a function \(f(L)\) such that:
\[f(L) = p_s - (p_0 - \Delta p(L))\]where:
\(p_s\) is the pressure setpoint (Pa)
\(p_0\) is the pressure (Pa) at the pressure boundary node
\(L\) is the pressure lift (Pa) of the pump
\(\Delta p(L)\) is the sum of edge pressure differences (Pa) in the path
- __init__(net, edges, targets, setpoints, **kwargs)[source]
Inits PumpController and check the correctness of inputs.
- Parameters:
net (Network) – Network object. The controller stores a pointer to the network object.
edges (array_like) – List of names of the controlled pumps.
targets (array_like) – List of nodes for which setpoints are given. The order of elements shoud match the order of edges such that the nth edge in edges has a setpoint in the nth node in targets.
setpoints (array_like) – List of static pressure setpoints to be achieved by the pumps in edges in the target noodes. The order of elements shoud match the order of target nodes such that the nth pressure setpoint value in setpoints refers to the nth node in targets.
- Return type:
None.
- compute_der()[source]
Computes the derivative of f(L) with respect to L
- Returns:
der – List of derivatives.
- Return type:
Array
- compute_residuals(delta_p)[source]
Computes f(L) using the given values of Delta p.
- Parameters:
delta_p (Array) – Array contanining values of Delta p for all edges of the Network. The order of values must match the internal order of edges in the network object.
- Returns:
err_op – Array contanining the computed values of f(L).
- Return type:
Array
- property path_masks
Returns a generator of masks for the paths in the control matrix
- Yields:
Array – Array of indices of non-zero values in a row of the control matrix.