PML provides a number of unique features to facilitate modeling discontinuous events/actions that can appear in complicated models. Discontinuous actions can occur when an action needs to be performed right before/after reading a dose or an observation. These actions are specified in PML with dobefore or doafter statements.
Discontinuous actions can also occur in dynamic models where actions are taken at different times (independent of the times defined in the dataset). These actions can be specified using sequence and sleep statements (see “The sequence and sleep statements” for details). For example, the following is a partial example of an enterohepatic circulation model.
1 deriv(a=-a*k10-a*k1b+g*kg1)
# central cpt
2 deriv(b=a*k1b-qbg)
# bile cpt
3 deriv(g=qbg-g*kg1)
# gut cpt
4 real(qbg)
#qbg is flow rate from bile to gut
5 stparm(tCycle=…, tReflux=…)
# times are parameters
# introduce the time sequence:
6 real(i)
7 sequence{
8 i=0;
9 while(i<10){
10 i=i+1;
11 qbg=0;
12 sleep(tCycle-tReflux);
13 qbg=(b/tReflux);
14 sleep(tReflux);
15 qbg=0;
16 }
17 }
The model has three compartments: a for plasma, b for bile, and g for gut. Normally the compound flows from gut to plasma and from plasma to bile, as well as flowing through the normal elimination path. There is also a flow from bile to gut, which is the reflux path. This is modeled as a zero-order flow of rate qbg. The flow is turned on and off to model the reflux.
Lines 1–3 give the differential equations for the three compartments. The variable qbg is a variable representing the flow rate from bile to gut, and it is initially zero.
Line 4 declares a variable, qbg, which will be used in some of the equations and statements.
Line 5 designates that there are two structural parameters giving the cycle time between reflux events (tCycle) and the duration (tReflux) of each event.
Line 6 declares a variable, i, which will be used in some of the equations and statements.
Lines 7–17 are grouped with the sequence keyword. This introduces time-sequenced procedure into the model.
Line 8 sets the initial value for the variable i to zero.
Line 9 groups the next six statements into a loop that will repeat up to 10 times.
Line 10 adds one to the value of i (number of iterations).
Line 11 sets the initial value for the variable qbg to zero.
Line 12 allows tCycle-tReflux time units to pass.
Line 13 turns on the reflux by setting qbg to the rate necessary to empty the bile compartment within duration tReflux.
Lines 14–15 say to wait for tReflux time units, and then turn off the flow, after which the cycle repeats.
See “Action code” for more information on the discontinuous events.
Last modified date:7/9/20
Legal Notice | Contact Certara
© 2020 Certara USA, Inc. All rights reserved.