Reset the rxode2 system in the model
Value
This function is only meaningful inside an rxode2 model; it
returns NULL invisibly if called from R directly (after signaling
an error).
Details
Behavior inside a model
reset() is evaluated at every output time point (when the solver is
exactly at a scheduled event time). The pushed event is inserted into
the individual's event timeline and the solver visits it now or at the
specified future time.
The number of events that may be pushed per individual is limited by
the maxExtra argument of rxSolve(). When maxExtra = 0
(the default) there is no limit. Exceeding the limit causes an
error.
Past-time pushes (where time < t) are silently ignored and counted;
a warning is issued after solving.
See also
Other In-model dosing:
bolus(),
evid_(),
infuse(),
infuseDur(),
multiply(),
obs(),
phantom(),
replace()
Examples
# \donttest{
# reset all compartments at t = 12
f <- function() {
ini({
ka <- 0.5; cl <- 1; v <- 10
})
model({
mtime(at) <- 12
d/dt(depot) <- -ka * depot
d/dt(central) <- ka * depot - cl / v * central
cp <- central / v
if (t >= at && t < at + 0.5) reset()
})
}
s <- rxSolve(f, et(amt = 100) |> et(0:24))
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#>
#>
s[s$time >= 11 & s$time <= 14, ]
#> time at cp depot central
#> 12 11 12 4.109804 0.4086765 41.09804
#> 13 12 12 3.733943 0.2478747 37.33943
#> 14 12 12 0.000000 0.0000000 0.00000
#> 15 13 12 0.000000 0.0000000 0.00000
#> 16 14 12 0.000000 0.0000000 0.00000
# }
