kwb.raindrop (v.1.0): R Package for Optimisation Simulations for Rainwater Management Simulations Performed with Calculation Engine Provided by Tandler
LatestFirst release of kwb.raindrop — an R package for optimising rainwater-management (swale / Mulden-Rigolen) designs with the calculation engine provided by tandler.com, developed within the RAINDROP research project.
Highlights
Swale-design optimiser
optimise_swale_design()finds the cost-minimal design per overflow target (n_overflows <= x) with roughly ten engine runs per (storage type, target) cell instead of a full factorial sweep — at finer resolution (2 m² / 10 mm instead of 25 m² / 100 mm grid steps).- Built on
find_min_feasible(), a memoised bisection primitive with two safety rules derived from the monotonicity analysis (an edge guard for the +1 event-counting wobble of the 4-h event separation, and a volume referee flagging real non-monotonicity). The search order is derived from the cost rates via a specific-cost proxy (EUR per mm of storage capacity), with warm starts from existing brute-force CSVs. optimise_swale_design_simultaneous()is the assumption-free cross-check: it optimises all parameters at once (Nelder-Mead, plus differential evolution and a Halton baseline for comparison) without the monotonicity assumption — bisection and simultaneous search confirm each other within a few percent.- The optimiser's core assumption is validated in a dedicated monotonicity analysis over 5 112 neighbour comparisons from the three brute-force result sets.
Cost model and interactive plots
compute_costs()/default_cost_rates()attach a per-scenario construction-cost breakdown (excavation, profiling, filter, storage) based on Austrian unit-cost rates.- Interactive (plotly) result views: cost vs. overflow volume, cost-by-overflows boxplots with best-per-class frontier lines, cost vs. evapotranspiration, water-balance trade-off, valid-design-space and main-effects plots — with storage-type shapes, unit-cost captions, cleaned-up legends and German/English labels.
- Storage-layer search spaces:
stack_levels(), manufacturer presets (sickerbox_level_presets()), infiltration box vs. gravel trench (default_storage_spec()/default_storage_types()).
Case studies, engine and data
- Hermetic workflow vignettes for three sites (Eisenstadt 2005, Wien, Bad Aussee) with shipped GeoSphere-Austria rain/ET time series and HDF5 model templates; the optimisation workflows run parallelised over site × storage type with live progress reporting.
download_engine()fetches and caches the Windows calculation engine from KWB-R/kwb.raindrop.binaries. Engine runs patch only the changed HDF5 datasets in place, results are read leanly (low peak RAM even for large grids), and crashed or unreadable per-scenario result files no longer abort a batch.- Correctness fix worth knowing about: ET0 is now converted from mm/day to the engine's mm/h convention before writing
//Kurven/ET0— unconverted daily values were integrated 24× too high, the cause of implausibly large modelled ET shares. The bundled SWMM-5 export scripts document the same pitfall.
Quality
- testthat suite (edition 3): unit tests for the bisection primitive and end-to-end optimiser tests against a fine brute-force reference (cost within 5 %).
- R-CMD-check (Windows devel / release / oldrel), test coverage and pkgdown builds on GitHub Actions.
Documentation and published results
- Package documentation: https://kwb-r.github.io/kwb.raindrop/
- Published results: Brute force · Monotonicity analysis · Optimiser vs. brute force
Installation
# install.packages("remotes")
remotes::install_github("KWB-R/kwb.raindrop@v0.1.0")The calculation engine is a Windows executable — fetch it with download_engine().
Full changelog: v0.1.0