aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/R/PEC_sw_drainage_UK.R33
-rw-r--r--pkg/R/SSLRC_mobility_classification.R2
-rw-r--r--pkg/man/PEC_sw_drainage_UK_ini.Rd14
-rw-r--r--pkg/man/SSLRC_mobility_classification.Rd2
4 files changed, 36 insertions, 15 deletions
diff --git a/pkg/R/PEC_sw_drainage_UK.R b/pkg/R/PEC_sw_drainage_UK.R
index 03c56c0..8402d95 100644
--- a/pkg/R/PEC_sw_drainage_UK.R
+++ b/pkg/R/PEC_sw_drainage_UK.R
@@ -23,28 +23,39 @@
#' @param rate Application rate in g/ha
#' @param interception The fraction of the application rate that does not reach the soil
#' @param Koc The sorption coefficient normalised to organic carbon in L/kg
+#' @param latest_application Latest application date, formatted as e.g. "01 July"
+#' @param soil_DT50 Soil degradation half-life, if SFO kinetics are to be used
+#' @param model The degradation model to be used. Either one of "FOMC", "DFOP",
+#' "HS", or "IORE", or an mkinmod object
+#' @param model_parms A named numeric vector containing the model parameters
#' @return The predicted concentration in surface water in µg/L
#' @export
#' @author Johannes Ranke
#' @examples
-#' PEC_sw_drainage_UK_ini(100)
+#' PEC_sw_drainage_UK_ini(150, Koc = 100)
PEC_sw_drainage_UK_ini <- function(rate, interception = 0, Koc,
- latest_application = NULL, soil_DT50 = NULL)
+ latest_application = NULL, soil_DT50 = NULL,
+ model = NULL, model_parms = NULL)
{
percentage_lost <- SSLRC_mobility_classification(Koc)[[2]]
amount_available <- rate * (1 - interception) # g/ha
if (!missing(latest_application)) {
- if (missing(soil_DT50)) stop("You need to supply a soil DT50 value")
- k = log(2)/soil_DT50
- as.Date(paste(latest_application, "1999"), "%d %B %Y")
+ if (!missing(soil_DT50)) {
+ k = log(2)/soil_DT50
+ as.Date(paste(latest_application, "1999"), "%d %B %Y")
- lct <- Sys.getlocale("LC_TIME")
- tmp <- Sys.setlocale("LC_TIME", "C")
- latest <- as.Date(paste(latest_application, "1999"), "%d %b %Y")
- tmp <- Sys.setlocale("LC_TIME", lct)
- degradation_time <- as.numeric(difftime(as.Date("1999-10-01"), units = "days", latest))
- amount_available <- amount_available * exp(-k * degradation_time)
+ lct <- Sys.getlocale("LC_TIME")
+ tmp <- Sys.setlocale("LC_TIME", "C")
+ latest <- as.Date(paste(latest_application, "1999"), "%d %b %Y")
+ tmp <- Sys.setlocale("LC_TIME", lct)
+ degradation_time <- as.numeric(difftime(as.Date("1999-10-01"), units = "days", latest))
+ amount_available <- amount_available * exp(-k * degradation_time)
+ if (!missing(model)) stop("You already supplied a soil_DT50 value, implying SFO kinetics")
+ }
+ if (!missing(model)) {
+ amount_available <- pfm_degradation(model, parms = model_parms, times = degradation_time)
+ }
}
volume = 130000 # L/ha
diff --git a/pkg/R/SSLRC_mobility_classification.R b/pkg/R/SSLRC_mobility_classification.R
index e04d472..deda5cf 100644
--- a/pkg/R/SSLRC_mobility_classification.R
+++ b/pkg/R/SSLRC_mobility_classification.R
@@ -26,7 +26,7 @@
#' @export
#' @author Johannes Ranke
#' @examples
-#' SSLRC_mobility_classification(Koc)
+#' SSLRC_mobility_classification(100)
SSLRC_mobility_classification <- function(Koc)
{
if (!is.numeric(Koc) | length(Koc) != 1) stop("Please give a single number")
diff --git a/pkg/man/PEC_sw_drainage_UK_ini.Rd b/pkg/man/PEC_sw_drainage_UK_ini.Rd
index c39a5c9..1b2009d 100644
--- a/pkg/man/PEC_sw_drainage_UK_ini.Rd
+++ b/pkg/man/PEC_sw_drainage_UK_ini.Rd
@@ -5,7 +5,8 @@
\title{Calculate initial predicted environmental concentrations in surface water due to drainage using the UK method}
\usage{
PEC_sw_drainage_UK_ini(rate, interception = 0, Koc,
- latest_application = NULL, soil_DT50 = NULL)
+ latest_application = NULL, soil_DT50 = NULL, model = NULL,
+ model_parms = NULL)
}
\arguments{
\item{rate}{Application rate in g/ha}
@@ -13,6 +14,15 @@ PEC_sw_drainage_UK_ini(rate, interception = 0, Koc,
\item{interception}{The fraction of the application rate that does not reach the soil}
\item{Koc}{The sorption coefficient normalised to organic carbon in L/kg}
+
+\item{latest_application}{Latest application date, formatted as e.g. "01 July"}
+
+\item{soil_DT50}{Soil degradation half-life, if SFO kinetics are to be used}
+
+\item{model}{The degradation model to be used. Either one of "FOMC", "DFOP",
+"HS", or "IORE", or an mkinmod object}
+
+\item{model_parms}{A named numeric vector containing the model parameters}
}
\value{
The predicted concentration in surface water in µg/L
@@ -22,7 +32,7 @@ This implements the method specified in the UK data requirements handbook and wa
published on the CRC website
}
\examples{
-PEC_sw_drainage_UK_ini(100)
+PEC_sw_drainage_UK_ini(150, Koc = 100)
}
\author{
Johannes Ranke
diff --git a/pkg/man/SSLRC_mobility_classification.Rd b/pkg/man/SSLRC_mobility_classification.Rd
index a1bb413..62a345b 100644
--- a/pkg/man/SSLRC_mobility_classification.Rd
+++ b/pkg/man/SSLRC_mobility_classification.Rd
@@ -18,7 +18,7 @@ This implements the method specified in the UK data requirements handbook and wa
checked against the spreadsheet published on the CRC website
}
\examples{
-SSLRC_mobility_classification(Koc)
+SSLRC_mobility_classification(100)
}
\author{
Johannes Ranke

Contact - Imprint