Hi, everyone I tried to simulate a PK/PD model with a multiple IV infusion regimen. I referred to the code from model 302 (the MM model with IV infusion) and the example PK22 from Gabrielsson’s book. But I keep getting this “floating point error”. The model works fine with single dose. Just didn’t work with multiple dosing. Appreciate any comments. Thanks. Jun Shen Attached the code, the Switch is a flag to turn on or off an extra clearance =============================================================== COMMANDS NFUNCTIONS 2 NDERIVATIVES 3 NPARAMETERS 10 PNAMES ‘CL’, ‘Vc’, ‘K12’, ‘K21’ ‘Kout’, ‘R0’, ‘Emax’, ‘EC50’, ‘Gamma’,‘CLHD’ PUNIT ‘L/hr’,‘L’,‘1/hr’,‘1/hr’,‘1/hr’,‘pg/mL’,‘~’,‘ug/L’,‘~’,‘L/hr’ END remark - define temporary variables TEMPORARY NDOSE=CON(1) Kin=KoutR0 Drug=1-Emax(Z(1)/Vc)Gamma/(EC50Gamma+(Z(1)/Vc)**Gamma) END remark - define differential equations starting values START Z(1) = 0 Z(2) = 0 Z(3) = R0 END remark - define differential equations DIFFERENTIAL J=0 remark Count up the number of doses administered up to time x DO I=1 TO NDOSE J=J+3 IF X<=CON(J) THEN GOTO RED ENDIF NEXT rema Perform superposition RED: NDOSEADD=I-1 coef=0 j=0 if X>0 then do i=1 to NDOSEADD j=j+3 t=x-CON(J) ti=con(j+1) - con(j) if t<=ti then coef=dose/ti else coef=0 endif next else ti=con(4)-con(3) Z(1)=0 dose=con(2) tstar=0 coef=dose/ti endif Switch=DTA(3) DZ(1) = coef -(K12+CL/Vc)Z(1)+K21Z(2)-CLHD/VcZ(1)Switch DZ(2) = K12Z(1)-K21Z(2) DZ(3) = KinDrug-KoutZ(3) END remark - define algebraic functions FUNCTION 1 F= Z(1)/Vc END FUNCTION 2 F= Z(3) END remark - define any secondary parameters SECO END remark - end of model EOM
Jun - coding multiple doses in WNL classic models was always tricky, this is one of the major reasons I suggest people use the new Phoenix models as there is no need to code for these multiple doses; the application handles them in the data input parsing automatically. If you use the function “set WNL model” you can easily build the bulk your code with built-in models and then edit it further either in the graphical or text editors; in Phoenix it would look something like this I think. test(){ deriv(A1 = - Vmax * C / (Km + C)) deriv(Ce = Ke0*(C - Ce)) dosepoint(A1) C = A1 / V E = E0 + Emax * Ce^Gam / (EC50^Gam + Ce^Gam) error(EEps = 1) observe(EObs = E + EEps) stparm(V = tvV) stparm(Km = tvKm) stparm(Vmax = tvVmax) stparm(Ke0 = tvKe0) stparm(EC50 = tvEC50) stparm(Gam = tvGam) stparm(E0 = tvE0) stparm(Emax = tvEmax) fixef(tvV(freeze) = c(, 1, )) fixef(tvKm(freeze) = c(, 1, )) fixef(tvVmax(freeze) = c(, 1, )) fixef(tvKe0 = c(, 1, )) fixef(tvEC50 = c(, 1, )) fixef(tvGam = c(, 1, )) fixef(tvE0 = c(, 1, )) fixef(tvEmax = c(, 1, )) } ;
Simon, Thanks for your reply. In addition to the modeling, I am also doing a lot of programing to calculate some secondary parameters. For example, I’ll ask the model to scan through A(1) to do some sort of comparison and read in other data columns by calling DTA(). Can I still do these things in Phoenix? Thanks. Jun