Skip to content

plot not working #119

@1-Bart-1

Description

@1-Bart-1

I am using MPC.jl in a module. When running ModelPredictiveControl.plot(res; plotx=true, ploty=true, plotu=true, plotxwithx̂=true) I get the error:

ERROR: MethodError: no method matching plot(::ModelPredictiveControl.SimResult{Float64, ModelPredictiveControl.LinMPC{…}}; plotx::Bool, ploty::Bool, plotu::Bool, plotxwithx̂::Bool)

Closest candidates are:
  plot(::Nothing, ::ModelPredictiveControl.SimResult{<:Real, <:ModelPredictiveControl.PredictiveController}) got unsupported keyword arguments "plotx", "ploty", "plotu", "plotxwithx̂"
   @ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/0rhFm/src/plot_sim.jl:325
  plot(::Nothing, ::ModelPredictiveControl.SimResult{<:Real, <:ModelPredictiveControl.StateEstimator}) got unsupported keyword arguments "plotx", "ploty", "plotu", "plotxwithx̂"
   @ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/0rhFm/src/plot_sim.jl:324
  plot(::Nothing, ::ModelPredictiveControl.SimResult{<:Real, <:ModelPredictiveControl.SimModel}) got unsupported keyword arguments "plotx", "ploty", "plotu", "plotxwithx̂"
   @ ModelPredictiveControl ~/.julia/packages/ModelPredictiveControl/0rhFm/src/plot_sim.jl:323

Stacktrace:
 [1] plot(ci::ControlInterface)
   @ KitePredictiveControl ~/Code/KitePredictiveControl.jl/src/KitePredictiveControl.jl:209
 [2] top-level scope
   @ ./REPL[17]:5
Some type information was truncated. Use `show(err)` to see complete types.

I don't know what could cause this. It worked before, but after some code reformatting, it stopped working.

julia> typeof(res)
SimResult{Float64, LinMPC{Float64, KalmanFilter{Float64, LinModel{Float64}}, JuMP.Model}}

julia> res.obj
LinMPC controller with a sample time Ts = 0.05 s, DAQP optimizer, KalmanFilter estimator and:
 20 prediction steps Hp
  4 control steps Hc
  1 slack variable ϵ (control constraints)
  3 manipulated inputs u (3 integrating states)
 78 estimated states x̂
 26 measured outputs ym (23 integrating states)
  0 unmeasured outputs yu
  0 measured disturbances d
  
  julia> res.X_data
52×800 Matrix{Float64}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0    0.0  0.0  0.0  0.0  0.0  0.0  12.1372       12.4948    12.1372       12.1184
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   0.420671      0.398937   0.420671      0.420346
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  26.1225       24.0023    26.1225       26.1313
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  12.1372       12.4948    12.1372       12.1184
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  -0.420671     -0.398937  -0.420671     -0.420346
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0    0.0  0.0  0.0  0.0  0.0  0.0  26.1225       24.0023    26.1225       26.1313
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   2.23948       2.17889    2.23948       2.23148
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   2.14705e-11   0.0        1.76796e-11   1.65288e-11
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  25.0963       24.9049    25.0963       25.102
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   0.14923       0.0        0.14923       0.15375
                                                                                                                                                            
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   0.308326      0.0        0.308326      0.210995
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  -0.338401      0.0       -0.338401     -0.269748
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   5.05014e-12   0.0       -7.45084e-12  -4.56091e-11
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0    0.0  0.0  0.0  0.0  0.0  0.0   0.307788      0.0        0.307788      0.209391
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  57.611        57.6066    57.611        57.611
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  57.611        57.6066    57.611        57.611
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  50.1319       50.0       50.1319       50.1404
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   0.00112142    0.0        0.00112142    0.0011503
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0    0.0  0.0  0.0  0.0  0.0  0.0   0.00112142    0.0        0.00112142    0.0011503
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0   0.16879       0.0        0.16879       0.169753

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions