aboutsummaryrefslogtreecommitdiff
path: root/R/create_deg_func.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-05-11 15:00:25 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-05-11 15:01:13 +0200
commit0a7820b4063201beb26b78ebfea40e80847c6143 (patch)
treef5bd2cde6c325aaa62220ff3c39459d7efd7d7bf /R/create_deg_func.R
parentb36ae3d710858ee3ff2907eb2d780e0dff48a4f3 (diff)
Add analytical solution for DFOP-SFO
This is about twice as fast as deSolve compiled with FOCUS D
Diffstat (limited to 'R/create_deg_func.R')
-rw-r--r--R/create_deg_func.R24
1 files changed, 23 insertions, 1 deletions
diff --git a/R/create_deg_func.R b/R/create_deg_func.R
index 11559799..b29a11f7 100644
--- a/R/create_deg_func.R
+++ b/R/create_deg_func.R
@@ -16,7 +16,14 @@
#' benchmark(
#' analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE),
#' deSolve = mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE),
-#' replications = 1)
+#' replications = 2)
+#' DFOP_SFO <- mkinmod(
+#' parent = mkinsub("DFOP", "m1"),
+#' m1 = mkinsub("SFO"))
+#' benchmark(
+#' analytical = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE),
+#' deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE),
+#' replications = 2)
#' }
create_deg_func <- function(spec, use_of_ff = c("min", "max")) {
@@ -94,6 +101,21 @@ create_deg_func <- function(spec, use_of_ff = c("min", "max")) {
"(((", k2, "-", k12, "-", k10, ")*", n20, "-", k12, "*", n10, ")*exp(-", k2, "*t)+",
k12, "*", n10, "*exp(-(", k_parent, ")*t))/(", k2, "-(", k_parent, "))")
}
+
+ # dfop_f12_sfo
+ if (all(use_of_ff == "max", spec[[1]]$sink == TRUE, length(obs_vars) == 2,
+ spec[[1]]$type == "DFOP", spec[[2]]$type == "SFO")) {
+ supported <- TRUE
+ f12 <- paste0("f_", n1, "_to_", n2)
+ k2 <- paste0("k_", n2)
+ predicted_text[n2] <- paste0(
+ "((", f12, "* g - ", f12, ") * k2 * ", n10, " * exp(- k2 * t))/(k2 - ", k2, ") - ",
+ "((", f12, "* g) * k1 * ", n10, " * exp(- k1 * t))/(k1 - ", k2, ") + ",
+ "(((k1 - ", k2, ") * k2 - ", k2, "* k1 + ", k2, "^2) * ", n20, "+",
+ "((", f12, "* k1 + (", f12, "*g - ", f12, ") * ", k2, ") * k2 - ", f12, " * g * ", k2, " * k1) * ", n10, ") * ",
+ "exp( - ", k2, " * t)/((k1 - ", k2, ") * k2 - ", k2, " * k1 + ", k2, "^2)")
+ }
+
}

Contact - Imprint