How to make a callback including variables in definition

Hi, I want to make a callback function set for my differential equation. The problem is I want to make it flexible so in future I can change any desireable callback function without changing the code. It’s a simple control system with 2 inputs. I want to apply different scenarios to my model. For example in the code below, the u_v will change from 0.0 to 0.5 in time 1800 [sec]. I cannot do it like this. previously by writing code for each scenario separately I made it correctly. But like this :frowning:

function TankHomogeneous(u0, scenario, timespan)
CB = [ ]
for s in scenario
if s[1]==“Tᵢ”
if s[2]==0
Tᵢ_0 = s[3]
push!(CB, DiscreteCallback((u,t,integrator)-> t==s[2], integrator -> integrator.p[1]= s[3]));
elseif s[1]==“uₚ”
if s[2]==0
uₚ_0 = s[3]
push!(CB, DiscreteCallback((u,t,integrator)-> t==s[2], integrator -> integrator.p[2]= s[3]));
# [Tᵢ_0, uₚ_0] is the parameters (control system inputs)
prob1 = ODEProblem(SystemModelFunction,u0,timespan,[Tᵢ_0, uₚ_0],callback=Tuple(CB))
sol = solve(prob1,adaptive=false,dt=100)

then I want to pass the scenarios like this:

# each field means (“name of variable”, “time of change”, “new value”)
scenario=[ (“uₚ”,0.0,0.0),
u0 = 27;

TankHomogeneous(u0, scenario, (0.0,15*3600.0))