I have a fairly large model I am trying to solve (~100 differential equations). There is a particular parameter that changes every 28 days. Right now, I switch this parameter using a callback function

```
function model!(du, u, params, t)
a bunch of equations involving params.r
end
condition(u,t,integrator) = round(t, digits=3) ∈ collect(28:28:800)
function dose!(integrator)
integrator.p.r = 1 - integrator.p.r
end
cb = DiscreteCallback(condition, dose!, save_positions=(false,false))
function run_model()
prob = ODEProblem(model!, u0, tspan, params
sol = solve(prob, callback = cb)
end
```

So you see, every 28 time steps, I basically switch the `r`

parameter that cycles through 0 and 1. My question is, is it cheaper and better to do this in the `model!`

function directly and get rid of callbacks? Can I have something like

```
function model!(du, u, params, t)
if t satisfies condition
params.r = 1 - params.r
end
a bunch of equations involving params.r
end
```

From preliminary testing this seems to work, but I am not sure what the correct, more efficient way of doing it is.