|
124 | 124 | @test_throws ErrorException Luenberger(linmodel1, nint_ym=[-1,0]) |
125 | 125 | @test_throws ErrorException Luenberger(linmodel1, p̂=[0.5]) |
126 | 126 | @test_throws ErrorException Luenberger(linmodel1, p̂=fill(1.5, lo1.nx̂)) |
127 | | -end |
| 127 | + @test_throws ErrorException Luenberger(LinModel(tf(1,[1, 0]),0.1), p̂=[0.5,0.6]) |
| 128 | +end |
128 | 129 |
|
129 | 130 | @testset "Luenberger estimator methods" begin |
130 | 131 | linmodel1 = setop!(LinModel(sys,Ts,i_u=[1,2]), uop=[10,50], yop=[50,30]) |
@@ -176,10 +177,10 @@ end |
176 | 177 | @test internalmodel5.nyu == 0 |
177 | 178 | @test internalmodel5.nxs == 4 |
178 | 179 | @test internalmodel5.nx̂ == 4 |
179 | | - @test internalmodel5.As == stoch_ym_ss.A |
180 | | - @test internalmodel5.Bs == stoch_ym_ss.B |
181 | | - @test internalmodel5.Cs == stoch_ym_ss.C |
182 | | - @test internalmodel5.Ds == stoch_ym_ss.D |
| 180 | + @test internalmodel5.As ≈ stoch_ym_ss.A |
| 181 | + @test internalmodel5.Bs ≈ stoch_ym_ss.B |
| 182 | + @test internalmodel5.Cs ≈ stoch_ym_ss.C |
| 183 | + @test internalmodel5.Ds ≈ stoch_ym_ss.D |
183 | 184 |
|
184 | 185 | stoch_ym_resample = c2d(d2c(ss(1,1,1,1,linmodel2.Ts), :tustin), 2linmodel2.Ts, :tustin) |
185 | 186 | internalmodel6 = InternalModel(linmodel2, i_ym=[2], stoch_ym=stoch_ym_resample) |
|
188 | 189 | @test internalmodel6.Cs ≈ internalmodel2.Cs |
189 | 190 | @test internalmodel6.Ds ≈ internalmodel2.Ds |
190 | 191 |
|
| 192 | + stoch_ym_cont = ss(zeros(2,2), I(2), I(2), zeros(2,2)) |
| 193 | + stoch_ym_disc = c2d(stoch_ym_cont, linmodel2.Ts, :tustin) |
| 194 | + internalmodel7 = InternalModel(linmodel2, stoch_ym=stoch_ym_cont) |
| 195 | + @test internalmodel7.As ≈ stoch_ym_disc.A |
| 196 | + @test internalmodel7.Bs ≈ stoch_ym_disc.B |
| 197 | + @test internalmodel7.Cs ≈ stoch_ym_disc.C |
| 198 | + @test internalmodel7.Ds ≈ stoch_ym_disc.D |
| 199 | + |
191 | 200 | unstablemodel = LinModel(ss(diagm([0.5, -0.5, 1.5]), ones(3,1), I, 0, 1)) |
192 | 201 | @test_throws ErrorException InternalModel(unstablemodel) |
193 | 202 | @test_throws ErrorException InternalModel(linmodel1, i_ym=[1,4]) |
|
0 commit comments