User reported that simulation with EVID=4 and SS=1 was not consistent with NONMEM. This was confirmed at the nmtests repository.
In this situation, mrgsolve currently advances to steady state and then resets the system. It was confirmed that NONMEM takes the steady state value in this case and then doses (reset doesn't factor in the result).
The EVID 4 code was adjusted to only reset when SS != 0.
> test_that("evid==4 with ss==1 [SLV-TEST-0019]", {
+ mod <- house()
+ dat <- as_data_set(
+ evd(amt = 100, evid = 4, ss = 1, ii = 12),
+ evd(amt = 100, evid = 1, ss = 1, ii = 12),
+ )
+ sim <- mrgsim(mod, dat, end = 5, output = "df")
+ expect_true(all(sim$CP[sim$ID==1] == sim$CP[sim$ID==2]))
+ })
── Failure (Line 10): evid==4 with ss==1 [SLV-TEST-0019] ───────────────────────
all(sim$CP[sim$ID == 1] == sim$CP[sim$ID == 2]) is not TRUE
`actual`: FALSE
`expected`: TRUE
Error in reporter$stop_if_needed() : Test failed
> packageVersion("mrgsolve")
[1] ‘1.0.4’
Summary
See issue #1010
User reported that simulation with EVID=4 and SS=1 was not consistent with NONMEM. This was confirmed at the nmtests repository.
In this situation, mrgsolve currently advances to steady state and then resets the system. It was confirmed that NONMEM takes the steady state value in this case and then doses (reset doesn't factor in the result).
The EVID 4 code was adjusted to only reset when SS != 0.