calc_series.wateres: Calculation of reservoir time series

View source: R/wateres.R

calc_seriesR Documentation

Calculation of reservoir time series

Description

Calculates time series of water balance variables for the reservoir. If provided in the reser object, the precipitation, evaporation, water use or transfer variables are applied.

Usage

calc_series(reser, storage, yield, throw_exceed, initial_storage,
  initial_level, initial_pos, last_pos, get_level, till_def, first_def_pos,
  storage_optim, yield_max, complex_properties, get_routing_output)

## S3 method for class 'wateres'
calc_series(reser, storage = attr(reser, "storage"),
  yield = attr(reser, "yield"), throw_exceed = FALSE,
  initial_storage = attr(reser, "storage_initial"), initial_level,
  initial_pos = 1, last_pos = nrow(reser), get_level = FALSE,
  till_def = FALSE, first_def_pos = initial_pos,
  storage_optim = attr(reser, "storage_optim"), yield_max = attr(reser,
  "yield_max"), complex_properties = TRUE, get_routing_output = FALSE)

Arguments

reser

A wateres object.

storage

A maximum reservoir storage in m3, either a value of fixed maximum storage or a vector of the length of the reservoir series plus one. If not given, taken from the reser object.

yield

A required yield in m3.s-1, either a value of fixed yield or a vector of the same length as the reservoir series.

throw_exceed

Whether volume exceeding storage will be thrown or added to yield.

initial_storage

A value of initial reservoir storage in m3. If not specified, the value is given by the “storage_initial” property, if that is not given, the reservoir is considered to be full.

initial_level

A value of initial water level in m.a.s.l. If specified and elevation-area-storage relationship is not provided within the reser object, it will be ignored; otherwise the initial_storage argument will be ignored.

initial_pos

An index of time series where the calculation starts. If greater than one, returned time series will be shorter than the input.

last_pos

An index of time series where the calculation stops.

get_level

Whether to obtain water level series for calculated storages. It is ignored if no elevation-area-storage relationship is provided within the reser object.

till_def

If TRUE, the calculation will stop at time step when any deficit occurs provided that this time step is greater or equal to first_def_pos.

first_def_pos

If the till_def argument is TRUE, it means the first index of time step when a deficit will stop the calculation.

storage_optim

An optimum reservoir storage in m3, i.e. the value which will be tried to be not exceeded if this is allowed by the value of max_yield. Either a value of fixed optimum storage or a vector of the length of the reservoir series plus one.

yield_max

A maximum value of yield (in m3.s-1) that can be obtained from storage below the maximum value (the storage argument). Hence, if the reservoir storage exceeds the storage value and throw_exceed is not set to TRUE, the resulting yield may be greater than yield_max. The maximum yield can be interpreted as an outflow capacity of the reservoir in case that its dam is not overflown. Either a value of fixed yield or a vector of the same length as the reservoir series.

complex_properties

If FALSE, constant values of storage and yield will be required and storage_optim and yield_max will not be considered. This is needed for calculation with generated values, as it is done e.g. in the sry.wateres function.

get_routing_output

If TRUE, routing output will be provided as the routing attribute of the returned list.

Details

When calculating water balance, a simple explicit method is applied. Finally, the initial time step of storage is omitted to get a time series of the same length as for other variables.

If one of storage_optim or yield_max is missing while the second is specified, both values are set to NULL and thus they are not considered in the calculation.

Value

A wateres_series object which is a data table with water balance variables: inflow (in m3.s-1), storage (in m3), yield, unrouted yield (in m3.s-1), precipitation, evaporation, water use, deficits and transfer (in m3).

The deficits represent the missing volume which would satisfy the remaining sum of yield and withdrawal demands.

There is the water transfer only in case of non-zero values, resulting from calculations of a reservoir system. Positive values of transfer mean additional inflow whereas negative represent additional withdrawal.

Unrouted yield is available only if a routing has been set for the reservoir (by the set_routing function).

Additionally, water levels are included if the get_level argument is TRUE.

If the get_routing_output argument is TRUE, routing information is returned as the routing attribute. Data depends on the used routing method (set in the set_routing function): for linear_reservoir, time series of storage (in m3) in the transforming resevoir is obtained.

See Also

plot.wateres_series for plotting the time series

Examples

reser = data.frame(
    Q = c(0.078, 0.065, 0.168, 0.711, 0.154, 0.107, 0.068, 0.057, 0.07, 0.485, 0.252, 0.236,
          0.498, 0.248, 0.547, 0.197, 0.283, 0.191, 0.104, 0.067, 0.046, 0.161, 0.16, 0.094),
    DTM = seq(as.Date("2000-01-01"), by = "months", length.out = 24))
reser = as.wateres(reser, storage = 14.4e6, area = 754e3)
resul = calc_series(reser, 14.4e6, 0.14)

tgmwri/wateres documentation built on Feb. 13, 2024, 10:25 p.m.