These functions find the design value that guarantees zero deficit over
the whole simulation, by repeatedly calling the engine rh_simulate():
Usage
rh_guaranteed_demand(
precip,
area,
capacity,
runoff = 0.8,
efficiency = 0.85,
initial = capacity,
overflow_timing = c("after_demand", "before_demand"),
method = c("bisection", "optimize", "step"),
tol = 0.001,
step = NULL
)
rh_guaranteed_capacity(
precip,
demand,
area,
runoff = 0.8,
efficiency = 0.85,
initial = NULL,
overflow_timing = c("after_demand", "before_demand"),
method = c("bisection", "optimize", "step"),
tol = 0.001,
step = NULL,
max_capacity = NULL
)
rh_required_area(
precip,
demand,
capacity,
runoff = 0.8,
efficiency = 0.85,
initial = capacity,
overflow_timing = c("after_demand", "before_demand"),
method = c("bisection", "optimize", "step"),
tol = 0.001,
step = NULL,
max_area = NULL
)Arguments
- precip
Numeric vector of precipitation depths, in millimetres (mm). Each element is one time step (typically a day).
- area
Catchment area in square metres (m2). May be a vector of per-block areas, in which case the total
sum(area)is used.- capacity
Reservoir capacity
V, in cubic metres (m3).- runoff
Runoff coefficient
C(the coeficiente de escoamento superficial), dimensionless in[0, 1]. Scalar or vector recycled tolength(precip). Default0.8.- efficiency
System efficiency
eta(dimensionless,[0, 1]), accounting for the first-flush diverter/solids-discard device. Scalar or vector recycled tolength(precip). ABNT NBR 15527:2019 recommends0.85when no data are available (the default).- initial
Initial stored volume
S(0), in cubic metres (m3). Forrh_guaranteed_demand()andrh_required_area()it defaults tocapacity(full reservoir). Forrh_guaranteed_capacity()the defaultNULLmakes the reservoir start full at each trial capacity, and an explicit value is clamped to the trial capacity during the search.- overflow_timing
Order of operations within a time step:
"after_demand"(default): inflow is added, demand is withdrawn, and only the remainder can overflow. This is the continuity-equation formS(t) = S(t-1) + Q(t) - D(t)clamped to[0, V], the YBS (yield before spillage) operating rule of the rainwater-tank literature (Jenkins et al., 1978; Fewkes and Butler, 2000), and reproduces the published case-study results."before_demand": inflow is added and the reservoir overflows before demand is withdrawn, the YAS (yield after spillage) rule. It spills more water, giving slightly conservative yields, and is provided for sensitivity analysis.
- method
Solver:
"bisection"(default),"optimize"(automatic optimisation withstats::optimize()) or"step"(incremental search bystep).- tol
Tolerance: a deficit not greater than
tolis treated as zero, and the solver stops when the search interval is narrower thantol.- step
Increment for
method = "step". Defaults to one thousandth of the search upper bound.- demand
Non-potable demand per time step, in cubic metres (m3). Scalar or vector recycled to
length(precip).- max_capacity
Optional upper bound for the capacity search. Defaults to the total demand (which trivially guarantees no deficit), grown if needed.
- max_area
Optional upper bound for the area search. Grown automatically until a feasible area is found.
Value
A single numeric value: the guaranteed demand (m3/day), guaranteed capacity (m3) or required area (m2).
Details
rh_guaranteed_demand()- the largest constant daily demand that can be met with no deficit (the demanda garantia).rh_guaranteed_capacity()- the smallest reservoir capacity giving no deficit (the capacidade/volume garantia). The reservoir is assumed full at the start, soinitialfollows the trial capacity unless set.rh_required_area()- the smallest catchment area giving no deficit.
Because the total deficit is monotone in each of these variables, the default
solver is an efficient bisection controlled by tol. Two alternatives are
available: an automatic optimiser ("optimize", base R stats::optimize())
and a simple incremental search ("step", a for-loop advancing by step).
