Error using ModelingToolkit

If I run the following code:

using ModelingToolkit, OrdinaryDiffEq, DataInterpolations

Cp=[0.024384377390186646,0.03811829845979822,0.05731175742000688,0.0803120051369546,0.10526323380995135,0.1312349486430945,
    0.1588590278697544,0.1882995422205645,0.21937359147848456,0.25269290703920616,0.2882162631147021,0.3240355349501659,
    0.3607290350346774,0.39295261085207084,0.4141821251393675,0.4274331262027119,0.43636422894857274,0.4414767530303278,
    0.443412806515125,0.44365385445693295,0.44317448744425714,0.44218641629727234,0.4407405317795181,0.43888039054963845,
    0.4362875461540461,0.4325702155989231,0.4278606704093836,0.4224263790651815,0.4164272616252002,0.40987027258773945,
    0.4027832291503407,0.39518785578723936,0.38719847687832065]
TSR = 2.0:0.25:10.0

cp = CubicSpline(Cp, TSR)

@variables t ω(t) Pr(t) λ(t)
@parameters J R ρ A U Pg
D = Differential(t)

eqs = [J * D(ω) * ω ~ Pr - Pg,
       λ            ~ ω * R/U,
       Pr           ~ 0.5 * ρ * A * U^3 * cp(λ)
      ]

@named sys = ODESystem(eqs, t)
sys = structural_simplify(sys)

u0 = [ω    => 0.9,
      D(ω) => 0.0007615081092152279]

p = [ J => 4.0470e+07,
      R => 63,
      ρ => 1.225,
      A => 1.2469e+04,
      U => 8.1,
      Pg => 1771e3]

tspan = (0.0, 1000.0)
prob = ODEProblem(sys, u0, tspan, p, jac = true)
sol = solve(prob, Tsit5())

I get the following error:

julia> include("src/model_simple.jl")
ERROR: LoadError: This solver is not able to use mass matrices.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 
0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, alg::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Nothing, reltol::Nothing, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Rational{Int64}, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OrdinaryDiffEq C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\solve.jl:95
  [3] __init (repeats 5 times)
    @ C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\solve.jl:10 [inlined]
  [4] #__solve#640
    @ C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\solve.jl:5 [inlined]
  [5] __solve
    @ C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\solve.jl:1 [inlined]
  [6] #solve_call#22
    @ C:\Users\uwefechner\.julia\packages\DiffEqBase\ZXMKG\src\solve.jl:511 [inlined]
  [7] solve_call
    @ C:\Users\uwefechner\.julia\packages\DiffEqBase\ZXMKG\src\solve.jl:481 [inlined]
  [8] #solve_up#30
    @ C:\Users\uwefechner\.julia\packages\DiffEqBase\ZXMKG\src\solve.jl:971 [inlined]
  [9] solve_up
    @ C:\Users\uwefechner\.julia\packages\DiffEqBase\ZXMKG\src\solve.jl:944 [inlined]
 [10] #solve#28
    @ C:\Users\uwefechner\.julia\packages\DiffEqBase\ZXMKG\src\solve.jl:881 [inlined]
 [11] solve(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
    @ DiffEqBase C:\Users\uwefechner\.julia\packages\DiffEqBase\ZXMKG\src\solve.jl:871
 [12] top-level scope
    @ C:\Users\uwefechner\repos\WindTurbineModels\src\model_simple.jl:37
 [13] include(fname::String)
    @ Base.MainInclude .\client.jl:478
 [14] top-level scope
    @ REPL[1]:1
in expression starting at C:\Users\uwefechner\repos\WindTurbineModels\src\model_simple.jl:37

How can I fix this error?

Try Rosenbrock23() instead of Tsit5().

https://docs.sciml.ai/DiffEqDocs/stable/solvers/dae_solve/

OK, now I get a different error:

julia> include("src/model_simple.jl")
ERROR: LoadError: MethodError: Cannot `convert` an object of type SymbolicUtils.BasicSymbolic{Float64} to an object of type Float64

Closest candidates are:
  convert(::Type{T}, ::Unitful.Gain) where T<:Real
   @ Unitful C:\Users\uwefechner\.julia\packages\Unitful\orvol\src\logarithm.jl:62
  convert(::Type{T}, ::Unitful.Level) where T<:Real
   @ Unitful C:\Users\uwefechner\.julia\packages\Unitful\orvol\src\logarithm.jl:22
  convert(::Type{T}, ::Unitful.Quantity) where T<:Real
   @ Unitful C:\Users\uwefechner\.julia\packages\Unitful\orvol\src\conversion.jl:145
  ...

Stacktrace:
  [1] setindex!(A::Matrix{Float64}, x::SymbolicUtils.BasicSymbolic{Float64}, i1::Int64)
    @ Base .\array.jl:969
  [2] macro expansion
    @ C:\Users\uwefechner\.julia\packages\SymbolicUtils\H684H\src\code.jl:395 [inlined]
  [3] macro expansion
    @ C:\Users\uwefechner\.julia\packages\Symbolics\3jLt1\src\build_function.jl:520 [inlined]
  [4] macro expansion
    @ C:\Users\uwefechner\.julia\packages\SymbolicUtils\H684H\src\code.jl:352 [inlined]
  [5] macro expansion
    @ C:\Users\uwefechner\.julia\packages\RuntimeGeneratedFunctions\TAGuS\src\RuntimeGeneratedFunctions.jl:139 [inlined]
  [6] macro expansion
    @ .\none:0 [inlined]
  [7] generated_callfunc
    @ .\none:0 [inlined]
  [8] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr})(::Matrix{Float64}, ::Vector{Float64}, ::Vector{Float64}, ::Float64)
    @ RuntimeGeneratedFunctions C:\Users\uwefechner\.julia\packages\RuntimeGeneratedFunctions\TAGuS\src\RuntimeGeneratedFunctions.jl:126
  [9] _jac
    @ C:\Users\uwefechner\.julia\packages\ModelingToolkit\FbXPg\src\systems\diffeqs\abstractodesystem.jl:320 [inlined]
 [10] calc_J!
    @ C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\derivative_utils.jl:134 [inlined]
 [11] calc_W!
    @ C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\derivative_utils.jl:691 [inlined]
 [12] calc_W!
    @ C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\derivative_utils.jl:625 [inlined]
 [13] calc_rosenbrock_differentiation!(integrator::OrdinaryDiffEq.ODEIntegrator{Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, true, Vector{Float64}, Nothing, Float64, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, 
true, nothing}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", 
(0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, 
:ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 
0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Vector{Float64}, Vector{Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 
0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", 
ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Float64, Vector{Float64}}, LinearSolve.LinearCache{Matrix{Float64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, LinearSolve.InvPreconditioner{LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Float64, true, LinearSolve.OperatorCondition.IllConditioned}, Nothing, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Float64, Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Vector{Bool}}}, DiffEqBase.Stats, Nothing}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, 
Nothing, ODESystem}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Vector{Float64}, Vector{Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Float64, Vector{Float64}}, LinearSolve.LinearCache{Matrix{Float64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, LinearSolve.InvPreconditioner{LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Float64, true, LinearSolve.OperatorCondition.IllConditioned}, Nothing, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Float64, Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Vector{Bool}}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Vector{Float64}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Vector{Float64}, Vector{Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Float64, Vector{Float64}}, LinearSolve.LinearCache{Matrix{Float64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, LinearSolve.InvPreconditioner{LinearAlgebra.Diagonal{Float64, Vector{Float64}}}, LinearAlgebra.Diagonal{Float64, Vector{Float64}}, Float64, true, LinearSolve.OperatorCondition.IllConditioned}, Nothing, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.OrdinaryDiffEqTag, Float64}, Float64, 1}}, Float64, Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Vector{Bool}}, dtd1::Float64, dtgamma::Float64, repeat_step::Bool, W_transform::Bool)
    @ OrdinaryDiffEq C:\Users\uwefechner\.julia\packages\OrdinaryDiffEq\2w7ff\src\derivative_utils.jl:782
 [14] perform_step!(integrator::OrdinaryDiffEq.ODEIntegrator{Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, true, Vector{Float64}, Nothing, Float64, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Rosenbrock23{2, true, LinearSolve.GenericLUFactorization{LinearAlgebra.RowMaximum}, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), 
ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x24a2cbce, 0xddf663b9, 0x3d474482, 0xf41becbe, 0x791fff03), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xeeff4e77, 0xcbf68850, 0xfd992a37, 0x7f8f8cfe, 0x6fb78f10), Expr}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Vector{Symbol}, Symbol, Vector{Symbol}, ModelingToolkit.var"#567#generated_observed#528"{Bool, ODESystem, Dict{Any, Any}}, Nothing, ODESystem}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Rosenbrock23Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, SciMLBase.AutoSpecialize, ModelingToolkit.var"#f#520"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x60b2d55f, 0x83231ba8, 0x8631cf66, 0xe25b9c8f, 0xb4d91b56), Expr}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x7076fd7f, 0x5daeca22, 0xe7cca248, 0x572baf84, 0xbeafb06c), Expr}}, Matrix{Float64}, Nothing, Nothing, ModelingToolkit.var"#_jac#524"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2, :t), REPL[1]:1
in expression starting at C:\Users\uwefechner\repos\WindTurbineModels\src\model_simple.jl:37

This is not a difficult problem, I can easily solve it with Simulink, but I would like to solve it with Julia…

I’m not sure if your actual problem is bigger and requires a jacobian for a reasonable solve time, but if you run your test problem without jac=true, the problem seems to solve just fine as long as you use a mass matrix compatible solver (such as Rosenbrock23).

I don’t know the answer to why you’re getting the type error when you have use jac=true, but you should be able to get something running if you just remove that keyword.

This indeed solves the issue. Thank you! :grinning:

This should get reported as a bug for the jac construction. But indeed autodiff is fine here.

1 Like