Skip to content

Commit e48ed89

Browse files
committed
test : wip
1 parent 1ddf323 commit e48ed89

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/3_test_predictive_control.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,17 @@ end
799799
# execute update_predictions! branch in `geqfunc_i` for coverage:
800800
geq_end = nmpc5.optim[:geq_2].func
801801
@test_nowarn geq_end(5.0, 4.0, 3.0, 2.0)
802+
803+
f! = (ẋ,x,u,_,_) -> ẋ .= -0.001x .+ u
804+
h! = (y,x,_,_) -> y .= x
805+
nonlinmodel_c = NonLinModel(f!, h!, 100, 1, 1, 1)
806+
nmpc5 = NonLinMPC(nonlinmodel_c, Nwt=[0], Hp=100, Hc=1, transcription=TrapezoidalCollocation())
807+
preparestate!(nmpc5, [0.0])
808+
u = moveinput!(nmpc5, [1/0.001])
809+
#@test u ≈ [1.0] atol=5e-2
810+
println(u)
811+
using Plots; plot(sim!(nmpc5, 100, [1/0.001])) |> display
812+
802813
nmpc6 = NonLinMPC(linmodel3, Hp=10)
803814
preparestate!(nmpc6, [0])
804815
@test moveinput!(nmpc6, [0]) [0.0] atol=5e-2

0 commit comments

Comments
 (0)