Python API¶
Pumping Station Mixin¶
-
class
rtctools_hydraulic_structures.pumping_station_mixin.
PumpingStationMixin
(*args, **kwargs)[source]¶ Bases:
rtctools.optimization.optimization_problem.OptimizationProblem
Adds handling of PumpingStation objects in your model to your optimization problem.
Relevant parameters and variables are read from the model, and from this data a set of constraints and objectives are automatically generated to minimize cost.
If historical data regarding the status of the pumps is provided, this information is used to ensure that the minimum amount of time a pump must be on / off is respected.
-
pumping_stations
() → List[rtctools_hydraulic_structures.pumping_station_mixin.PumpingStation][source]¶ User problem returns list of
PumpingStation
objects.Returns: A list of pumping stations.
-
pumpingstation_cache_hq_subproblem
= True¶ Use pickle to cache the HQ subproblems that are solved.
-
pumpingstation_energy_price_symbol
= 'energy_price'¶ Energy price symbol to use if no symbol specified per pumping station or per pump.
-
-
class
rtctools_hydraulic_structures.pumping_station_mixin.
Pump
(optimization_problem, symbol, energy_price_symbol, semi_continuous=None, status_history=None)[source]¶ Bases:
rtctools_hydraulic_structures.util._ObjectParameterWrapper
Python Pump object as an interface to the
Pump
object in the model.-
__init__
(optimization_problem, symbol, energy_price_symbol, semi_continuous=None, status_history=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
rtctools_hydraulic_structures.pumping_station_mixin.
Resistance
(optimization_problem, symbol)[source]¶ Bases:
rtctools_hydraulic_structures.util._ObjectParameterWrapper
Python Resistance object as an interface to the
Resistance
object in the model.-
__init__
(optimization_problem, symbol)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
rtctools_hydraulic_structures.pumping_station_mixin.
PumpingStation
(optimization_problem: rtctools.optimization.optimization_problem.OptimizationProblem, symbol: str, pump_symbols: List[str] = None, energy_price_symbols: Union[str, List[str]] = None, semi_continuous: Union[str, List[str]] = None, status_history: Union[str, List[str]] = None, **kwargs)[source]¶ Bases:
rtctools_hydraulic_structures.util._ObjectParameterWrapper
Python PumpingStation object as an interface to the
PumpingStation
object in the model.-
__init__
(optimization_problem: rtctools.optimization.optimization_problem.OptimizationProblem, symbol: str, pump_symbols: List[str] = None, energy_price_symbols: Union[str, List[str]] = None, semi_continuous: Union[str, List[str]] = None, status_history: Union[str, List[str]] = None, **kwargs)[source]¶ Initialize the pumping station object.
Parameters: - optimization_problem –
OptimizationProblem
instance. - symbol – Symbol name of the pumping station in the model.
- pump_symbols – Symbol names of the pumps in the pumping station.
- energy_price_symbols – String or list of names of the energy price’s time series of the pumps in the pumping station.
- semi_continuous – String or list of names of the constant input indicating use of the semi-continuous approach
- status_history – String or list of names of the pump status history time series. If string, one can use e.g. “{pump}_status_hist” to map to “pumpingstation1.pump1_status_hist”, with “pumpingstation1.pump1” the pump symbol.
- optimization_problem –
-
pumps
() → List[rtctools_hydraulic_structures.pumping_station_mixin.Pump][source]¶ Get a list of
Pump
objects that are part of this pumping station in the model.Returns: List of Pump
objects.
-
resistances
() → List[rtctools_hydraulic_structures.pumping_station_mixin.Resistance][source]¶ Get a list of
Resistance
objects that are part of this pumping station in the model.Returns: List of Resistance
objects.
-
-
class
rtctools_hydraulic_structures.pumping_station_mixin.
MinimizePumpCostGoal
(use_dynamic_nominal: bool = True, exclude_continuous: bool = False, *args, **kwargs)[source]¶ Bases:
rtctools_hydraulic_structures.pumping_station_mixin._MinimizePumpGoal
Goal that minimizes overall energy costs.
Loops over all pumps in all pumping stations, integrating all instantaneous pump operating costs (and any start-up and shut-down costs/energy) in the optimization window into one objective value.
Variables: - function_nominal – Nominal value of needed for scaling. Guessed automatically based on the power range of all pumps.
- priority – Priority of this goal. Default is
sys.maxsize
.
-
class
rtctools_hydraulic_structures.pumping_station_mixin.
MinimizePumpEnergyGoal
(use_dynamic_nominal: bool = True, exclude_continuous: bool = False, *args, **kwargs)[source]¶ Bases:
rtctools_hydraulic_structures.pumping_station_mixin._MinimizePumpGoal
Goal that minimizes overall energy consumption.
Loops over all pumps in all pumping stations, integrating all instantaneous pump powers (and any start-up and shut-down energy) in the optimization window into one objective value.
Variables: - function_nominal – Nominal value of needed for scaling. Guessed automatically based on the power range of all pumps.
- priority – Priority of this goal. Default is
sys.maxsize
.
Weir Mixin¶
-
class
rtctools_hydraulic_structures.weir_mixin.
WeirMixin
(*args, **kwargs)[source]¶ Bases:
rtctools.optimization.optimization_problem.OptimizationProblem
Adds handling of Weir objects in your model to your optimization problem.
-
class
rtctools_hydraulic_structures.weir_mixin.
Weir
(optimization_problem, name)[source]¶ Bases:
rtctools_hydraulic_structures.util._ObjectParameterWrapper
Python Weir object as an interface to the Weir object in the model.
In the optimization, the weir flow is implemented as constraints. It means that the optimization calculated a flow (not weir height!), that is forced by the constraints to be a physically possible weir flow.