@@ -897,7 +897,6 @@ function linconstraint!(
897897 model. nd > 0 && mul! (FX̂, JX̂, D0, 1 , 1 )
898898 # --- update b vector for linear inequality constraints ---
899899 nX̂_He, nŴ_He, nV̂_He = length (X̂0min), length (Ŵmin), length (V̂min)
900- nx̂ = length (estim. con. x̂0min)
901900 n = 0
902901 estim. con. b[(n+ 1 ): (n+ nx̂)] .= @. - estim. con. x̂0min
903902 n += nx̂
@@ -923,14 +922,15 @@ end
923922
924923" Set `b` excluding sensor noise bounds if not a `LinModel` and non-`SingleShooting`."
925924function linconstraint! (
926- estim:: MovingHorizonEstimator , :: SimModel , :: TranscriptionMethod
925+ estim:: MovingHorizonEstimator , model :: SimModel , :: TranscriptionMethod
927926)
928- nx̂, nŵ = estim. nx̂, estim. nx̂
927+ nx̂, nŵ, na = estim. nx̂, estim. nx̂, get_na (model)
929928 # --- truncate vector and matrices if necessary ---
930929 X̂0min, X̂0max = trunc_bounds (estim, estim. con. X̂0min, estim. con. X̂0max, nx̂)
931930 Ŵmin, Ŵmax = trunc_bounds (estim, estim. con. Ŵmin, estim. con. Ŵmax, nŵ)
931+ Âmin, Âmax = trunc_bounds (estim, estim. con. Âmin, estim. con. Âmax, na, estim. Nk[]+ 1 )
932932 # --- update b vector for linear inequality constraints ---
933- nx̂, nŴ_He, nX̂_He = length (estim . con . x̂0min ), length (Ŵmin ), length (X̂0min )
933+ nŴ_He, nX̂_He, nÂe_He = length (Ŵmin ), length (X̂0min ), length (Âmin )
934934 n = 0
935935 estim. con. b[(n+ 1 ): (n+ nx̂)] .= @. - estim. con. x̂0min
936936 n += nx̂
@@ -940,6 +940,10 @@ function linconstraint!(
940940 n += nX̂_He
941941 estim. con. b[(n+ 1 ): (n+ nX̂_He)] .= @. + X̂0max - estim. con. FX̂
942942 n += nX̂_He
943+ estim. con. b[(n+ 1 ): (n+ nÂe_He)] .= @. - Âmin
944+ n += nÂe_He
945+ estim. con. b[(n+ 1 ): (n+ nÂe_He)] .= @. + Âmax
946+ n += nÂe_He
943947 estim. con. b[(n+ 1 ): (n+ nŴ_He)] .= @. - Ŵmin
944948 n += nŴ_He
945949 estim. con. b[(n+ 1 ): (n+ nŴ_He)] .= @. + Ŵmax
0 commit comments