← All Use Cases
🌍
Box-Behnken Design

Rainwater Harvesting System

Box-Behnken design to maximize water captured and minimize overflow by tuning tank size, gutter area, and first-flush diverter volume

Summary

This experiment investigates rainwater harvesting system. Box-Behnken design to maximize water captured and minimize overflow by tuning tank size, gutter area, and first-flush diverter volume.

The design varies 3 factors: tank liters (L), ranging from 500 to 5000, gutter area m2 (m2), ranging from 50 to 200, and first flush L (L), ranging from 10 to 80. The goal is to optimize 2 responses: capture pct (%) (maximize) and overflow pct (%) (minimize). Fixed conditions held constant across all runs include annual rainfall mm = 900, usage L day = 50.

A Box-Behnken design was chosen because it efficiently fits quadratic models with 3 continuous factors while avoiding extreme corner combinations — requiring only 15 runs instead of the 8 needed for a full factorial at two levels.

Quadratic response surface models were fitted to capture potential curvature and factor interactions. The RSM contour plots below visualize how pairs of factors jointly affect each response.

Key Findings

For capture pct, the most influential factors were first flush L (40.2%), gutter area m2 (31.6%), tank liters (28.3%). The best observed value was 73.6 (at tank liters = 2750, gutter area m2 = 125, first flush L = 45).

For overflow pct, the most influential factors were first flush L (42.3%), tank liters (35.5%), gutter area m2 (22.2%). The best observed value was 17.1 (at tank liters = 2750, gutter area m2 = 125, first flush L = 45).

Recommended Next Steps

Experimental Setup

Factors

FactorLowHighUnit
tank_liters5005000L
gutter_area_m250200m2
first_flush_L1080L

Fixed: annual_rainfall_mm = 900, usage_L_day = 50

Responses

ResponseDirectionUnit
capture_pct↑ maximize%
overflow_pct↓ minimize%

Configuration

use_cases/128_rainwater_harvesting/config.json
{ "metadata": { "name": "Rainwater Harvesting System", "description": "Box-Behnken design to maximize water captured and minimize overflow by tuning tank size, gutter area, and first-flush diverter volume" }, "factors": [ { "name": "tank_liters", "levels": [ "500", "5000" ], "type": "continuous", "unit": "L" }, { "name": "gutter_area_m2", "levels": [ "50", "200" ], "type": "continuous", "unit": "m2" }, { "name": "first_flush_L", "levels": [ "10", "80" ], "type": "continuous", "unit": "L" } ], "fixed_factors": { "annual_rainfall_mm": "900", "usage_L_day": "50" }, "responses": [ { "name": "capture_pct", "optimize": "maximize", "unit": "%" }, { "name": "overflow_pct", "optimize": "minimize", "unit": "%" } ], "settings": { "operation": "box_behnken", "test_script": "use_cases/128_rainwater_harvesting/sim.sh" } }

Experimental Matrix

The Box-Behnken Design produces 15 runs. Each row is one experiment with specific factor settings.

Runtank_litersgutter_area_m2first_flush_L
127505010
2275012545
3500012580
4500012510
5275012545
6275012545
750012580
850005045
927505080
10500020045
1150012510
12275020080
135005045
1450020045
15275020010

Step-by-Step Workflow

1

Preview the design

Terminal
$ doe info --config use_cases/128_rainwater_harvesting/config.json
2

Generate the runner script

Terminal
$ doe generate --config use_cases/128_rainwater_harvesting/config.json \ --output use_cases/128_rainwater_harvesting/results/run.sh --seed 42
3

Execute the experiments

Terminal
$ bash use_cases/128_rainwater_harvesting/results/run.sh
4

Analyze results

Terminal
$ doe analyze --config use_cases/128_rainwater_harvesting/config.json
5

Get optimization recommendations

Terminal
$ doe optimize --config use_cases/128_rainwater_harvesting/config.json
6

Multi-objective optimization

With 2 competing responses, use --multi to find the best compromise via Derringer–Suich desirability.

Terminal
$ doe optimize --config use_cases/128_rainwater_harvesting/config.json --multi
7

Generate the HTML report

Terminal
$ doe report --config use_cases/128_rainwater_harvesting/config.json \ --output use_cases/128_rainwater_harvesting/results/report.html

Features Exercised

FeatureValue
Design typebox_behnken
Factor typescontinuous (all 3)
Arg styledouble-dash
Responses2 (capture_pct ↑, overflow_pct ↓)
Total runs15

Analysis Results

Generated from actual experiment runs using the DOE Helper Tool.

Response: capture_pct

Top factors: first_flush_L (40.2%), gutter_area_m2 (31.6%), tank_liters (28.3%).

ANOVA

SourceDFSSMSFp-value
SourceDFSSMSFp-value
tank_liters2322.0142161.00710.6580.5438
gutter_area_m22460.0717230.03590.9400.4299
first_flush_L2827.8042413.90211.6910.2440
LackofFit6783.1192130.5199
PureError2489.4467
Error81272.5659244.7233
Total142882.4560205.8897

Pareto Chart

Pareto chart for capture_pct

Main Effects Plot

Main effects plot for capture_pct

Normal Probability Plot of Effects

Normal probability plot for capture_pct

Half-Normal Plot of Effects

Half-normal plot for capture_pct

Model Diagnostics

Model diagnostics for capture_pct

Response: overflow_pct

Top factors: first_flush_L (42.3%), tank_liters (35.5%), gutter_area_m2 (22.2%).

ANOVA

SourceDFSSMSFp-value
SourceDFSSMSFp-value
tank_liters2259.8667129.93340.9330.4324
gutter_area_m22127.004263.50210.4560.6494
first_flush_L2511.2399255.62001.8350.2209
LackofFit6359.945159.9909
PureError2278.6400
Error8638.5851139.3200
Total141536.6960109.7640

Pareto Chart

Pareto chart for overflow_pct

Main Effects Plot

Main effects plot for overflow_pct

Normal Probability Plot of Effects

Normal probability plot for overflow_pct

Half-Normal Plot of Effects

Half-normal plot for overflow_pct

Model Diagnostics

Model diagnostics for overflow_pct

Response Surface Plots

3D surfaces fitted with quadratic RSM. Red dots are observed data points.

capture pct gutter area m2 vs first flush L

RSM surface: capture pct gutter area m2 vs first flush L

capture pct tank liters vs first flush L

RSM surface: capture pct tank liters vs first flush L

capture pct tank liters vs gutter area m2

RSM surface: capture pct tank liters vs gutter area m2

overflow pct gutter area m2 vs first flush L

RSM surface: overflow pct gutter area m2 vs first flush L

overflow pct tank liters vs first flush L

RSM surface: overflow pct tank liters vs first flush L

overflow pct tank liters vs gutter area m2

RSM surface: overflow pct tank liters vs gutter area m2

Multi-Objective Optimization

When responses compete, Derringer–Suich desirability finds the best compromise. Each response is scaled to a 0–1 desirability, then combined via a weighted geometric mean.

Overall Desirability
D = 0.9545

Per-Response Desirability

ResponseWeightDesirabilityPredictedDir
capture_pct 1.5
0.9545
73.60 0.9545 73.60 %
overflow_pct 1.0
0.9545
17.10 0.9545 17.10 %

Recommended Settings

FactorValue
tank_liters500 L
gutter_area_m250 m2
first_flush_L45 L

Source: from observed run #10

Trade-off Summary

Sacrifice = how much worse than single-objective best.

ResponsePredictedBest ObservedSacrifice
overflow_pct17.1017.10+0.00

Top 3 Runs by Desirability

RunDFactor Settings
#40.8470tank_liters=500, gutter_area_m2=200, first_flush_L=45
#150.7941tank_liters=500, gutter_area_m2=125, first_flush_L=80

Model Quality

ResponseType
overflow_pct0.4966linear

Full Multi-Objective Output

doe optimize --multi
============================================================ MULTI-OBJECTIVE OPTIMIZATION Method: Derringer-Suich Desirability Function ============================================================ Overall desirability: D = 0.9545 Response Weight Desirability Predicted Direction --------------------------------------------------------------------- capture_pct 1.5 0.9545 73.60 % ↑ overflow_pct 1.0 0.9545 17.10 % ↓ Recommended settings: tank_liters = 500 L gutter_area_m2 = 50 m2 first_flush_L = 45 L (from observed run #10) Trade-off summary: capture_pct: 73.60 (best observed: 73.60, sacrifice: +0.00) overflow_pct: 17.10 (best observed: 17.10, sacrifice: +0.00) Model quality: capture_pct: R² = 0.4727 (linear) overflow_pct: R² = 0.4966 (linear) Top 3 observed runs by overall desirability: 1. Run #10 (D=0.9545): tank_liters=500, gutter_area_m2=50, first_flush_L=45 2. Run #4 (D=0.8470): tank_liters=500, gutter_area_m2=200, first_flush_L=45 3. Run #15 (D=0.7941): tank_liters=500, gutter_area_m2=125, first_flush_L=80

Full Analysis Output

doe analyze
=== Main Effects: capture_pct === Factor Effect Std Error % Contribution -------------------------------------------------------------- first_flush_L 17.9964 3.7049 40.2% gutter_area_m2 14.1500 3.7049 31.6% tank_liters 12.6750 3.7049 28.3% === ANOVA Table: capture_pct === Source DF SS MS F p-value ----------------------------------------------------------------------------- tank_liters 2 322.0142 161.0071 0.658 0.5438 gutter_area_m2 2 460.0717 230.0359 0.940 0.4299 first_flush_L 2 827.8042 413.9021 1.691 0.2440 Lack of Fit 6 783.1192 130.5199 0.533 0.7670 Pure Error 2 489.4467 244.7233 Error 8 1272.5659 244.7233 Total 14 2882.4560 205.8897 === Summary Statistics: capture_pct === tank_liters: Level N Mean Std Min Max ------------------------------------------------------------ 2750 7 50.4286 17.7788 25.9000 73.6000 500 4 57.2000 8.3407 46.1000 65.8000 5000 4 44.5250 12.3184 28.8000 57.0000 gutter_area_m2: Level N Mean Std Min Max ------------------------------------------------------------ 125 7 48.5286 13.4979 25.9000 65.8000 200 4 59.6000 14.1112 41.3000 73.6000 50 4 45.4500 15.6189 28.8000 60.5000 first_flush_L: Level N Mean Std Min Max ------------------------------------------------------------ 10 4 61.8250 9.9312 51.0000 73.6000 45 7 43.8286 14.1609 25.9000 60.5000 80 4 51.4500 13.6085 35.6000 67.1000 === Main Effects: overflow_pct === Factor Effect Std Error % Contribution -------------------------------------------------------------- first_flush_L 13.5143 2.7051 42.3% tank_liters 11.3500 2.7051 35.5% gutter_area_m2 7.0750 2.7051 22.2% === ANOVA Table: overflow_pct === Source DF SS MS F p-value ----------------------------------------------------------------------------- tank_liters 2 259.8667 129.9334 0.933 0.4324 gutter_area_m2 2 127.0042 63.5021 0.456 0.6494 first_flush_L 2 511.2399 255.6200 1.835 0.2209 Lack of Fit 6 359.9451 59.9909 0.431 0.8209 Pure Error 2 278.6400 139.3200 Error 8 638.5851 139.3200 Total 14 1536.6960 109.7640 === Summary Statistics: overflow_pct === tank_liters: Level N Mean Std Min Max ------------------------------------------------------------ 2750 7 33.0286 12.5800 17.1000 52.4000 500 4 28.1250 4.5945 24.0000 32.3000 5000 4 39.4750 9.3803 31.1000 49.6000 gutter_area_m2: Level N Mean Std Min Max ------------------------------------------------------------ 125 7 34.8714 9.6809 24.0000 52.4000 200 4 28.6500 12.7921 17.1000 45.3000 50 4 35.7250 10.9006 24.3000 49.6000 first_flush_L: Level N Mean Std Min Max ------------------------------------------------------------ 10 4 25.9000 6.8103 17.1000 31.9000 45 7 39.4143 10.9260 24.3000 52.4000 80 4 30.5250 7.5288 20.3000 38.4000

Optimization Recommendations

doe optimize
=== Optimization: capture_pct === Direction: maximize Best observed run: #10 tank_liters = 2750 gutter_area_m2 = 125 first_flush_L = 45 Value: 73.6 RSM Model (linear, R² = 0.3398, Adj R² = 0.1597): Coefficients: intercept +50.6600 tank_liters -6.1000 gutter_area_m2 -1.5500 first_flush_L -9.1000 RSM Model (quadratic, R² = 0.4701, Adj R² = -0.4838): Coefficients: intercept +56.5667 tank_liters -6.1000 gutter_area_m2 -1.5500 first_flush_L -9.1000 tank_liters*gutter_area_m2 +1.0000 tank_liters*first_flush_L -1.2000 gutter_area_m2*first_flush_L -1.8500 tank_liters^2 +0.8417 gutter_area_m2^2 -2.4583 first_flush_L^2 -9.4583 Curvature analysis: first_flush_L coef=-9.4583 concave (has a maximum) gutter_area_m2 coef=-2.4583 concave (has a maximum) tank_liters coef=+0.8417 convex (has a minimum) Notable interactions: gutter_area_m2*first_flush_L coef=-1.8500 (antagonistic) tank_liters*first_flush_L coef=-1.2000 (antagonistic) tank_liters*gutter_area_m2 coef=+1.0000 (synergistic) Predicted optimum (from linear model, at observed points): tank_liters = 500 gutter_area_m2 = 125 first_flush_L = 10 Predicted value: 65.8600 Surface optimum (via L-BFGS-B, linear model): tank_liters = 500 gutter_area_m2 = 50 first_flush_L = 10 Predicted value: 67.4100 Model quality: Weak fit — consider adding center points or using a different design. Factor importance: 1. first_flush_L (effect: 18.4, contribution: 54.2%) 2. tank_liters (effect: 12.2, contribution: 35.8%) 3. gutter_area_m2 (effect: 3.4, contribution: 10.0%) === Optimization: overflow_pct === Direction: minimize Best observed run: #10 tank_liters = 2750 gutter_area_m2 = 125 first_flush_L = 45 Value: 17.1 RSM Model (linear, R² = 0.2906, Adj R² = 0.0972): Coefficients: intercept +33.4400 tank_liters +4.0875 gutter_area_m2 -0.2375 first_flush_L +6.2500 RSM Model (quadratic, R² = 0.5329, Adj R² = -0.3079): Coefficients: intercept +26.6000 tank_liters +4.0875 gutter_area_m2 -0.2375 first_flush_L +6.2500 tank_liters*gutter_area_m2 -1.5500 tank_liters*first_flush_L -0.2750 gutter_area_m2*first_flush_L +1.4750 tank_liters^2 +1.6000 gutter_area_m2^2 +1.5000 first_flush_L^2 +9.7250 Curvature analysis: first_flush_L coef=+9.7250 convex (has a minimum) tank_liters coef=+1.6000 convex (has a minimum) gutter_area_m2 coef=+1.5000 convex (has a minimum) Notable interactions: tank_liters*gutter_area_m2 coef=-1.5500 (antagonistic) gutter_area_m2*first_flush_L coef=+1.4750 (synergistic) Predicted optimum (from linear model, at observed points): tank_liters = 5000 gutter_area_m2 = 125 first_flush_L = 80 Predicted value: 43.7775 Surface optimum (via L-BFGS-B, linear model): tank_liters = 500 gutter_area_m2 = 200 first_flush_L = 10 Predicted value: 22.8650 Model quality: Weak fit — consider adding center points or using a different design. Factor importance: 1. first_flush_L (effect: 15.8, contribution: 63.4%) 2. tank_liters (effect: 8.2, contribution: 32.9%) 3. gutter_area_m2 (effect: 0.9, contribution: 3.7%)
← Previous: Solar Panel Tilt & Orientation Next: Home Insulation Optimization →