HydPy-Dam-Pump-Sluice (pumping station with sluice model)¶
dam_pump_sluice combines the “forced discharge” component of dam_pump with the
“free discharge” component of dam_sluice.
Integration tests¶
Note
When new to HydPy, consider reading section Integration Tests first.
We take all of the following settings from the documentation on the application models
dam_pump and dam_sluice:
>>> from hydpy import IntegrationTest, Element, Node, pub, round_
>>> pub.timegrids = "2000-01-01", "2000-01-21", "1d"
>>> from hydpy.aliases import dam_receivers_OWL, dam_receivers_RWL
>>> inflow = Node("inflow")
>>> outflow = Node("outflow")
>>> outer = Node("outer", variable=dam_receivers_OWL)
>>> remote = Node("remote", variable=dam_receivers_RWL)
>>> dam = Element("dam", inlets=inflow, outlets=outflow, receivers=(outer, remote))
>>> from hydpy.models.dam_pump_sluice import *
>>> parameterstep()
>>> dam.model = model
>>> surfacearea(1.44)
>>> catchmentarea(86.4)
>>> watervolume2waterlevel(PPoly(xs=[0.0, 1.0], ys=[0.0, 1.0]))
>>> waterlevelmaximumthreshold(1.0)
>>> waterlevelmaximumtolerance(0.1)
>>> remotewaterlevelmaximumthreshold(2.0)
>>> remotewaterlevelmaximumtolerance(0.1)
>>> crestlevel(1.0)
>>> crestleveltolerance(0.1)
>>> correctionprecipitation(1.0)
>>> correctionevaporation(1.0)
>>> weightevaporation(0.8)
>>> thresholdevaporation(0.0)
>>> toleranceevaporation(0.001)
>>> with model.add_precipmodel_v2("meteo_precip_io"):
... precipitationfactor(1.0)
>>> with model.add_pemodel_v1("evap_ret_io"):
... evapotranspirationfactor(1.0)
>>> test = IntegrationTest(dam)
>>> test.dateformat = "%d.%m."
>>> test.plotting_options.axis1 = fluxes.inflow, fluxes.outflow
>>> test.plotting_options.axis2 = factors.waterlevel, factors.outerwaterlevel, factors.remotewaterlevel
>>> test.inits = [(states.watervolume, 0.0),
... (logs.loggedadjustedevaporation, 0.0),
... (logs.loggedouterwaterlevel, 0.0),
... (logs.loggedremotewaterlevel, 0.0)]
>>> test.reset_inits()
>>> conditions = model.conditions
>>> model.precipmodel.sequences.inputs.precipitation.series = 2.0
>>> model.pemodel.sequences.inputs.referenceevapotranspiration.series = 1.0
>>> inflow.sequences.sim.series = 2.0
>>> outer.sequences.sim.series = 0.0
>>> remote.sequences.sim.series = numpy.linspace(0.0, 3.0, 20)
pump only¶
First, we demonstrate the proper implementation of the “forced discharge” components by
enabling them, like in the drainage example of application model
dam_pump, while turning off the “free discharge” component:
>>> waterleveldifference2maxforceddischarge(PPoly(xs=[0.0], ys=[1.0]))
>>> waterleveldifference2maxfreedischarge(PPoly(xs=[0.0], ys=[0.0]))
To reproduce the results of dam_pump exactly, we must set DischargeTolerance to
zero (see the critical remark at the end of the documentation on method
Calc_FreeDischarge_V1):
>>> dischargetolerance(0.0)
The following results are identical to those of the drainage example:
>>> test("dam_pump_sluice_pump_only")
Click to see the table
There is no indication of an error in the water balance:
>>> round_(model.check_waterbalance(conditions))
0.0
sluice only¶
Next, we switch from pure “forced discharge” to pure “free discharge” according to the
drainage example on application model dam_sluice:
>>> waterleveldifference2maxforceddischarge(PPoly(xs=[0.0], ys=[0.0]))
>>> waterleveldifference2maxfreedischarge(PPoly(xs=[0.0, 1.0], ys=[0.0, 1.0]))
>>> dischargetolerance(0.1)
The following results are identical to those of the drainage example:
>>> test("dam_pump_sluice_sluice_only")
Click to see the table
>>> round_(model.check_waterbalance(conditions))
0.0
pump and sluice¶
The next example shows how dam_pump_sluice calculates both discharge types
simultaneously:
>>> waterleveldifference2maxforceddischarge(PPoly(xs=[0.0], ys=[1.0]))
>>> test("dam_pump_sluice_pump_and_sluice")
Click to see the table
>>> round_(model.check_waterbalance(conditions))
0.0
irrigation and sluice¶
The last example shows how MaxForcedDischarge calculates both discharge types
simultaneously but uses a negative value for maxforceddischarge (resulting in reverse flow direction,
e.g. to simulate irrigation processes):
>>> waterleveldifference2maxforceddischarge(PPoly(xs=[0.0], ys=[-1.0]))
>>> waterlevelmaximumthreshold(1.5)
>>> remotewaterlevelmaximumthreshold(0.5)
>>> test("dam_pump_sluice_irrigation_and_sluice")
Click to see the table
>>> round_(model.check_waterbalance(conditions))
0.0
Method features¶
- class hydpy.models.dam_pump_sluice.Model[source]¶
Bases:
ELSIEModel,MixinSimpleWaterBalance,Main_PrecipModel_V2,Main_PEModel_V1HydPy-Dam-Pump-Sluice (pumping station with sluice model).
- The following “receiver update methods” are called in the given sequence before performing a simulation step:
Pick_LoggedOuterWaterLevel_V1Update the receiver sequenceLoggedOuterWaterLevel.Pick_LoggedRemoteWaterLevel_V1Update the receiver sequenceLoggedRemoteWaterLevel.
- The following “inlet update methods” are called in the given sequence at the beginning of each simulation step:
Calc_Precipitation_V1If available, let a submodel that complies with thePrecipModel_V2interface determine precipitation.Calc_PotentialEvaporation_V1If available, let a submodel that complies with thePETModel_V1interface determine potential evaporation.Calc_AdjustedEvaporation_V1Adjust the given potential evaporation.
- The following methods define the relevant components of a system of ODE equations (e.g. direct runoff):
Calc_AdjustedPrecipitation_V1Adjust the given precipitation.Pick_Inflow_V1Update the inlet sequenceInflow.Calc_WaterLevel_V1Determine the water level based on an interpolation approach approximating the relationship between water volume and water level.Calc_OuterWaterLevel_V1Get the water level directly below the dam of the last simulation step.Calc_RemoteWaterLevel_V1Get the water level at a remote location of the last simulation step.Calc_WaterLevelDifference_V1Calculate the difference between the inner and the outer water level.Calc_EffectiveWaterLevelDifference_V1Calculate the “effective” difference between the inner and the outer water level above a threshold level.Calc_MaxForcedDischarge_V1Approximate the currently highest possible forced water release through structures as pumps based on seasonally varying interpolation approaches that take the water level difference as input.Calc_MaxFreeDischarge_V1Approximate the currently highest possible free water release through structures as sluices based on seasonally varying interpolation approaches that take the water level difference as input.Calc_ForcedDischarge_V1Calculate the actual forced water release through structures as pumps to prevent a too-high inner water level if a maximum water level at a remote location is not violated.Calc_FreeDischarge_V1Calculate the actual water flow through a hydraulic structure like a (flap) sluice that generally depends on the water level gradient but can be suppressed to stop releasing water if a maximum water level at a remote location is violated.Calc_ActualEvaporation_V1Calculate the actual evaporation.Calc_Outflow_V5Calculate the total outflow as the sum of free and forced discharge.
- The following methods define the complete equations of an ODE system (e.g. change in storage of fast water due to effective precipitation and direct runoff):
Update_WaterVolume_V1Update the actual water volume.
- The following “outlet update methods” are called in the given sequence at the end of each simulation step:
Calc_WaterLevel_V1Determine the water level based on an interpolation approach approximating the relationship between water volume and water level.Calc_OuterWaterLevel_V1Get the water level directly below the dam of the last simulation step.Calc_RemoteWaterLevel_V1Get the water level at a remote location of the last simulation step.Pass_Outflow_V1Update the outlet link sequenceQ.
- Users can hook submodels into the defined main model if they satisfy one of the following interfaces:
PrecipModel_V2Simple interface for determining precipitation in one step.PETModel_V1Simple interface for calculating all potential evapotranspiration values in one step.
- DOCNAME = ('Dam-Pump-Sluice', 'pumping station with sluice model')¶
- precipmodel¶
Optional submodel that complies with the following interface: PrecipModel_V2.
- pemodel¶
Optional submodel that complies with the following interface: PETModel_V1.
- REUSABLE_METHODS = ()¶
Parameter features¶
- class hydpy.models.dam_pump_sluice.ControlParameters(master: Parameters[TM_co], cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
ControlParametersControl parameters of model dam_pump_sluice.
- The following classes are selected:
SurfaceAreaAverage size of the water surface [km²].CatchmentAreaSize of the catchment draining into the dam [km²].CorrectionPrecipitationPrecipitation correction factor [-].CorrectionEvaporationEvaporation correction factor [-].WeightEvaporationTime weighting factor for evaporation [-].WaterLevelMaximumThresholdThe water level not to be exceeded [m].WaterLevelMaximumToleranceA tolerance value for the water level maximum [m].RemoteWaterLevelMaximumThresholdThe remote water level not to be exceeded [m].RemoteWaterLevelMaximumToleranceTolerance value for the remote water level maximum [m].ThresholdEvaporationThe water level at which actual evaporation is 50 % of potential evaporation [m].ToleranceEvaporationA tolerance value defining the steepness of the transition of actual evaporation between zero and potential evaporation [m].WaterVolume2WaterLevelAn interpolation function that describes the relationship between water level and water volume [-].WaterLevelDifference2MaxForcedDischargeAn interpolation function that describes the relationship between the highest possible forced discharge and the water level difference [-].WaterLevelDifference2MaxFreeDischargeAn interpolation function that describes the relationship between the highest possible free discharge and the water level difference [-].DischargeToleranceSmoothing parameter for discharge-related smoothing operations [m³/s].CrestLevelThe crest level of a weir [m].CrestLevelToleranceA tolerance value for the crest level of a weir [m].
- class hydpy.models.dam_pump_sluice.DerivedParameters(master: Parameters[TM_co], cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
DerivedParametersDerived parameters of model dam_pump_sluice.
- The following classes are selected:
TOYReferences thetimeofyearindex array provided by the instance of classIndexeravailable in modulepub[-].SecondsLength of the actual simulation step size [s].InputFactorFactor for converting meteorological input from mm/T to million m³/s.WaterLevelMaximumSmoothParSmoothing parameter to be derived fromWaterLevelMaximumTolerancefor smoothing kernelsmooth_logistic1()[m].RemoteWaterLevelMaximumSmoothParSmoothing parameter to be derived fromRemoteWaterLevelMaximumTolerancefor smoothing kernelsmooth_logistic1()[m].SmoothParEvaporationSmoothing parameter to be derived fromToleranceEvaporationfor smoothing kernelsmooth_logistic1()[m].DischargeSmoothParSmoothing parameter to be derived fromDischargeTolerancefor smoothing kernelssmooth_logistic2(),smooth_min1(), andsmooth_max1()[m³/s].CrestLevelSmoothParSmoothing parameter to be derived fromCrestLevelTolerancefor smoothing kernelsmooth_max1()[m].
- class hydpy.models.dam_pump_sluice.SolverParameters(master: Parameters[TM_co], cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
SolverParametersSolver parameters of model dam_pump_sluice.
- The following classes are selected:
AbsErrorMaxAbsolute numerical error tolerance [m³/s].RelErrorMaxRelative numerical error tolerance [1/T].RelDTMinSmallest relative integration time step size allowed [-].RelDTMaxLargest relative integration time step size allowed [-].MaxEvalMaximum number of function evaluations before stopping the Explicit Labatto Sequence [-].MaxCFLMaximum Caurant-Friedrichs-Lewy number for using the Explicit Labatto Sequence [-].
Sequence features¶
- class hydpy.models.dam_pump_sluice.FactorSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
FactorSequencesFactor sequences of model dam_pump_sluice.
- The following classes are selected:
WaterLevelWater level [m].OuterWaterLevelThe water level directly below the dam [m].RemoteWaterLevelThe water level at a remote location [m].WaterLevelDifferenceDifference between the inner and the outer water level [m].EffectiveWaterLevelDifferenceEffective difference between the inner and the outer water level [m].
- class hydpy.models.dam_pump_sluice.FluxSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
FluxSequencesFlux sequences of model dam_pump_sluice.
- The following classes are selected:
PrecipitationPrecipitation [mm].AdjustedPrecipitationAdjusted precipitation [m³/s].PotentialEvaporationPotential evaporation [mm/T].AdjustedEvaporationAdjusted evaporation [m³/s].ActualEvaporationActual evaporation [m³/s].InflowTotal inflow [m³/s].FreeDischargeFree water release through structures as flap sluice gates [m³/s].MaxForcedDischargeThe currently highest possible forced water release through structures as pumps [m³/s].MaxFreeDischargeThe currently highest possible free water release through structures as pumps [m³/s].ForcedDischargeForced water release through structures as pumps [m³/s].OutflowTotal outflow [m³/s].
- class hydpy.models.dam_pump_sluice.StateSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
StateSequencesState sequences of model dam_pump_sluice.
- The following classes are selected:
WaterVolumeWater volume [million m³].
- class hydpy.models.dam_pump_sluice.LogSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
LogSequencesLog sequences of model dam_pump_sluice.
- The following classes are selected:
LoggedAdjustedEvaporationLogged adjusted evaporation [m³/s].LoggedOuterWaterLevelLogged water level directly below the dam [m].LoggedRemoteWaterLevelLogged water level at a remote location [m].
- class hydpy.models.dam_pump_sluice.InletSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
InletSequencesInlet sequences of model dam_pump_sluice.
- The following classes are selected:
QInflow [m³/s].
- class hydpy.models.dam_pump_sluice.OutletSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
OutletSequencesOutlet sequences of model dam_pump_sluice.
- The following classes are selected:
QOutflow [m³/s].
- class hydpy.models.dam_pump_sluice.ReceiverSequences(master: Sequences[TM_co], cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
ReceiverSequencesReceiver sequences of model dam_pump_sluice.