From 4eb36608bebdd4dd7519d1a7ddcd18cfdb856620 Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Wed, 7 Feb 2024 05:46:30 -0600 Subject: [PATCH] Create and use new flag for added on/off dose to respect data-based flg --- inst/include/rxode2parseHandleEvid.h | 6 +++--- src/etTran.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inst/include/rxode2parseHandleEvid.h b/inst/include/rxode2parseHandleEvid.h index 71c4169..165b402 100644 --- a/inst/include/rxode2parseHandleEvid.h +++ b/inst/include/rxode2parseHandleEvid.h @@ -99,6 +99,7 @@ extern "C" { // xx = 30, Turn off compartment // xx = 40, Steady state constant infusion // xx = 50, Phantom event, used for transit compartments +// xx = 60, Dose that does not track as a dose turn on system // Steady state events need a II data item > 0 #define EVID0_REGULAR 1 #define EVID0_RATEADJ 2 @@ -110,7 +111,7 @@ extern "C" { #define EVID0_OFF 30 #define EVID0_SSINF 40 #define EVID0_PHANTOM 50 - +#define EVID0_ONDOSE 60 static inline void getWh(int evid, int *wh, int *cmt, int *wh100, int *whI, int *wh0){ *wh = evid; @@ -229,8 +230,7 @@ static inline int handleTlastInlineUpateDosingInformation(rx_solving_options_ind } break; } - if (curDose[0] == 0.0 && - getEvidP1(ind, ind->idx) == 2) { + if (ind->wh0 == EVID0_ONDOSE) { // evid=2 can add zero dose to turn on a compartment; // therefore if the current dose is zero and the next evid = 2 // don't treat it as a new dose. diff --git a/src/etTran.cpp b/src/etTran.cpp index 1ce9fa8..382ac68 100644 --- a/src/etTran.cpp +++ b/src/etTran.cpp @@ -1417,10 +1417,10 @@ List etTransParse(List inData, List mv, bool addCmt=false, ndose++; // + cmt needs to turn on cmts. // This gives a zero dose to cmt - if (cmtCol != -1 && cmt > 0 && cmt <= baseSize){ + if (cmtCol != -1 && cmt > 0 && cmt <= baseSize) { // Turn on state with dose id.push_back(cid); - evid.push_back(cevid); + evid.push_back(cevid-flg+60); cmtF.push_back(cmt); time.push_back(ctime); amt.push_back(0.0);