library(ggplot2)
ana1CMTiv <- function(Dose,pars,t,dur){
  ifelse(t <= dur,
    (Dose/dur) * pars['C'] / pars['L'] * (1-exp(-pars['L'] * t)),
    (Dose/dur) * pars['C'] / pars['L'] * (1-exp(-pars['L'] * dur)) * exp(-pars['L'] * (t-dur))
  )
}
pars   <- c(C=1,L=1)
times  <- seq(0,24,length.out=200)
out    <- amp.sim::mdose(Dose=10,tau=24,ndose=1,t=times,func=ana1CMTiv,pars=pars,dur=2)
ggplot(out,aes(time,y)) + geom_line()
