Skip to content

Commit ba5c207

Browse files
committed
Merge branch 'main' into diff_interface_final
2 parents cff734a + c12d7bc commit ba5c207

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/3_test_predictive_control.jl

+12-1
Original file line numberDiff line numberDiff line change
@@ -1001,13 +1001,24 @@ end
10011001
info = getinfo(nmpc)
10021002
@test all(isapprox.(info[:Ŷ], 3.14; atol=1e-1))
10031003
@test all(isapprox.(info[:gc][Hp+1:end], 0.0; atol=1e-1))
1004-
1004+
10051005
nmpc_ms = NonLinMPC(
10061006
nonlinmodel; Hp, Hc=5, transcription=MultipleShooting(), gc, nc=2Hp, p=[0; 0]
10071007
)
10081008

1009+
setconstraint!(nmpc_ms, x̂min=[-1e6,-Inf], x̂max=[+1e6,+Inf])
1010+
setconstraint!(nmpc_ms, ymin=[-100], ymax=[100])
10091011
preparestate!(nmpc_ms, [0])
10101012

1013+
setconstraint!(nmpc_ms, ymin=[-0.5], ymax=[0.9])
1014+
moveinput!(nmpc_ms, [-100])
1015+
info = getinfo(nmpc_ms)
1016+
@test all(isapprox.(info[:Ŷ], -0.5; atol=1e-1))
1017+
moveinput!(nmpc_ms, [100])
1018+
info = getinfo(nmpc_ms)
1019+
@test all(isapprox.(info[:Ŷ], 0.9; atol=1e-1))
1020+
setconstraint!(nmpc_ms, ymin=[-100], ymax=[100])
1021+
10111022
setconstraint!(nmpc_ms, x̂min=[-1e-6,-Inf], x̂max=[+1e-6,+Inf])
10121023
moveinput!(nmpc_ms, [-10])
10131024
info = getinfo(nmpc_ms)

0 commit comments

Comments
 (0)