Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on execution of doc example #146

Closed
pekpuglia opened this issue Jan 10, 2025 · 8 comments
Closed

Error on execution of doc example #146

pekpuglia opened this issue Jan 10, 2025 · 8 comments
Assignees

Comments

@pekpuglia
Copy link

I tried to run this example and got a giant error at sim!, which begins with:

ERROR: MethodError: no method matching ndims(::Type{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}})

Closest candidates are:
ndims(::Base.Broadcast.Broadcasted)
@ Base broadcast.jl:247
ndims(::ArrayInterface.ArrayIndex{N}) where N
@ ArrayInterface ~/.julia/packages/ArrayInterface/a4Wwt/src/ArrayInterface.jl:851
ndims(::Base.Generator)
@ Base generator.jl:53
...

Stacktrace:
[1] Base.Broadcast.BroadcastStyle(#unused#::Type{PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}})
@ Base.Broadcast ./broadcast.jl:103
[2] combine_styles(c::PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}})
@ Base.Broadcast ./broadcast.jl:448
[3] combine_styles(c1::PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, c2::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(identity), Tuple{Vector{Float64}}})
@ Base.Broadcast ./broadcast.jl:449
[4] materialize!
@ ./broadcast.jl:881 [inlined]
[5] (::ModelPredictiveControl.var"#inner_solver_f!#24"{DataType, RungeKutta, ModelPredictiveControl.var"#f!#35"{typeof(f)}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Float64})(xnext::Vector{Float64}, x::Vector{Float64}, u::Vector{Float64}, d::Vector{Float64}, p::Vector{Float64})
@ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/KRRfW/src/model/solver.jl:56

The error appears to come from this line:

@. xcur = x

I'm using Julia 1.9.

@franckgaga
Copy link
Member

franckgaga commented Jan 10, 2025

Thanks for the report. Probably because 1.9 is no longer officially supported, the new LTS is 1.10. edit: I'll do some test on 1.9 and I'll come back to you

@franckgaga franckgaga self-assigned this Jan 10, 2025
@franckgaga
Copy link
Member

franckgaga commented Jan 10, 2025

I just tried to run the motor exemple in the manual on Julia 1.9, and there is no error. Are you using the last stable version of the package (v1.1.4) ?

@franckgaga
Copy link
Member

Weird I tested it today and now I can reproduce. I'll investigate on that.

@franckgaga
Copy link
Member

franckgaga commented Jan 11, 2025

Ok yes this is a compatibility issue. You cannot use the last stable version of ModelPredictiveControl.jl since Julia 1.9 is no longer supported. You have two choices: installing v1.0.1 version of this package:

using Pkg; Pkg.add(name="ModelPredictiveControl", version="1.0.1")

or updating Julia to 1.10 or newer. This can be done easily with juliaup installer.

@franckgaga
Copy link
Member

@pekpuglia, is the issue persisting with one of the two workarounds ?

@pekpuglia
Copy link
Author

Hello, thank you for your responses, I still haven't had the time to get back to this. Maybe by the end of the week, but this looks good. Will try migrating to julia 1.10.

@pekpuglia
Copy link
Author

Hi, switched to julia 1.10, works like a charm. Maybe add a compat line in Project.toml?

@franckgaga
Copy link
Member

Yes, I added the line in the last version of the package (v1.2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants