diff --git a/test/1_test_sim_model.jl b/test/1_test_sim_model.jl index 51f5cecef..e2eabb750 100644 --- a/test/1_test_sim_model.jl +++ b/test/1_test_sim_model.jl @@ -265,6 +265,10 @@ end @test_throws ErrorException NonLinModel( (x,u,_,_)->linmodel1.A*x + linmodel1.Bu*u, (x,_)->linmodel1.C*x, Ts, 2, 4, 2, 1, solver=nothing) + + @test_throws ArgumentError RungeKutta(2) + @test_throws ArgumentError RungeKutta(0) + @test_throws ArgumentError RungeKutta(4, supersample=0) end @testitem "NonLinModel sim methods" setup=[SetupMPCtests] begin diff --git a/test/5_test_extensions.jl b/test/5_test_extensions.jl index cf0cabfc7..1384c0bd5 100644 --- a/test/5_test_extensions.jl +++ b/test/5_test_extensions.jl @@ -177,3 +177,24 @@ end u_data1, u_data2 = sim_wr(model, mpc1, mpc2, N) @test u_data1 ≈ u_data2 atol=1e-2 rtol=1e-2 end + +@testitem "LinearMPCext unsupported features" setup=[SetupMPCtests] begin + using .SetupMPCtests, ControlSystemsBase, LinearAlgebra, JuMP, DAQP + import LinearMPC + optim = Model(DAQP.Optimizer) + model = LinModel(tf([2], [10, 1]), 3.0) + mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 1, 3]); optim) + @test_nowarn LinearMPC.MPC(mpc) + mpc = LinMPC(model, Hp=3, M_Hp=diagm([1, 2, 3]); optim) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = LinMPC(model, Hc=3, N_Hc=diagm([1, 2, 3]); optim) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = LinMPC(model, Hp=3, L_Hp=diagm([1, 2, 3]); optim) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = setconstraint!(LinMPC(model; optim), c_ymin=[1], c_ymax=[0.5]) + @test_throws ErrorException LinearMPC.MPC(mpc) + mpc = setconstraint!(LinMPC(model; optim), c_ymin=[0.5], c_ymax=[0.5]) + @test_logs (:warn, + "LinearMPC only supports softness parameters c = 0 or 1.\n"* + "All constraints with c > 0 will be considered soft.") LinearMPC.MPC(mpc) +end \ No newline at end of file