Empty and reset macros


The macro empty can be used to set any component of the system, defined in an ODE, to 0 at any given time. Similarly, the macro reset is used to reset a variable of the system to its initial value. Empty or reset times are indicated via a type of administration. The actions of these macros are thus selective, contrary to the reset applied with an EVID column in the dataset with values 3, which reset all compartments.


The arguments are the same for both empty and reset macros:

  • adm: Administration type used to indicate empty or reset times. Its default value is 1. Alias: type. The empty and reset macrso only use the administration times, not the amounts.
  • target: Name of the ODE variable that is set to 0 or reset to its initial value at the specified times, or target=all to reset all system variables. Mandatory.


The following code defines an emptying of the ODE variable Ap on administration times of type 1 (e.g ADM=1 in the data set).

empty(adm=1, target=Ap)
This is equivalent to the following code with the depot macro:
depot(adm=1, target=Ap, p=-Ap/amtDose)

The following code defines a reset based on administration times of type 2 (e.g ADM=2 in the data set), applied to the ODE variable Ac.

reset(adm=2, target=Ac)
It is possible to define several empty macros with the same adm identifiers to set several targets to 0 at the same times, and the same for reset macros. With the example below, dose events with adm=3 will empty both variables Ac and Ap.
empty(adm=3, target=Ac)
empty(adm=3, target=Ap)
To reset all variables of the system, “target=all” can al be used:
reset(adm=3, target=all)



  • The value after type= or adm= must be an integer.
  • The value after target= must be a string representing the ODE variable.


Empty example: urine compartment

The following Mlxplore script implements a two compartments model with an additional urine compartment. There is a transfer from the central compartment to the urine compartment. A single dose with type=1 is administered to the central compartment at time 0. A selective reset of the urine compartment corresponding to collecting times is defined with an administration with type=2. Each amount for this administration is defined as 1 but is actually not used in the model.
When using this model with a data set, urine would be collected over consecutive periods of 12 hours and the amount of drug measured in the urine volume collected for each period would be recorded.

input = {ka, Cl, V1, Q, V2, p_urine}

k_urine = p_urine*Cl/V1
k_non_urine = (1-p_urine)*Cl/V1
k12 = Q/V1
k21 = Q/V2

; Dose administration to central compartment (plasma)
depot(adm=1, target=Ac, ka)

; Reset of urine compartment
reset(adm=2, target=Aurine)


ddt_Ac = - k_non_urine*Ac - k12*Ac + k21*Ap - k_urine*Ac
ddt_Ap = k12*Ac-k21*Ap
ddt_Aurine = k_urine*Ac


output = {Cc, Aurine}

Cl =0.5
Q =1
V1 =5
V2 =8
ka =10
p_urine =0.05


adm1_1={ type=1,time={0}, amount={10} }
adm2_1={ type=2,time={1,13,25,37,49,61,73,85,97}, amount={1,1,1,1,1,1,1,1,1} }



This script gives the following profiles for the drug amount in the urine compartment (left), and the drug concentration in the central compartment (right).

Reset example: PD variable

Of course, emptying a compartment of resetting it to its initial state are equivalent actions for compartment which are initially empty. This may be not the case for PD models with non-zero baseline, like in the following example where the PD variable E is reset to its initial value E0 at several times.
input = {ka, k, E0, IC50, kout}

depot(target=Ad, type=1)
reset(target=E, type=2)

E_0 = E0
kin = E0*kout

ddt_Ad = -ka*Ad
ddt_Ac = ka*Ad - k*Ac
ddt_E = kin*(1 - Ac/(Ac+IC50)) - kout*E

output = {E}


adm1 = { type=1,time=10:24:136, amount={100} }
adm2 = { type=2,time=60:48:136, amount={1} }

treatment1={adm1, adm2}