transferinterfaces

This module defines submodel interfaces for calculating water transfers into or out of main models like those of the HydPy-Dam model family.

Module transferinterfaces implements the following members:

  • TransferModel_V1 Interface for calculating water transfers based on the main model’s current water volume and allowed discharge.


class hydpy.interfaces.transferinterfaces.TransferModel_V1[source]

Bases: SubmodelInterface, ABC

Interface for calculating water transfers based on the main model’s current water volume and allowed discharge.

TransferModel_V1 separates determining, querying, and setting the water transfer. This allows coupling with numerically solved main models like dam_llake, which let the submodel determine the transfer for multiple intermediate states within one simulation step (via determine_transfer()) and query the results (via get_transfer()). At the end of the simulation step, the main model passes the step-averaged transfer back (via set_transfer()), so the submodel can process the final value further, for example, by passing it to an outlet node.

typeid: ClassVar[Literal[1]] = 1

Type identifier for TransferModel_V1 submodels.

determine_transfer(watervolume: float, alloweddischarge: float) → None[source]

Determine the water transfer based on the water volume (million m³) and the highest discharge (m³/s) the main model can currently lose.

get_transfer() → float[source]

Return the water transfer in m³/s determined by the last call of determine_transfer().

Positive values indicate withdrawals; negative values indicate supplies.

set_transfer(transfer: float) → None[source]

Set the final water transfer in m³/s averaged over the current simulation step.

Positive values indicate withdrawals; negative values indicate supplies.