'delay' statement

Can ‘delay’ statement be used in explicit equations? If yes, how would it be coded? Suppose to simulate this case - C0 is to be constant from t=0 to 5 hr. Afterward, It starts to decline mono-exponentially. Can this case be handled by ‘delay’? I tried the following, but it didn’t work.

What are other ways to handle this case?

Thanks,

Cuyue

C=(1-w)C0 + w(C0exp(-kdelay(t,T)))

double(w)
sequence{
w=0
sleep(T)
w=1
}

error(eps = 0)
observe(CObs = C + eps)
stparm(C0 = tvC0)
stparm(k = tvk)
stparm(T = tvT)
fixef(tvC0 = c(, 10, ))
fixef(tvk = c(, 0.693, ))
fixef(tvT = c(, 5, ))

Dear colleague

When you write the delay statement and here you are talking about discrete delay, you need a differential equation for the variable you delay. For example you can write

deriv(A1=-k*A1)

C=A1/V

cdelay=delay(C,tlag)

Since C depends on A1 and we have A1 defined as a differential equation, it will work.

In your example I do not know what you delay and delay(t,T) has no meaning unless you would have a differential equation for t or a function of it.

Best Regards

Serge

Serge, you answered my question. Your prompt response is much appreciated.

I want to add that the delay can be used in assignments:
cdelay=delay(C,tlag)

but also in differential equations also it is good to know that a differential equation can be defined conditionally like this:

deriv(z = t < T ? 0 : … k1/k2*(1-exp(-k2*(t-T)))*z)

in the above you are defining the equation in what happens before time is less than the variable T here a simple zero but can be any funciton. then what happens when this condition is not met:
you can read it like this
when t < T ? do this : otherwise do that