tankWrapper: Wrapper function for a rain water tank system model

View source: R/demoTankModel.R

tankWrapperR Documentation

Wrapper function for a rain water tank system model

Description

tankWrapper is a wrapper function for a rainwater tank system model in foreSIGHT. This function is used in examples in function help files and vignettes. This function may also be used as an example to create wrapper functions for other system models with scenarios generated using foreSIGHT in R or other programming languages.

Usage

tankWrapper(data, systemArgs, metrics)

Arguments

data

data.frame; contains observed daily precipitation and temperature to be used to run the rain water tank system model in a data.frame with columns named year month day P Temp. Note that the first three columns of the data.frame contain the year, month, and day of observation. The columns have to be named as specified. Please refer data provided with the package that may be loaded using data(tankDat) for an example of the expected format of data.

systemArgs

a list; contains the input arguments to the rain water tank system model. The valid fields in the list are:

  • roofArea: numeric; the roof area in sq.m

  • nPeople: integer; number of people using water

  • tankVol: numeric; volume of the tank in L

  • firstFlush: numeric; first flush depth over roof in mm

  • write.file: logical; indicates whether output is to be written to file

  • fnam: string; name of the output file

metrics

string vector; the metrics of performance of the system model to be reported. The valid strings may be viewed using the function viewTankMetrics()

Value

The function returns a list containing the calculated values of the performance metrics specified in metrics after running the system model.

See Also

runSystemModel, viewTankMetrics

Examples

# view available performance metrics
viewTankMetrics()
# load example climate data to run the system model
data(tankDat)
systemArgs <- list(roofArea = 205, nPeople = 1, tankVol = 2400, 
firstFlush = 2.0, write.file = FALSE)
tankWrapper(tank_obs, systemArgs, 
metrics = c("average daily deficit (L)", "reliability (fraction)"))

foreSIGHT documentation built on Oct. 19, 2023, 9:08 a.m.