66 Updating Amounts in Compartments at any Time: The A UFLG Flag (NM75)
Introduction to NONMEM 7.6.0
Previous to NM75, the amounts in compartments could be set by the use of the A_0() array only when EVID=3, EVID=4, or for the first record of an individual, that is, only at the “initial” state. The A_0FLG is set to 1 by PREDPP at those times, which then executes code that sets the A_0() values. For example:
$PK
If (A_0FLG==1) then
A_0(3)=k03/k30
EndifAny A_0(x) not explicitly defined are set to 0. However, the A_0FLG may not set by the user in the $PK record, preventing the user from updating compartment amounts at any time. As of nm75, the modeler may update the compartment values at any time, using the flag A_UFLG (the ending U stands for update) with the desired compartment values set in the array A_U(). By use of MTIME to designate a variable time position at which an abrupt change in compartment amounts occurs, one could input a dose as follows:
MTIME(1)=wtime
MTDIFF=1
AZTEST=A_0FLG
IF(TSTATE==MTIME(1).AND.AZTEST==0) A_UFLG=1
IF(A_UFLG==1) THEN
A_U(1)=A(1)+wdose
A_U(2)=A(2)
A_U(3)=A(3)
ENDIFThe IF(A_UFLG==1) block is optional, as NMTRAN will insert one if not present. So the code could also be written as:
MTIME(1)=wtime
MTDIFF=1
AZTEST=A_0FLG
IF(TSTATE==MTIME(1).AND.AZTEST==0) A_UFLG=1
A_U(1)=A(1)+wdose
A_U(2)=A(2)
A_U(3)=A(3)The A_UFLG event must be triggered with an IF(TSTATE==MTIME()) condition as indicated in the above example. Care should be taken that all the A_U(x) for all compartments x be properly defined. NMTRAN converts A_U() to A_0() during FSUBS code construction. You may wish to ensure A_0FLG is 0 whenever A_UFLG is set to 1, as shown in the example above (..\examples\a_uflg.ctl).