|
49 | 49 | @test skalmanfilter9.cov.Q̂ ≈ I(4) |
50 | 50 | @test skalmanfilter9.cov.R̂ ≈ I(2) |
51 | 51 |
|
52 | | - @test_throws ErrorException SteadyKalmanFilter(linmodel, nint_ym=[1,1,1]) |
53 | | - @test_throws ErrorException SteadyKalmanFilter(linmodel, nint_ym=[-1,0]) |
54 | | - @test_throws ErrorException SteadyKalmanFilter(linmodel, nint_ym=0, σQ=[1]) |
55 | | - @test_throws ErrorException SteadyKalmanFilter(linmodel, nint_ym=0, σR=[1,1,1]) |
| 52 | + @test_throws DimensionMismatch SteadyKalmanFilter(linmodel, nint_ym=[1,1,1]) |
| 53 | + @test_throws ArgumentError SteadyKalmanFilter(linmodel, nint_ym=[-1,0]) |
| 54 | + @test_throws DimensionMismatch SteadyKalmanFilter(linmodel, nint_ym=0, σQ=[1]) |
| 55 | + @test_throws DimensionMismatch SteadyKalmanFilter(linmodel, nint_ym=0, σR=[1,1,1]) |
56 | 56 | @test_throws ErrorException SteadyKalmanFilter(linmodel3, nint_ym=[1, 0, 0]) |
57 | 57 | model_unobs = LinModel([1 0;0 1.5], [1; 0], [1 0], zeros(2,0), zeros(1,0), 1.0) |
58 | 58 | @test_throws ErrorException SteadyKalmanFilter(model_unobs, nint_ym=[1]) |
|
188 | 188 | kalmanfilter8 = KalmanFilter(linmodel2) |
189 | 189 | @test isa(kalmanfilter8, KalmanFilter{Float32}) |
190 | 190 |
|
191 | | - @test_throws ErrorException KalmanFilter(linmodel, nint_ym=0, σP_0=[1]) |
| 191 | + @test_throws DimensionMismatch KalmanFilter(linmodel, nint_ym=0, σP_0=[1]) |
192 | 192 | end |
193 | 193 |
|
194 | 194 | @testitem "KalmanFilter estimator methods" setup=[SetupMPCtests] begin |
|
302 | 302 | lo6 = Luenberger(linmodel2) |
303 | 303 | @test isa(lo6, Luenberger{Float32}) |
304 | 304 |
|
305 | | - @test_throws ErrorException Luenberger(linmodel, nint_ym=[1,1,1]) |
306 | | - @test_throws ErrorException Luenberger(linmodel, nint_ym=[-1,0]) |
| 305 | + @test_throws DimensionMismatch Luenberger(linmodel, nint_ym=[1,1,1]) |
| 306 | + @test_throws ArgumentError Luenberger(linmodel, nint_ym=[-1,0]) |
307 | 307 | @test_throws ErrorException Luenberger(linmodel, poles=[0.5]) |
308 | 308 | @test_throws ErrorException Luenberger(linmodel, poles=fill(1.5, lo1.nx̂)) |
309 | 309 | @test_throws ErrorException Luenberger(LinModel(tf(1,[1, 0]),0.1), poles=[0.5,0.6]) |
@@ -1603,8 +1603,8 @@ end |
1603 | 1603 | @testitem "ManualEstimator construction" setup=[SetupMPCtests] begin |
1604 | 1604 | using .SetupMPCtests, ControlSystemsBase, LinearAlgebra |
1605 | 1605 | linmodel = LinModel(sys,Ts,i_u=[1,2]) |
1606 | | - f(x,u,d,model) = model.A*x + model.Bu*u + model.Bd*d |
1607 | | - h(x,d,model) = model.C*x + model.Du*d |
| 1606 | + f = (x,u,d,model) -> model.A*x + model.Bu*u + model.Bd*d |
| 1607 | + h = (x,d,model) -> model.C*x + model.Du*d |
1608 | 1608 | nonlinmodel = NonLinModel(f, h, Ts, 2, 4, 2, 1, solver=nothing, p=linmodel) |
1609 | 1609 |
|
1610 | 1610 | manual1 = ManualEstimator(linmodel) |
@@ -1651,8 +1651,8 @@ end |
1651 | 1651 | @testitem "ManualEstimator estimator methods" setup=[SetupMPCtests] begin |
1652 | 1652 | using .SetupMPCtests, ControlSystemsBase, LinearAlgebra |
1653 | 1653 | linmodel = LinModel(sys,Ts,i_u=[1,2]) |
1654 | | - f(x,u,d,model) = model.A*x + model.Bu*u + model.Bd*d |
1655 | | - h(x,d,model) = model.C*x + model.Du*d |
| 1654 | + f = (x,u,d,model) -> model.A*x + model.Bu*u + model.Bd*d |
| 1655 | + h = (x,d,model) -> model.C*x + model.Du*d |
1656 | 1656 | nonlinmodel = NonLinModel(f, h, Ts, 2, 2, 2, 0, solver=nothing, p=linmodel) |
1657 | 1657 |
|
1658 | 1658 | manual1 = ManualEstimator(linmodel) |
|
0 commit comments