Description Usage Arguments Value Examples
Generate the model objects for use in Xs (models with sensitivities)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
f |
Something that can be converted to eqnvec, e.g. a named character vector with the ODE |
deriv |
logical, generate sensitivities or not |
forcings |
Character vector with the names of the forcings |
events |
data.frame of events with columns "var" (character, the name of the state to be
affected), "time" (character or numeric, time point), "value" (character or numeric, value),
"method" (character, either
"replace" or "add"). See events. Events need to be defined here if they contain
parameters, like the event time or value. If both, time and value are purely numeric, they
can be specified in |
outputs |
Named character vector for additional output variables. |
fixed |
Character vector with the names of parameters (initial values and dynamic) for which no sensitivities are required (will speed up the integration). |
estimate |
Character vector specifying parameters (initial values and dynamic) for which sensitivities are returned. If estimate is specified, it overwrites 'fixed'. |
modelname |
Character, the name of the C file being generated. |
solver |
Solver for which the equations are prepared. |
gridpoints |
Integer, the minimum number of time points where the ODE is evaluated internally |
verbose |
Print compiler output to R command line. |
... |
Further arguments being passed to funC. |
list with func
(ODE object) and extended
(ODE+Sensitivities object)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## Not run:
## Generate a compiled ODE model from an equation vector
## The model will not return sensitivities for "switch"
## Files will be generated in your working directory!
f <- eqnvec(A = "-k*A + switch*F")
model <- odemodel(f, forcings = "F", fixed = "switch")
print(model)
## Generate the same model from an equation list
f <- addReaction(NULL, from = "", to = "A", rate = "switch*F", description = "production")
f <- addReaction(f , from = "A", to = "", rate = "k*A", description = "degradation")
print(f)
model <- odemodel(f, forcings = "F", fixed = "switch")
print(model)
# create forcings
forc1 <- data.frame(name = "F", time = seq(0,5, 0.1), value = sin(seq(0,5,0.1)))
forc2 <- data.frame(name = "F", time = seq(0,5, 0.1), value = exp(-seq(0,5,0.1)))
forc3 <- data.frame(name = "F", time= 0, value = 0.1)
x <- Xs(model, forc1, condition = "forc1") +
Xs(model, forc2, condition = "forc2") +
Xs(model, forc3, condition = "forc3")
g <- Y(c(out1 = "F * A", out2 = "F"), x)
times <- seq(0,5, 0.001)
pars <- setNames(runif(length(getParameters(x))), getParameters(x))
pred <- (g*x)(times, pars)
plot(pred)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.