# Simulation giving zeros instead of calculating

I am trying to simulate fraction dissolved, but the simulation is only giving zero at all time points for fdiss.
Can you see why my code is not calculating fdiss correctly?

``````# Practice developing dissolution model using Pumas
using Random
using Pumas
using PumasUtilities
using CairoMakie
using AlgebraOfGraphics
using DataFramesMeta
using DataFrames

## Model definition
pk_44_cim_emax = @model begin
desc = "Dissolution model"
timeu = u"minute"
end

@param begin
"Maximum % drug dissolved (%)"
θfdissmax ∈ RealDomain(lower=0)
"Time required for 50% of the drug to dissolve (minutes)"
θtd50 ∈ RealDomain(lower=0)
end

@covariates dtd50

@pre begin
fdissmax = θfdissmax
td50 = θtd50 * (1 + dtd50)
_time = t
end

@derived begin
fdiss = @. fdissmax * _time / (td50 + _time)
"""
Fraction dissolved in vitro
"""
end
end

param_emax = (θfdissmax = 100.0, θtd50 = 10, σ_add = 0.01)

## Creating a Dataset
df_sub1_emax = map(i -> DataFrame(id = i, time = 1:1:1000, dv_fdiss = missing, dtd50=0), 1:6)
df = vcat(DataFrame.(df_sub1_emax)...)
df[!, :dtd50] = ifelse.(df.id .== 2, -0.75, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 3, -0.5, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 4, -0.25, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 5, 0.25, df.dtd50)
df[!, :dtd50] = ifelse.(df.id .== 6, 0.5, df.dtd50)
df_sub1_emax = df
sub1_emax = read_pumas(df_sub1_emax, observations=[:dv_fdiss], covariates=[:dtd50], event_data=false)

##Simulation
Random.seed!(123)
sim_emax = simobs(pk_44_cim_emax, sub1_emax, param_emax)
df44_1_emax = DataFrame(sim_emax)

##Visualization
@chain df44_1_emax begin
@rsubset :time ∈ [1,5,10,26,104,251,502,1000]
data(_) *
mapping(:time => "Time(minutes)",
:fdiss => "Fraction dissolved",
color = :dtd50 => nonnumeric => "Exposure") *
visual(ScatterLines, linewidth = 4, markersize = 12)
draw(axis = (;xticks = 0:100:1000, yticks = 0:10:100))
end
``````

Which version of Pumas are you using. I’m getting the result below with Pumas 2.1.3