Pass additional parameters to affect! in solving ODEs

Hello community,

I’m trying to make a lot of ODE simulations and each has a specific callback condition. In affect!, I need to change a few compartments of integrator.u according to some known values. How can I do this?

For instance, how can I make T4_dose below an input parameter for affect!? This callback function adds T4_dose to compartment 10 every 24 hours.

function affect!(integrator)
    T4_dose = 400.0 / 777.0      

    integrator.u[10] += T4_dose

cbk = PeriodicCallback(affect!, 24.0);

you can access the parameters in integrator.p

Thanks Chris.

For future reference, we can store T4_dose as an extra variable in p (say in position 55) and then do integrator.u[10] += integrator.p[55].