10  Reset the system

This is a toy example showing how to use evt::reset(). There are two compartments in the model, and we initialize the second compartment to a value (1000). At the designated times (every 72 hours) we’ll reset the system.

model/evtools-6.solv
[ plugin ] evtools

[ set ] outvars = "A2"

[ param ] 

CL = 1
V = 32
KA = 0

[ pkmodel ] advan = 2

[ pk ] 
A1_0 = 0; 
A2_0 = 1000;

[ event ] 

if(std::fmod(TIME,72) == 0 || NEWIND <= 1) {  
  evt::reset(self);
}

[ error ] capture CP = A2/V;
mod <- mread("model/evtools-6.solv")
. Building evtools-6_solv ... done.
out <- mrgsim(mod, end = 72*4-0.1, delta = 1)

plot(out)