@@ -183,6 +183,7 @@ struct MovingHorizonEstimator{
183183 P̂arr_old = copy (cov. P̂_0)
184184 Nk = [0 ]
185185 corrected = [false ]
186+ test_custom_function_mhe (NT, model, i_ym, He, gc!, nc, x̂op, p)
186187 buffer = StateEstimatorBuffer {NT} (nu, nx̂, nym, ny, nd, nk, He, nε)
187188 estim = new {NT, SM, KC, JM, GB, JB, HB, PT, GCfunc, CE} (
188189 model,
@@ -647,19 +648,23 @@ function get_mutating_gc_mhe(NT, gc)
647648end
648649
649650"""
650- test_custom_function_mhe(NT, model::SimModel, gc!, nc, X̂op, Ymop, Uop, Dop , p) -> nothing
651+ test_custom_function_mhe(NT, model::SimModel, i_ym, He, gc!, nc, x̂op , p) -> nothing
651652
652- Test the custom functions `gc!` at the operating points
653+ Test the custom functions `gc!` at the operating points.
653654
654655This function is called at the end of `MovingHorizonEstimator` construction. It warns the
655- user if the custom constraint `gc!` functions crash at `model` operating points. This
656+ user if the custom constraint `gc!` function crashes at `model` operating points. This
656657should ease troubleshooting of simple bugs e.g.: the user forgets to set the `nc` argument.
657658"""
658- function test_custom_function_mhe (NT, model:: SimModel , gc!, nc, X̂op, Ymop, Uop, Dop, p)
659+ function test_custom_function_mhe (NT, model:: SimModel , i_ym, He, gc!, nc, x̂op, p)
660+ nŵ, nym = length (x̂op), length (i_ym)
659661 uop, dop, yop = model. uop, model. dop, model. yop
662+ yopm = yop[i_ym]
663+ X̂e, V̂e, Ŵe = repeat (x̂op, He+ 1 ), zeros (NT, (He+ 1 )* nym), zeros (NT, (He+ 1 )* nŵ)
664+ Ue, Yem, De = repeat (uop, He+ 1 ), repeat (yopm, He+ 1 ), repeat (dop, He+ 1 )
660665 gc = Vector {NT} (undef, nc)
661666 try
662- gc! (gc, X̂, V̂, Ŵ, U, Ym, D, P̄, x̄ , p, 0.0 )
667+ gc! (gc, X̂e, V̂e, Ŵe, Ue, Yem, De, I, x̂op , p, zero (NT) )
663668 catch err
664669 @warn (
665670 """
0 commit comments