|
555 | 555 | end |
556 | 556 |
|
557 | 557 | @testitem "NonLinMPC construction" setup=[SetupMPCtests] begin |
558 | | - using .SetupMPCtests, ControlSystemsBase, LinearAlgebra, JuMP, Ipopt |
| 558 | + using .SetupMPCtests, ControlSystemsBase, LinearAlgebra |
| 559 | + using JuMP, Ipopt, DifferentiationInterface |
| 560 | + import FiniteDiff |
559 | 561 | linmodel1 = LinModel(sys,Ts,i_d=[3]) |
560 | 562 | nmpc0 = NonLinMPC(linmodel1, Hp=15) |
561 | 563 | @test isa(nmpc0.estim, SteadyKalmanFilter) |
|
612 | 614 | @test nmpc17.transcription == MultipleShooting() |
613 | 615 | @test length(nmpc17.Z̃) == linmodel1.nu*nmpc17.Hc + nmpc17.estim.nx̂*nmpc17.Hp + nmpc17.nϵ |
614 | 616 | @test size(nmpc17.con.Aeq, 1) == nmpc17.estim.nx̂*nmpc17.Hp |
| 617 | + @test_nowarn nmpc18 = NonLinMPC(nonlinmodel, Hp=10, |
| 618 | + gradient=AutoFiniteDiff(), |
| 619 | + jacobian=AutoFiniteDiff() |
| 620 | + ) |
615 | 621 |
|
616 | 622 | nonlinmodel2 = NonLinModel{Float32}(f, h, Ts, 2, 4, 2, 1, solver=nothing) |
617 | 623 | nmpc15 = NonLinMPC(nonlinmodel2, Hp=15) |
|
629 | 635 | end |
630 | 636 |
|
631 | 637 | @testitem "NonLinMPC moves and getinfo" setup=[SetupMPCtests] begin |
632 | | - using .SetupMPCtests, ControlSystemsBase, LinearAlgebra, ForwardDiff |
| 638 | + using .SetupMPCtests, ControlSystemsBase, LinearAlgebra |
| 639 | + using DifferentiationInterface |
| 640 | + import FiniteDiff |
633 | 641 | linmodel = setop!(LinModel(tf(5, [2000, 1]), 3000.0), yop=[10]) |
634 | 642 | Hp = 100 |
635 | 643 | nmpc_lin = NonLinMPC(linmodel, Nwt=[0], Hp=Hp, Hc=1) |
|
0 commit comments