I am trying to create a model to simulate zero order dissolution.
I want to recreate something like this:
Here is my original model:
model_zero = @model begin
@metadata begin
desc = "Dissolution model Zero"
timeu = u"minute"
end
@param begin
"Additive RUV"
σ_add ∈ RealDomain(lower=0)
end
@covariates dk0
@pre begin
k0 = dk0
end
@derived begin
fdiss = @. k0 * t
"Percent dissolved in vitro"
dv_fdiss ~ @. Normal(fdiss, σ_add)
end
end
But I want to add a variable called fdissmax that changes the model to fdiss=fdissmax if fdiss>fdissmax
It appears that if statements do not work in the derived block though.