@@ -499,20 +499,20 @@ end
499499 init_defaultcon_mpc(
500500 estim::StateEstimator,
501501 Hp, Hc, C,
502- S, E,
502+ P, S, E,
503503 ex̂, fx̂, gx̂, jx̂, kx̂, vx̂, bx̂,
504504 Eŝ, Fŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ,
505505 gc!=nothing, nc=0
506506 ) -> con, S̃, Ẽ, Ẽŝ
507507
508508Init `ControllerConstraint` struct with default parameters based on estimator `estim`.
509509
510- Also return `S̃`, `Ẽ` and `Ẽŝ` matrices for the the augmented decision vector `ΔŨ `.
510+ Also return `P̃`, ` S̃`, `Ẽ` and `Ẽŝ` matrices for the the augmented decision vector `Z̃ `.
511511"""
512512function init_defaultcon_mpc (
513513 estim:: StateEstimator{NT} ,
514514 Hp, Hc, C,
515- S, E,
515+ P, S, E,
516516 ex̂, fx̂, gx̂, jx̂, kx̂, vx̂, bx̂,
517517 Eŝ, Fŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ,
518518 gc!:: GCfunc = nothing , nc = 0
@@ -533,7 +533,7 @@ function init_defaultcon_mpc(
533533 C_umin, C_umax, C_Δumin, C_Δumax, C_ymin, C_ymax =
534534 repeat_constraints (Hp, Hc, c_umin, c_umax, c_Δumin, c_Δumax, c_ymin, c_ymax)
535535 A_Umin, A_Umax, S̃ = relaxU (model, nϵ, C_umin, C_umax, S)
536- A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax = relaxΔU (model, nϵ, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax)
536+ A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax, P̃ = relaxΔU (model, nϵ, C_Δumin, C_Δumax, ΔUmin, ΔUmax, P )
537537 A_Ymin, A_Ymax, Ẽ = relaxŶ (model, nϵ, C_ymin, C_ymax, E)
538538 A_x̂min, A_x̂max, ẽx̂ = relaxterminal (model, nϵ, c_x̂min, c_x̂max, ex̂)
539539 A_ŝ, Ẽŝ = augmentdefect (model, nϵ, Eŝ)
@@ -558,7 +558,7 @@ function init_defaultcon_mpc(
558558 C_ymin , C_ymax , c_x̂min , c_x̂max , i_g,
559559 gc! , nc
560560 )
561- return con, nϵ, S̃, Ẽ, Ẽŝ
561+ return con, nϵ, P̃, S̃, Ẽ, Ẽŝ
562562end
563563
564564" Repeat predictive controller constraints over prediction `Hp` and control `Hc` horizons."
@@ -579,70 +579,76 @@ end
579579
580580Augment manipulated inputs constraints with slack variable ϵ for softening.
581581
582- Denoting the input increments augmented with the slack variable
583- ``\m athbf{ΔŨ } = [\b egin{smallmatrix} \m athbf{ΔU } \\ ϵ \e nd{smallmatrix}]``, it returns the
582+ Denoting the decision variables augmented with the slack variable
583+ ``\m athbf{Z̃ } = [\b egin{smallmatrix} \m athbf{Z } \\ ϵ \e nd{smallmatrix}]``, it returns the
584584augmented conversion matrix ``\m athbf{S̃}``, similar to the one described at
585585[`init_ZtoU`](@ref). It also returns the ``\m athbf{A}`` matrices for the inequality
586586constraints:
587587```math
588588\b egin{bmatrix}
589589 \m athbf{A_{U_{min}}} \\
590590 \m athbf{A_{U_{max}}}
591- \e nd{bmatrix} \m athbf{ΔŨ } ≤
591+ \e nd{bmatrix} \m athbf{Z̃ } ≤
592592\b egin{bmatrix}
593- - \m athbf{U_{min} + T} \m athbf{ u}(k-1) \\
594- + \m athbf{U_{max} - T} \m athbf{ u}(k-1)
593+ - \m athbf{U_{min} + T u}(k-1) \\
594+ + \m athbf{U_{max} - T u}(k-1)
595595\e nd{bmatrix}
596596```
597597in which ``\m athbf{U_{min}}`` and ``\m athbf{U_{max}}`` vectors respectively contains
598598``\m athbf{u_{min}}`` and ``\m athbf{u_{max}}`` repeated ``H_p`` times.
599599"""
600600function relaxU (:: SimModel{NT} , nϵ, C_umin, C_umax, S) where NT<: Real
601- if nϵ == 1 # ΔŨ = [ΔU ; ϵ]
602- # ϵ impacts ΔU → U conversion for constraint calculations:
601+ if nϵ == 1 # Z̃ = [Z ; ϵ]
602+ # ϵ impacts Z → U conversion for constraint calculations:
603603 A_Umin, A_Umax = - [S C_umin], [S - C_umax]
604- # ϵ has no impact on ΔU → U conversion for prediction calculations:
604+ # ϵ has no impact on Z → U conversion for prediction calculations:
605605 S̃ = [S zeros (NT, size (S, 1 ))]
606- else # ΔŨ = ΔU (only hard constraints)
606+ else # Z̃ = Z (only hard constraints)
607607 A_Umin, A_Umax = - S, S
608608 S̃ = S
609609 end
610610 return A_Umin, A_Umax, S̃
611611end
612612
613613@doc raw """
614- relaxΔU(model, nϵ, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax) -> A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax
614+ relaxΔU(
615+ model, nϵ, C_Δumin, C_Δumax, ΔUmin, ΔUmax, P
616+ ) -> A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax, P̃
615617
616618Augment input increments constraints with slack variable ϵ for softening.
617619
618- Denoting the input increments augmented with the slack variable
619- ``\m athbf{ΔŨ} = [\b egin{smallmatrix} \m athbf{ΔU} \\ ϵ \e nd{smallmatrix}]``, it returns the
620- augmented constraints ``\m athbf{ΔŨ_{min}}`` and ``\m athbf{ΔŨ_{max}}`` and the ``\m athbf{A}``
621- matrices for the inequality constraints:
620+ Denoting the decision variables augmented with the slack variable
621+ ``\m athbf{Z̃} = [\b egin{smallmatrix} \m athbf{Z} \\ ϵ \e nd{smallmatrix}]``, it returns the
622+ augmented conversion matrix ``\m athbf{P̃}``, similar to the one described at
623+ [`init_ZtoΔU`](@ref). It also returns the augmented constraints ``\m athbf{ΔŨ_{min}}`` and
624+ ``\m athbf{ΔŨ_{max}}`` and the ``\m athbf{A}`` matrices for the inequality constraints:
622625```math
623626\b egin{bmatrix}
624627 \m athbf{A_{ΔŨ_{min}}} \\
625628 \m athbf{A_{ΔŨ_{max}}}
626- \e nd{bmatrix} \m athbf{ΔŨ } ≤
629+ \e nd{bmatrix} \m athbf{Z̃ } ≤
627630\b egin{bmatrix}
628631 - \m athbf{ΔŨ_{min}} \\
629632 + \m athbf{ΔŨ_{max}}
630633\e nd{bmatrix}
631634```
632635"""
633- function relaxΔU (:: SimModel{NT} , nϵ, C, C_Δumin, C_Δumax, ΔUmin, ΔUmax) where NT<: Real
636+ function relaxΔU (:: SimModel{NT} , nϵ, C_Δumin, C_Δumax, ΔUmin, ΔUmax, P ) where NT<: Real
634637 nΔU = length (ΔUmin)
635- if nϵ == 1 # ΔŨ = [ΔU; ϵ]
636- # 0 ≤ ϵ ≤ ∞
638+ nZ = size (P, 2 )
639+ if nϵ == 1 # Z̃ = [Z; ϵ]
640+ # 0 ≤ ϵ ≤ ∞
637641 ΔŨmin, ΔŨmax = [ΔUmin; NT[0.0 ]], [ΔUmax; NT[Inf ]]
638642 A_ϵ = [zeros (NT, 1 , nΔU) NT[1.0 ]]
639643 A_ΔŨmin, A_ΔŨmax = - [I C_Δumin; A_ϵ], [I - C_Δumax; A_ϵ]
640- else # ΔŨ = ΔU (only hard constraints)
644+ P̃ = [P zeros (NT, size (P, 1 ), 1 )]
645+ else # Z̃ = Z (only hard constraints)
641646 ΔŨmin, ΔŨmax = ΔUmin, ΔUmax
642647 I_Hc = Matrix {NT} (I, nΔU, nΔU)
643648 A_ΔŨmin, A_ΔŨmax = - I_Hc, I_Hc
649+ P̃ = P
644650 end
645- return A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax
651+ return A_ΔŨmin, A_ΔŨmax, ΔŨmin, ΔŨmax, P̃
646652end
647653
648654@doc raw """
0 commit comments