|
244 | 244 | model = LinModel(sys, Ts, i_d=[3]) |
245 | 245 | mpc = LinMPC(model, Hp=1, Hc=1) |
246 | 246 |
|
| 247 | + # test default constraints before modifying any: |
| 248 | + @test all((mpc.con.U0min, mpc.con.U0max) .≈ (fill(-Inf, model.nu), fill(Inf, model.nu))) |
| 249 | + @test all((mpc.con.ΔŨmin, mpc.con.ΔŨmax) .≈ (vcat(fill(-Inf, model.nu), 0), vcat(fill(Inf, model.nu), Inf))) |
| 250 | + @test all((mpc.con.Y0min, mpc.con.Y0max) .≈ (fill(-Inf, model.ny), fill(Inf, model.ny))) |
| 251 | + @test all((mpc.con.x̂0min, mpc.con.x̂0max) .≈ (fill(-Inf, mpc.estim.nx̂), fill(Inf, mpc.estim.nx̂))) |
| 252 | + @test all((-mpc.con.A_Umin[:, end], -mpc.con.A_Umax[:, end]) .≈ (fill(0.0, model.nu), fill(0.0, model.nu))) |
| 253 | + @test all((-mpc.con.A_ΔŨmin[1:end-1, end], -mpc.con.A_ΔŨmax[1:end-1, end]) .≈ (fill(0.0, model.nu), fill(0.0, model.nu))) |
| 254 | + @test all((-mpc.con.A_Ymin[:, end], -mpc.con.A_Ymax[:, end]) .≈ (fill(1.0, model.ny), fill(1.0, model.ny))) |
| 255 | + @test all((-mpc.con.A_x̂min[:, end], -mpc.con.A_x̂max[:, end]) .≈ (fill(1.0, mpc.estim.nx̂), fill(1.0, mpc.estim.nx̂))) |
| 256 | + |
247 | 257 | setconstraint!(mpc, umin=[-5, -9.9], umax=[100,99]) |
248 | 258 | @test all((mpc.con.U0min, mpc.con.U0max) .≈ ([-5, -9.9], [100,99])) |
249 | 259 | setconstraint!(mpc, Δumin=[-5,-10], Δumax=[6,11]) |
|
0 commit comments