aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2017-05-16 18:40:25 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2017-05-16 18:40:25 +0200
commit3e26a8ab76a434c3465ea1db1b4a2a2ff3ea8ec8 (patch)
treec1830d0d479574f037f86b127cee809c350d163a /R
parent36036b5901223591e7e21e8b73d8cd1fb034f4cb (diff)
Add TWA concentrations for days > 1, fix link
Now we have seven test calculations for the Step 1 calculator, all perfectly passing. This provides confidence that this is a correct reimplementation of the Step 1 part of the Step 1/2 calculator.
Diffstat (limited to 'R')
-rw-r--r--R/PEC_sw_focus.R31
-rw-r--r--R/PELMO_runs.R2
2 files changed, 25 insertions, 8 deletions
diff --git a/R/PEC_sw_focus.R b/R/PEC_sw_focus.R
index 21ed514..c614593 100644
--- a/R/PEC_sw_focus.R
+++ b/R/PEC_sw_focus.R
@@ -15,19 +15,24 @@
#' http://esdac.jrc.ec.europa.eu/projects/stepsonetwo
#' @note The formulas for input to the waterbody via runoff/drainage of the
#' parent and subsequent formation of the metabolite in water is not
-#' documented in the model description coming with the calculator
-#' @note Step 2 is not implemented
+#' documented in the model description coming with the calculator. As one would
+#' expecte, this additional input appears to be (as we get the same results)
+#' calculated by multiplying the application rate with the molar weight
+#' correction and the formation fraction in water/sediment systems.
+#' @note Step 2 is not implemented.
#' @export
-#' @param parent A list containing substance specific parameters
+#' @param parent A list containing substance specific parameters, e.g.
+#' conveniently generated by \code{\link{chent_focus_sw}}.
#' @param rate The application rate in g/ha. Overriden when
#' applications are given explicitly
#' @param n The number of applications
#' @param i The application interval
-#' @param met A list containing metabolite specific parameters. If not NULL,
+#' @param met A list containing metabolite specific parameters. e.g.
+#' conveniently generated by \code{\link{chent_focus_sw}}. If not NULL,
#' the PEC is calculated for this compound, not the parent.
#' @param f_drift The fraction of the application rate reaching the waterbody
#' via drift. If NA, this is derived from the scenario name and the number
-#' of applications via the drift data defined by the
+#' of applications via the drift data defined by the
#' \code{\link{FOCUS_Step_12_scenarios}}
#' @param f_rd The fraction of the amount applied reaching the waterbody via
#' runoff/drainage. At Step 1, it is assumed to be 10%, be it the
@@ -138,8 +143,20 @@ PEC_sw_focus <- function(parent, rate, n = 1, i = NA,
PEC[as.character(t_out[-1]), "PECsed"] = PEC_sed_0_part * exp( - k_ws * t_out[-1])
# TWA concentrations
- PEC["1", "TWAECsw"] = (PEC_sw_0 + PEC["1", "PECsw"]) / 2
- PEC["1", "TWAECsed"] = (PEC_sed_0 + PEC["1", "PECsed"]) / 2
+ PEC_sw_1 = PEC["1", "PECsw"]
+ PEC_sed_1 = PEC["1", "PECsed"]
+ TWAEC_sw_1 = (PEC_sw_0 + PEC_sw_1) / 2
+ TWAEC_sed_1 = (PEC_sed_0 + PEC_sed_1) / 2
+
+ TWAEC_after = function(TWAEC_1, PEC_1, t) {
+ (TWAEC_1 + PEC_1 * (1 - exp(- k_ws * (t - 1))) / k_ws) / t
+ }
+
+ PEC["1", "TWAECsw"] = TWAEC_sw_1
+ PEC["1", "TWAECsed"] = TWAEC_sed_1
+
+ PEC[as.character(t_out[-1]), "TWAECsw"] = TWAEC_after(TWAEC_sw_1, PEC_sw_1, t_out[-1])
+ PEC[as.character(t_out[-1]), "TWAECsed"] = TWAEC_after(TWAEC_sed_1, PEC_sed_1, t_out[-1])
# Check if PEC_sw_max is above water solubility
PEC_sw_max = max(PEC[, "PECsw"])
diff --git a/R/PELMO_runs.R b/R/PELMO_runs.R
index b152b4d..c0d1266 100644
--- a/R/PELMO_runs.R
+++ b/R/PELMO_runs.R
@@ -26,7 +26,7 @@
#' @param cores The number of cores to execute PELMO runs in parallel
#' @param evaluate Should the results be returned?
#' @param overwrite Should existing run directories be overwritten?
-#' @references PELMO.installeR \url{https://jranke.github.io/PELMO.installeR}
+#' @references PELMO.installeR \url{https://pkgdown.jrwb.de/PELMO.installeR}
#'
#' Wine \url{https://winehq.org}
#'

Contact - Imprint