@@ -780,9 +780,38 @@ function linconstraint!(
780780 return nothing
781781end
782782
783- " Set `b` excluding state and sensor noise bounds if `model` is not a [`LinModel`](@ref) ."
783+ " Set `b` excluding sensor noise bounds if for `NonLinModel` and non-`SingleShooting` ."
784784function linconstraint! (
785- estim:: MovingHorizonEstimator , :: SimModel , :: TranscriptionMethod
785+ estim:: MovingHorizonEstimator , :: NonLinModel , :: TranscriptionMethod
786+ )
787+ nx̂, nŵ = estim. nx̂, estim. nx̂
788+ # --- truncate vector and matrices if necessary ---
789+ X̂0min, X̂0max = trunc_bounds (estim, estim. con. X̂0min, estim. con. X̂0max, nx̂)
790+ Ŵmin, Ŵmax = trunc_bounds (estim, estim. con. Ŵmin, estim. con. Ŵmax, nŵ)
791+ # --- update b vector for linear inequality constraints ---
792+ nx̂, nŴ_He, nX̂_He = length (estim. con. x̂0min), length (Ŵmin), length (X̂0min)
793+ n = 0
794+ estim. con. b[(n+ 1 ): (n+ nx̂)] .= @. - estim. con. x̂0min
795+ n += nx̂
796+ estim. con. b[(n+ 1 ): (n+ nx̂)] .= @. + estim. con. x̂0max
797+ n += nx̂
798+ estim. con. b[(n+ 1 ): (n+ nX̂_He)] .= @. - X̂0min + estim. con. FX̂
799+ n += nX̂_He
800+ estim. con. b[(n+ 1 ): (n+ nX̂_He)] .= @. + X̂0max - estim. con. FX̂
801+ n += nX̂_He
802+ estim. con. b[(n+ 1 ): (n+ nŴ_He)] .= @. - Ŵmin
803+ n += nŴ_He
804+ estim. con. b[(n+ 1 ): (n+ nŴ_He)] .= @. + Ŵmax
805+ if any (estim. con. i_b)
806+ lincon = estim. optim[:linconstraint ]
807+ JuMP. set_normalized_rhs (lincon, estim. con. b[estim. con. i_b])
808+ end
809+ return nothing
810+ end
811+
812+ " Set `b` excluding state and sensor noise bounds for `NonLinModel` and `SingleShooting`."
813+ function linconstraint! (
814+ estim:: MovingHorizonEstimator , :: NonLinModel , :: SingleShooting
786815)
787816 # --- truncate vector and matrices if necessary ---
788817 Ŵmin, Ŵmax = trunc_bounds (estim, estim. con. Ŵmin, estim. con. Ŵmax, estim. nx̂)
0 commit comments