1 ## Copyright (C) 2009, 2010 Lukas F. Reichlin
3 ## This file is part of LTI Syncope.
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
19 ## @deftypefn{Function File} {@var{P} =} augw (@var{G}, @var{W1}, @var{W2}, @var{W3})
20 ## Extend plant for stacked S/KS/T problem. Subsequently, the robust control problem
21 ## can be solved by h2syn or hinfsyn.
26 ## LTI model of plant.
28 ## LTI model of performance weight. Bounds the largest singular values of sensitivity @var{S}.
29 ## Model must be empty @code{[]}, SISO or of appropriate size.
31 ## LTI model to penalize large control inputs. Bounds the largest singular values of @var{KS}.
32 ## Model must be empty @code{[]}, SISO or of appropriate size.
34 ## LTI model of robustness and noise sensitivity weight. Bounds the largest singular values of
35 ## complementary sensitivity @var{T}. Model must be empty @code{[]}, SISO or of appropriate size.
38 ## All inputs must be proper/realizable.
39 ## Scalars, vectors and matrices are possible instead of LTI models.
44 ## State-space model of augmented plant.
47 ## @strong{Block Diagram}
51 ## | W1 | -W1*G | z1 = W1 r - W1 G u
52 ## | 0 | W2 | z2 = W2 u
53 ## P = | 0 | W3*G | z3 = W3 G u
55 ## | I | -G | e = r - G u
61 ## +---------------------------------------->| W1 |----->
64 ## | +---------------------->| W2 |----->
66 ## r + e | +--------+ u | +--------+ y +------+ z3
67 ## ----->(+)---+-->| K(s) |----+-->| G(s) |----+---->| W3 |----->
68 ## ^ - +--------+ +--------+ | +------+
70 ## +----------------------------------------+
76 ## | |-----> z1 (p1x1) z1 = W1 e
77 ## r (px1) ----->| P(s) |-----> z2 (p2x1) z2 = W2 u
78 ## | |-----> z3 (p3x1) z3 = W3 y
79 ## u (mx1) ----->| |-----> e (px1) e = r - y
86 ## r ----->| |-----> z
88 ## u +---->| |-----+ e
92 ## +-----| K(s) |<----+
99 ## Skogestad, S. and Postlethwaite I.
100 ## Multivariable Feedback Control: Analysis and Design
103 ## Chapter 3.8: General Control Problem Formulation
106 ## @seealso{h2syn, hinfsyn, mixsyn}
109 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
110 ## Created: December 2009
113 function P = augw (G, W1 = [], W2 = [], W3 = [])
115 if (nargin == 0 || nargin > 4)
122 [W1, p1, m1] = __adjust_weighting__ (W1, p);
123 [W2, p2, m2] = __adjust_weighting__ (W2, m);
124 [W3, p3, m3] = __adjust_weighting__ (W3, p);
126 ## Pr = [1; 0; 0; 1];
127 ## Pu = [-1; 0; 1; -1]*G + [0; 1; 0; 0];
129 Pr = ss ([eye(m1,p) ;
134 Pu1 = ss ([-eye(m1,p) ;
139 Pu2 = ss ([zeros(m1,m);
146 P = append (W1, W2, W3, eye (p, p)) * [Pr, Pu];
151 function [W, p, m] = __adjust_weighting__ (W, s)
156 if (m == 0 || m == s) # model is empty or has s inputs
158 elseif (m == 1) # model is SISO or SIMO
161 W = append (W, tmp); # stack single-input model s times
163 [p, m] = size (W); # weighting function now of correct size
164 else # model is MIMO or MISO
165 error ("augw: %s must have 1 or %d inputs", inputname (1), s);