Environmental Benefit Calculator
Complex treatment trains in R
L Stringybark Project homepage Web-based calculator Calculator main page

Calculating environmental benefit of complex treatment trains is possible using the underlying models of the EB calculator in the mathematical and statistical program R. The following instructions are intended for people with at least a basic understanding of R.

You will need to first install the R base program on your computer, and then install the packages, chron and gtools.

Create a working directory for EB calculations and save the following files into it: Start R, and change the working directory to your EB working directory.
Open the file treattrainexample.R.

You can run this script line-by-line, or all at once. It calculates EB (and other) statistics for the following example.

The two residents of this house already had the 2100 litre tank 1 installed and plumbed into their laundry.

They want to know what the improvement in EB score they would achieve by installing a second 2100 litre tank to drain another 15% of the roof for use in their toilet, and installed an infiltration system that would take the overflow from both tanks and all the runoff from the remaining 70% of their roof.

The infiltration system will be dug under the lawn (with 10 cm of topsoil over the top of the system. The system will be filled with scoria and will be 6 m long, 0.4 m wide, and 0.6 m deep.There will be a 90 mm slotted pipe along the top of the scoria to drain stormwater away when the system is full. The effective depth of the system is therefore ~50 cm (0.6 m - 0.09m for the pipe).

The system is classed as unvegetated, because the grass roots are not likely to be able to access water in the trench (as it is too deep). However, there is a large tree (canopy diameter 5m, so canopy area of ~20 sq m) within 3 m of the infiltration system. We expect that this tree will be able to access water filtering out of the system, so allow for some evapotranspiration loss (0.5 times the potential evaporation from the canopy area).

The R script first calculates the EB of the existing tank 1, using the function tank.only.

It then calculates the EB score of the whole system using the following steps: The function tank.as.garden.inflow records relevant flow statistics for tank 1 and tank 2 that can be used as input arguments for the infiltration system downstream. These are saved as the R objects, tank1 and tank2.

The function last.in.train.garden calculates the EB (and other) statistics for the whole treatment train. (The arguments 'upstream.treatments' and 'additional inflow' use tank1 and tank2.)

To compare the contribution of the tanks to the EB score, the script then calculates what the infiltration system would score without the tanks, using the function garden.alone.

The EB results are:
System EB score
Original system: tank 1 by itself0.17
Full treatment train1.53
Improvement with new system (the difference)1.36
Infiltration system by itself 1.29

The four functions used above (tank.only, garden.only, tank.as.garden.inflow, last.in.train.garden) are contained in the file EBmodule.functions.R. This file also contains the function garden.as.tank.inflow, which could be used for rain-gardens or infiltration systems that flow into tanks for harvesting. I have not yet written a function that allows a tank to be the last treatment in a treatment train. It could be done if the need arises.)