Skip to content

Commit 112d6de

Browse files
committed
more rigorous notation in internal doc of predictive controllers
1 parent 662da96 commit 112d6de

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

src/controller/construct.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,9 @@ The ``\mathbf{F}`` and ``\mathbf{f_x̂}`` vectors are recalculated at each contr
413413
414414
# Extended Help
415415
!!! details "Extended Help"
416-
Using the augmented matrices ``\mathbf{Â, B̂_u, Ĉ, B̂_d, D̂_d}`` in `estim` and the
417-
function ``\mathbf{W}(j) = ∑_{i=0}^j \mathbf{Â}^i``, the prediction matrices are
418-
computed by :
416+
Using the augmented matrices ``\mathbf{Â, B̂_u, Ĉ, B̂_d, D̂_d}`` in `estim` (see
417+
[`augment_model`](@ref)) and the function ``\mathbf{W}(j) = ∑_{i=0}^j \mathbf{Â}^i``,
418+
the prediction matrices are computed by :
419419
```math
420420
\begin{aligned}
421421
\mathbf{E} &= \begin{bmatrix}
@@ -657,10 +657,12 @@ constraints:
657657
\mathbf{A_{U_{max}}}
658658
\end{bmatrix} \mathbf{ΔŨ} ≤
659659
\begin{bmatrix}
660-
- \mathbf{U_{min} + T} \mathbf{u}(k-1) \\
661-
+ \mathbf{U_{max} - T} \mathbf{u}(k-1)
660+
- \mathbf{(U_{min} - U_{op}) + T} \mathbf{u_0}(k-1) \\
661+
+ \mathbf{(U_{max} - U_{op}) - T} \mathbf{u_0}(k-1)
662662
\end{bmatrix}
663663
```
664+
in which ``\mathbf{U_{min}, U_{max}}`` and ``\mathbf{U_{op}}`` vectors respectively contains
665+
``\mathbf{u_{min}, u_{max}}`` and ``\mathbf{u_{op}}`` repeated ``H_p`` times.
664666
"""
665667
function relaxU(::SimModel{NT}, C, C_umin, C_umax, S) where {NT<:Real}
666668
if !isinf(C) # ΔŨ = [ΔU; ϵ]
@@ -723,17 +725,19 @@ Augment linear output prediction constraints with slack variable ϵ for softenin
723725
Denoting the input increments augmented with the slack variable
724726
``\mathbf{ΔŨ} = [\begin{smallmatrix} \mathbf{ΔU} \\ ϵ \end{smallmatrix}]``, it returns the
725727
``\mathbf{Ẽ}`` matrix that appears in the linear model prediction equation
726-
``\mathbf{ = Ẽ ΔŨ + F}``, and the ``\mathbf{A}`` matrices for the inequality constraints:
728+
``\mathbf{Ŷ_0 = Ẽ ΔŨ + F}``, and the ``\mathbf{A}`` matrices for the inequality constraints:
727729
```math
728730
\begin{bmatrix}
729731
\mathbf{A_{Y_{min}}} \\
730732
\mathbf{A_{Y_{max}}}
731733
\end{bmatrix} \mathbf{ΔŨ} ≤
732734
\begin{bmatrix}
733-
- \mathbf{Y_{min} + F} \\
734-
+ \mathbf{Y_{max} - F}
735+
- \mathbf{(Y_{min} - Y_{op}) + F} \\
736+
+ \mathbf{(Y_{max} - Y_{op}) - F}
735737
\end{bmatrix}
736738
```
739+
in which ``\mathbf{Y_{min}, Y_{max}}`` and ``\mathbf{Y_{op}}`` vectors respectively contains
740+
``\mathbf{y_{min}, y_{max}}`` and ``\mathbf{y_{op}}`` repeated ``H_p`` times.
737741
"""
738742
function relaxŶ(::LinModel{NT}, C, C_ymin, C_ymax, E) where {NT<:Real}
739743
if !isinf(C) # ΔŨ = [ΔU; ϵ]
@@ -763,16 +767,16 @@ Augment terminal state constraints with slack variable ϵ for softening.
763767
Denoting the input increments augmented with the slack variable
764768
``\mathbf{ΔŨ} = [\begin{smallmatrix} \mathbf{ΔU} \\ ϵ \end{smallmatrix}]``, it returns the
765769
``\mathbf{ẽ_{x̂}}`` matrix that appears in the terminal state equation
766-
``\mathbf{x̂}_{k-1}(k + H_p) = \mathbf{ẽ_x̂ ΔŨ + f_x̂}``, and the ``\mathbf{A}`` matrices for
770+
``\mathbf{x̂_0}(k + H_p) = \mathbf{ẽ_x̂ ΔŨ + f_x̂}``, and the ``\mathbf{A}`` matrices for
767771
the inequality constraints:
768772
```math
769773
\begin{bmatrix}
770774
\mathbf{A_{x̂_{min}}} \\
771775
\mathbf{A_{x̂_{max}}}
772776
\end{bmatrix} \mathbf{ΔŨ} ≤
773777
\begin{bmatrix}
774-
- \mathbf{x̂_{min} + f_x̂} \\
775-
+ \mathbf{x̂_{max} - f_x̂}
778+
- \mathbf{(x̂_{min} - x̂_{op}) + f_x̂} \\
779+
+ \mathbf{(x̂_{max} - x̂_{op}) - f_x̂}
776780
\end{bmatrix}
777781
```
778782
"""

src/controller/execute.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ See [`init_predmat`](@ref) and [`init_quadprog`](@ref) for the definition of the
153153
They are computed with these equations using in-place operations:
154154
```math
155155
\begin{aligned}
156-
\mathbf{F} &= \mathbf{G d_0}(k) + \mathbf{J D̂_0} + \mathbf{K x̂_0}(k)
157-
+ \mathbf{V u_0}(k-1) + \mathbf{B} + \mathbf{Ŷ_s} \\
158-
\mathbf{C_y} &= \mathbf{F} - \mathbf{R̂_{y_{0}}} \\
159-
\mathbf{C_u} &= \mathbf{T} \mathbf{u}(k-1) - \mathbf{R̂_{u_{0}}} \\
160-
\mathbf{q̃} &= 2[(\mathbf{M}_{H_p} \mathbf{Ẽ})' \mathbf{C_y}
161-
+ (\mathbf{L}_{H_p} \mathbf{S̃})' \mathbf{C_u}] \\
162-
p &= \mathbf{C_y}' \mathbf{M}_{H_p} \mathbf{C_y}
163-
+ \mathbf{C_u}' \mathbf{L}_{H_p} \mathbf{C_u}
156+
\mathbf{F} &= \mathbf{G d_0}(k) + \mathbf{J D̂_0} + \mathbf{K x̂_0}(k)
157+
+ \mathbf{V u_0}(k-1) + \mathbf{B} + \mathbf{Ŷ_s} \\
158+
\mathbf{C_y} &= \mathbf{F} - (\mathbf{R̂_y - Y_{op}}) \\
159+
\mathbf{C_u} &= \mathbf{T} \mathbf{u_0}(k-1) - (\mathbf{R̂_u - U_{op}}) \\
160+
\mathbf{q̃} &= 2[(\mathbf{M}_{H_p} \mathbf{Ẽ})' \mathbf{C_y}
161+
+ (\mathbf{L}_{H_p} \mathbf{S̃})' \mathbf{C_u}] \\
162+
p &= \mathbf{C_y}' \mathbf{M}_{H_p} \mathbf{C_y}
163+
+ \mathbf{C_u}' \mathbf{L}_{H_p} \mathbf{C_u}
164164
\end{aligned}
165165
```
166166
"""

src/estimator/execute.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function returns the next state of the augmented model, defined as:
2929
```
3030
where ``\mathbf{x̂_0}(k+1)`` is stored in `x̂next0` argument. The method mutates `x̂next0` and
3131
`û0` in place, the latter stores the input vector of the augmented model
32-
``\mathbf{u0 + ŷ_{s_u}}``.
32+
``\mathbf{u_0 + ŷ_{s_u}}``.
3333
"""
3434
function f̂!(x̂next0, û0, estim::StateEstimator, model::SimModel, x̂0, u0, d0)
3535
# `@views` macro avoid copies with matrix slice operator e.g. [a:b]
@@ -83,7 +83,7 @@ end
8383
8484
Init `estim.x̂0` states from current inputs `u`, measured outputs `ym` and disturbances `d`.
8585
86-
The method tries to find a good stead-state for the initial estimate ``\mathbf{x̂}(0)``. It
86+
The method tries to find a good steady-state for the initial estimate ``\mathbf{x̂}(0)``. It
8787
removes the operating points with [`remove_op!`](@ref) and call [`init_estimate!`](@ref):
8888
8989
- If `estim.model` is a [`LinModel`](@ref), it finds the steady-state of the augmented model

0 commit comments

Comments
 (0)