Skip to content

Commit cd2f641

Browse files
committed
test: verify that setmodel! is allowed with defaults on SteadyKalmanFilter and Luenberger
1 parent 46b04fe commit cd2f641

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/test_predictive_control.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ end
601601
nonlinmodel = NonLinModel(f, h, 3000.0, 1, 2, 1, 1, solver=nothing)
602602
nmpc2 = NonLinMPC(nonlinmodel, Nwt=[0], Hp=1000, Hc=1)
603603
d = [0.1]
604-
preparestate!(nmpc2, [0], [0])
604+
preparestate!(nmpc2, [0], d)
605605
u = moveinput!(nmpc2, 7d, d)
606606
@test u [0] atol=5e-2
607607
u = nmpc2(7d, d)

test/test_state_estim.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ end
119119
linmodel = LinModel(ss(0.5, 0.3, 1.0, 0, 10.0))
120120
linmodel = setop!(linmodel, uop=[2.0], yop=[50.0], xop=[3.0], fop=[3.0])
121121
skalmanfilter = SteadyKalmanFilter(linmodel, nint_ym=0)
122-
@test_throws ErrorException setmodel!(skalmanfilter, linmodel)
122+
@test_nowarn setmodel!(skalmanfilter, linmodel)
123+
@test_throws ErrorException setmodel!(skalmanfilter, deepcopy(linmodel))
124+
@test_throws ErrorException setmodel!(skalmanfilter, linmodel, Q̂=[0.01])
125+
@test_throws ErrorException setmodel!(skalmanfilter, linmodel, R̂=[0.01])
123126
end
124127

125128
@testset "SteadyKalmanFilter real-time simulations" begin
@@ -349,7 +352,8 @@ end
349352
linmodel = LinModel(ss(0.5, 0.3, 1.0, 0, 10.0))
350353
linmodel = setop!(linmodel, uop=[2.0], yop=[50.0], xop=[3.0], fop=[3.0])
351354
lo = Luenberger(linmodel, nint_ym=0)
352-
@test_throws ErrorException setmodel!(lo, linmodel)
355+
@test_nowarn setmodel!(lo, linmodel)
356+
@test_throws ErrorException setmodel!(lo, deepcopy(linmodel))
353357
end
354358

355359
@testset "InternalModel construction" begin

0 commit comments

Comments
 (0)