Problem with ODELocalSensitivityProblem

I am looking to use ODELocalSensitivityProblem to get the sensitivities of an ODE problem.
I define two different problems from the same system (defined with ModellingToolkit) as follows

probSens = ODELocalSensitivityProblem(final_sys,u0,(0.,trajTime),pAll)
prob = ODEProblem(final_sys, u0, (0.,trajTime),p=pAll)

I then solve the two different problems

staticSolLocal =  solve(probSens, Vern9(), reltol=1e-12, abstol=1e-12, saveat=t_obs)
staticSol = solve(prob, Vern9(), reltol=1e-12, abstol=1e-12,  saveat=t_obs)

I expect the solutions of the two problems to be the same (I know that the Local sensitivity problem will also have the sensitivites as solutions). However, when I plot one of the states for the two different problems, I get different solutions.

traj_noA_noAlocalSens_20

I would really appreciate any help understanding why I get different solutions. You can find the code here

Make sure you’re plotting the same output. Use the name, not the number, since you used structural_simplify you cannot guarantee the ordering of the equations is the same.

1 Like

Thanks for the suggestion @ChrisRackauckas.
I tried using the symbol name:

plot(staticSol.t,staticSol[lp.o₁], lw=3,labels="static",legend=:outertopright)
plot!(staticSolLocal.t,staticSolLocal[lp.o₁], lw=3, label="static Local sens")

However, on the solution of the ODELocalSensitivityProblem I get the following error:

ERROR: Indexing symbol lp₊o₁(t) is unknown.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] DEFAULT_OBSERVED(sym::Term{Real, Nothing}, u::Vector{Float64}, p::Vector{Float64}, t::Float64)
    @ SciMLBase ~/.julia/packages/SciMLBase/DKeLA/src/scimlfunctions.jl:4
  [3] _broadcast_getindex_evalf
    @ ./broadcast.jl:648 [inlined]
  [4] _broadcast_getindex
    @ ./broadcast.jl:621 [inlined]
  [5] getindex
    @ ./broadcast.jl:575 [inlined]
  [6] copy
    @ ./broadcast.jl:922 [inlined]
  [7] materialize
    @ ./broadcast.jl:883 [inlined]
  [8] observed(A::ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEForwardSensitivityFunction{true, ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Tuple{Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}, Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}}, ForwardDiff.JacobianConfig{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}}}, ForwardSensitivity{0, true, Val{:central}}, Vector{Float64}, Nothing, Matrix{Float64}, UniformScaling{Bool}, Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ODEForwardSensitivityProblem{true, ForwardSensitivity{0, true, Val{:central}}}}, Vern9, OrdinaryDiffEq.InterpolationData{ODEForwardSensitivityFunction{true, ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Tuple{Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}, Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}}, ForwardDiff.JacobianConfig{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}}}, ForwardSensitivity{0, true, Val{:central}}, Vector{Float64}, Nothing, Matrix{Float64}, UniformScaling{Bool}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Vern9Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, sym::Term{Real, Nothing}, i::Colon)
    @ SciMLBase ~/.julia/packages/SciMLBase/DKeLA/src/solutions/solution_interface.jl:83
  [9] getindex(A::ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEForwardSensitivityFunction{true, ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Tuple{Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}, Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}}, ForwardDiff.JacobianConfig{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}}}, ForwardSensitivity{0, true, Val{:central}}, Vector{Float64}, Nothing, Matrix{Float64}, UniformScaling{Bool}, Nothing}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ODEForwardSensitivityProblem{true, ForwardSensitivity{0, true, Val{:central}}}}, Vern9, OrdinaryDiffEq.InterpolationData{ODEForwardSensitivityFunction{true, ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SciMLBase.UJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Tuple{Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}, Vector{ForwardDiff.Dual{typeof(DiffEqSensitivity.jacobianvec!), Float64, 1}}}, ForwardDiff.JacobianConfig{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{SciMLBase.ParamJacobianWrapper{ODEFunction{true, ModelingToolkit.var"#f#147"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x04a89fd6, 0xfb80580a, 0x47141eff, 0x978b3fee, 0x4387a683)}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#3062"), Symbol("##arg#3060"), Symbol("##arg#3061"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xe18f3a57, 0x74536435, 0x50d14ca2, 0x67f8806e, 0x987478af)}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, ModelingToolkit.var"#generated_observed#152"{Bool, ODESystem, Dict{Any, Any}}, Nothing}, Float64, Vector{Float64}}, Float64}, Float64, 12}}}}, ForwardSensitivity{0, true, Val{:central}}, Vector{Float64}, Nothing, Matrix{Float64}, UniformScaling{Bool}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Vern9Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Vern9Tableau{Float64, Float64}}}, DiffEqBase.DEStats}, sym::Term{Real, Nothing})
    @ SciMLBase ~/.julia/packages/SciMLBase/DKeLA/src/solutions/solution_interface.jl:49

I know the symbol is the correct one as the ODEProblem solution can plot the same symbol.

Going back to the original problem of not getting the same solution. I tried plotting the solutions to all the different states of the ODELocalSensitivityProblem with the solution of the ODEProblem and none of them match. I would appreciate any other ideas. It would be a real shame if ODELocalSensitivtyProblem was giving a different solution than ODEProblem.

can you share code?

this is the link to the code
https://github.com/adrianaprotondo/CerebellumLearning/blob/3c86176babb4d4297cd446a9b7ed4fe1582aa3a3/scripts/testODELocalSens.jl