872872 @test mhe5. nx̂ == 8
873873
874874 mhe6 = MovingHorizonEstimator (nonlinmodel, He= 5 , σP_0= [1 ,2 ,3 ,4 ], σPint_ym_0= [5 ,6 ])
875- @test mhe6. P̂_0 ≈ Hermitian (diagm (Float64[1 , 4 , 9 ,16 , 25 , 36 ]))
875+ @test mhe6. cov . P̂_0 ≈ Hermitian (diagm (Float64[1 , 4 , 9 ,16 , 25 , 36 ]))
876876 @test mhe6. P̂arr_old ≈ Hermitian (diagm (Float64[1 , 4 , 9 ,16 , 25 , 36 ]))
877- @test mhe6. P̂_0 != = mhe6. P̂arr_old
877+ @test mhe6. cov . P̂_0 != = mhe6. P̂arr_old
878878
879879 mhe7 = MovingHorizonEstimator (nonlinmodel, He= 10 )
880880 @test mhe7. He == 10
894894 I_2 = Matrix {Float64} (I, 2 , 2 )
895895 optim = Model (Ipopt. Optimizer)
896896 mhe9 = MovingHorizonEstimator (nonlinmodel, 5 , 1 : 2 , 0 , [1 , 1 ], I_6, I_6, I_2, 1e5 ; optim)
897- @test mhe9. P̂_0 ≈ I (6 )
898- @test mhe9. Q̂ ≈ I (6 )
899- @test mhe9. R̂ ≈ I (2 )
897+ @test mhe9. cov . P̂_0 ≈ I (6 )
898+ @test mhe9. cov . Q̂ ≈ I (6 )
899+ @test mhe9. cov . R̂ ≈ I (2 )
900900
901901 optim = JuMP. Model (optimizer_with_attributes (Ipopt. Optimizer, " nlp_scaling_max_gradient" => 1.0 ))
902902 covestim = ExtendedKalmanFilter (nonlinmodel, 1 : 2 , 0 , [1 , 1 ], I_6, I_6, I_2)
@@ -1103,13 +1103,13 @@ end
11031103 preparestate! (mhe, [50 , 30 ], [5 ])
11041104 )
11051105 @test mhe. P̂arr_old ≈ P̂arr_old_copy
1106- @test mhe. invP̄ ≈ invP̄_copy
1106+ @test mhe. cov . invP̄ ≈ invP̄_copy
11071107 @test_logs (
11081108 (:error , " Arrival covariance P̄ is not positive definite: keeping the old one" ),
11091109 updatestate! (mhe, [10 , 50 ], [50 , 30 ], [5 ])
11101110 )
11111111 @test mhe. P̂arr_old ≈ P̂arr_old_copy
1112- @test mhe. invP̄ ≈ invP̄_copy
1112+ @test mhe. cov . invP̄ ≈ invP̄_copy
11131113 @test_logs (
11141114 (:error , " Arrival covariance P̄ is not invertible: keeping the old one" ),
11151115 ModelPredictiveControl. invert_cov! (mhe, Hermitian (zeros (mhe. nx̂, mhe. nx̂),:L ))
@@ -1122,7 +1122,7 @@ end
11221122 preparestate! (mhe, [50 , 30 ], [5 ])
11231123 )
11241124 @test mhe. P̂arr_old ≈ P̂arr_old_copy
1125- @test mhe. invP̄ ≈ invP̄_copy
1125+ @test mhe. cov . invP̄ ≈ invP̄_copy
11261126 @test_logs (
11271127 (:error , " Arrival covariance P̄ is not finite: keeping the old one" ),
11281128 updatestate! (mhe, [10 , 50 ], [50 , 30 ], [5 ])
@@ -1347,8 +1347,8 @@ end
13471347 @test mhe. con. x̃0min ≈ [- 1000 - 8.0 ]
13481348 @test mhe. con. x̃0max ≈ [+ 1000 - 8.0 ]
13491349 setmodel! (mhe, Q̂= [1e-3 ], R̂= [1e-6 ])
1350- @test mhe. Q̂ ≈ [1e-3 ]
1351- @test mhe. R̂ ≈ [1e-6 ]
1350+ @test mhe. cov . Q̂ ≈ [1e-3 ]
1351+ @test mhe. cov . R̂ ≈ [1e-6 ]
13521352 f (x,u,d,model) = model. A* x + model. Bu* u + model. Bd* d
13531353 h (x,d,model) = model. C* x + model. Du* d
13541354 nonlinmodel = NonLinModel (f, h, 10.0 , 1 , 1 , 1 , p= linmodel, solver= nothing )
0 commit comments