|
81 | 81 | preparestate!(mpc1, [10]) |
82 | 82 | u = moveinput!(mpc1, r) |
83 | 83 | @test u ≈ [1] atol=1e-2 |
84 | | - u = mpc1(r) |
| 84 | + u = mpc1(r, lastu=[-1]) |
85 | 85 | @test u ≈ [1] atol=1e-2 |
86 | 86 | info = getinfo(mpc1) |
87 | 87 | @test info[:u] ≈ u |
88 | 88 | @test info[:Ŷ][end] ≈ r[1] atol=1e-2 |
| 89 | + @test info[:ΔU] ≈ [2.0] atol=1e-2 |
89 | 90 | mpc2 = LinMPC(linmodel, Nwt=[0], Cwt=Inf, Hp=1000, Hc=1) |
90 | 91 | preparestate!(mpc2, [10]) |
91 | 92 | u = moveinput!(mpc2, r) |
@@ -515,11 +516,12 @@ end |
515 | 516 | preparestate!(mpc1, y) |
516 | 517 | u = moveinput!(mpc1, r) |
517 | 518 | @test u ≈ [1] atol=1e-2 |
518 | | - u = mpc1(r) |
| 519 | + u = mpc1(r, lastu=[-1]) |
519 | 520 | @test u ≈ [1] atol=1e-2 |
520 | 521 | info = getinfo(mpc1) |
521 | 522 | @test info[:u] ≈ u |
522 | 523 | @test info[:Ŷ][end] ≈ r[1] atol=1e-2 |
| 524 | + @test info[:ΔU] ≈ [2.0] atol=1e-2 |
523 | 525 | mpc2 = ExplicitMPC(model, Nwt=[0], Hp=1000, Hc=1) |
524 | 526 | preparestate!(mpc2, y) |
525 | 527 | u = moveinput!(mpc2, [5]) |
@@ -756,11 +758,12 @@ end |
756 | 758 | preparestate!(nmpc_lin, [10]) |
757 | 759 | u = moveinput!(nmpc_lin, ry) |
758 | 760 | @test u ≈ [1] atol=5e-2 |
759 | | - u = nmpc_lin(ry) |
| 761 | + u = nmpc_lin(ry, lastu=[-1]) |
760 | 762 | @test u ≈ [1] atol=5e-2 |
761 | 763 | info = getinfo(nmpc_lin) |
762 | 764 | @test info[:u] ≈ u |
763 | 765 | @test info[:Ŷ][end] ≈ ry[1] atol=5e-2 |
| 766 | + @test info[:ΔU] ≈ [2.0] atol=5e-2 |
764 | 767 | setmodel!(nmpc_lin; Mwt=[0], Lwt=[1]) |
765 | 768 | u = moveinput!(nmpc_lin; R̂u=fill(ru[1], Hp)) |
766 | 769 | @test u ≈ [4] atol=5e-2 |
|
0 commit comments