@@ -56,7 +56,7 @@ Construct an internal model estimator based on `model` ([`LinModel`](@ref) or [`
5656unmeasured ``\m athbf{y^u}``. `model` evaluates the deterministic predictions
5757``\m athbf{ŷ_d}``, and `stoch_ym`, the stochastic predictions of the measured outputs
5858``\m athbf{ŷ_s^m}`` (the unmeasured ones being ``\m athbf{ŷ_s^u=0}``). The predicted outputs
59- sum both values : ``\m athbf{ŷ = ŷ_d + ŷ_s}``.
59+ sum both values : ``\m athbf{ŷ = ŷ_d + ŷ_s}``. See the Extended Help for more details.
6060
6161!!! warning
6262 `InternalModel` estimator does not work if `model` is integrating or unstable. The
@@ -81,7 +81,10 @@ InternalModel estimator with a sample time Ts = 0.5 s, LinModel and:
8181 supposes 1 integrator per measured outputs by default, assuming that the current stochastic
8282 estimate ``\m athbf{ŷ_s^m}(k) = \m athbf{y^m}(k) - \m athbf{ŷ_d^m}(k)`` is constant in the
8383 future. This is the dynamic matrix control (DMC) strategy, which is simple but sometimes
84- too aggressive. Additional poles and zeros in `stoch_ym` can mitigate this.
84+ too aggressive. Additional poles and zeros in `stoch_ym` can mitigate this. The following
85+ block diagram summarizes the internal model structure.
86+
87+ 
8588"""
8689function InternalModel (
8790 model:: SM ;
@@ -219,9 +222,9 @@ function setmodel_estimator!(estim::InternalModel, model::LinModel, _ , _ , _)
219222end
220223
221224@doc raw """
222- update_estimate!(estim::InternalModel, u, ym, d =[])
225+ update_estimate!(estim::InternalModel, u0, y0m, d0 =[])
223226
224- Update `estim.x̂0`/`x̂d`/`x̂s` with current inputs `u `, measured outputs `ym ` and dist. `d `.
227+ Update `estim.x̂0`/`x̂d`/`x̂s` with current inputs `u0 `, measured outputs `y0m ` and dist. `d0 `.
225228
226229The [`InternalModel`](@ref) updates the deterministic `x̂d` and stochastic `x̂s` estimates with:
227230```math
@@ -234,19 +237,19 @@ This estimator does not augment the state vector, thus ``\mathbf{x̂ = x̂_d}``.
234237[`init_internalmodel`](@ref) for details.
235238"""
236239function update_estimate! (
237- estim:: InternalModel{NT, SM} , u, ym, d = empty (estim. x̂0)
240+ estim:: InternalModel{NT, SM} , u0, y0m, d0 = empty (estim. x̂0)
238241) where {NT<: Real , SM}
239242 model = estim. model
240243 x̂d, x̂s = estim. x̂d, estim. x̂s
241244 # -------------- deterministic model ---------------------
242- ŷd , x̂dnext = Vector {NT} (undef, model. ny), Vector {NT} (undef, model. nx)
243- h! (ŷd , model, x̂d, d )
244- f! (x̂dnext, model, x̂d, u, d )
245+ ŷ0d , x̂dnext = Vector {NT} (undef, model. ny), Vector {NT} (undef, model. nx)
246+ h! (ŷ0d , model, x̂d, d0 )
247+ f! (x̂dnext, model, x̂d, u0, d0 )
245248 x̂d .= x̂dnext # this also updates estim.x̂0 (they are the same object)
246249 # --------------- stochastic model -----------------------
247250 x̂snext = Vector {NT} (undef, estim. nxs)
248251 ŷs = zeros (NT, model. ny)
249- ŷs[estim. i_ym] = ym - ŷd [estim. i_ym] # ŷs=0 for unmeasured outputs
252+ ŷs[estim. i_ym] = y0m - ŷ0d [estim. i_ym] # ŷs=0 for unmeasured outputs
250253 mul! (x̂snext, estim. Âs, x̂s)
251254 mul! (x̂snext, estim. B̂s, ŷs, 1 , 1 )
252255 x̂s .= x̂snext
0 commit comments