]> Creatis software - CreaPhase.git/blob - octave_packages/control-2.3.52/mixsyn.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / control-2.3.52 / mixsyn.m
1 ## Copyright (C) 2009   Lukas F. Reichlin
2 ##
3 ## This file is part of LTI Syncope.
4 ##
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.
9 ##
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.
14 ##
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/>.
17
18 ## -*- texinfo -*-
19 ## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}, @var{rcond}] =} mixsyn (@var{G}, @var{W1}, @var{W2}, @var{W3}, @dots{})
20 ## Solve stacked S/KS/T H-infinity problem.  Bound the largest singular values
21 ## of @var{S} (for performance), @var{K S} (to penalize large inputs) and
22 ## @var{T} (for robustness and to avoid sensitivity to noise).
23 ## In other words, the inputs r are excited by a harmonic test signal.
24 ## Then the algorithm tries to find a controller @var{K} which minimizes
25 ## the H-infinity norm calculated from the outputs z.
26 ##
27 ## @strong{Inputs}
28 ## @table @var
29 ## @item G
30 ## LTI model of plant.
31 ## @item W1
32 ## LTI model of performance weight.  Bounds the largest singular values of sensitivity @var{S}.
33 ## Model must be empty @code{[]}, SISO or of appropriate size.
34 ## @item W2
35 ## LTI model to penalize large control inputs.  Bounds the largest singular values of @var{KS}.
36 ## Model must be empty @code{[]}, SISO or of appropriate size.
37 ## @item W3
38 ## LTI model of robustness and noise sensitivity weight.  Bounds the largest singular values of 
39 ## complementary sensitivity @var{T}.  Model must be empty @code{[]}, SISO or of appropriate size.
40 ## @item @dots{}
41 ## Optional arguments of @command{hinfsyn}.  Type @command{help hinfsyn} for more information.
42 ## @end table
43 ##
44 ## All inputs must be proper/realizable.
45 ## Scalars, vectors and matrices are possible instead of LTI models.
46 ##
47 ## @strong{Outputs}
48 ## @table @var
49 ## @item K
50 ## State-space model of the H-infinity (sub-)optimal controller.
51 ## @item N
52 ## State-space model of the lower LFT of @var{P} and @var{K}.
53 ## @item gamma
54 ## L-infinity norm of @var{N}.
55 ## @item rcond
56 ## Vector @var{rcond} contains estimates of the reciprocal condition
57 ## numbers of the matrices which are to be inverted and
58 ## estimates of the reciprocal condition numbers of the
59 ## Riccati equations which have to be solved during the
60 ## computation of the controller @var{K}.  For details,
61 ## see the description of the corresponding SLICOT algorithm.
62 ## @end table
63 ##
64 ## @strong{Block Diagram}
65 ## @example
66 ## @group
67 ##
68 ##                                     | W1 S   |
69 ## gamma = min||N(K)||             N = | W2 K S | = lft (P, K)
70 ##          K         inf              | W3 T   |
71 ## @end group
72 ## @end example
73 ## @example
74 ## @group
75 ##                                                       +------+  z1
76 ##             +---------------------------------------->|  W1  |----->
77 ##             |                                         +------+
78 ##             |                                         +------+  z2
79 ##             |                 +---------------------->|  W2  |----->
80 ##             |                 |                       +------+
81 ##  r   +    e |   +--------+  u |   +--------+  y       +------+  z3
82 ## ----->(+)---+-->|  K(s)  |----+-->|  G(s)  |----+---->|  W3  |----->
83 ##        ^ -      +--------+        +--------+    |     +------+
84 ##        |                                        |
85 ##        +----------------------------------------+
86 ## @end group
87 ## @end example
88 ## @example
89 ## @group
90 ##                +--------+
91 ##                |        |-----> z1 (p1x1)          z1 = W1 e
92 ##  r (px1) ----->|  P(s)  |-----> z2 (p2x1)          z2 = W2 u
93 ##                |        |-----> z3 (p3x1)          z3 = W3 y
94 ##  u (mx1) ----->|        |-----> e (px1)            e = r - y
95 ##                +--------+
96 ## @end group
97 ## @end example
98 ## @example
99 ## @group
100 ##                +--------+  
101 ##        r ----->|        |-----> z
102 ##                |  P(s)  |
103 ##        u +---->|        |-----+ e
104 ##          |     +--------+     |
105 ##          |                    |
106 ##          |     +--------+     |
107 ##          +-----|  K(s)  |<----+
108 ##                +--------+
109 ## @end group
110 ## @end example
111 ## @example
112 ## @group
113 ##                +--------+      
114 ##        r ----->|  N(s)  |-----> z
115 ##                +--------+
116 ## @end group
117 ## @end example
118 ## @example
119 ## @group
120 ## Extended Plant:  P = augw (G, W1, W2, W3)
121 ## Controller:      K = mixsyn (G, W1, W2, W3)
122 ## Entire System:   N = lft (P, K)
123 ## Open Loop:       L = G * K
124 ## Closed Loop:     T = feedback (L)
125 ## @end group
126 ## @end example
127 ## @example
128 ## @group
129 ## Reference:
130 ## Skogestad, S. and Postlethwaite I.
131 ## Multivariable Feedback Control: Analysis and Design
132 ## Second Edition
133 ## Wiley 2005
134 ## Chapter 3.8: General Control Problem Formulation
135 ## @end group
136 ## @end example
137 ##
138 ## @strong{Algorithm}@*
139 ## Relies on commands @command{augw} and @command{hinfsyn},
140 ## which use SLICOT SB10FD and SB10DD by courtesy of
141 ## @uref{http://www.slicot.org, NICONET e.V.}
142 ##
143 ## @seealso{hinfsyn, augw}
144 ## @end deftypefn
145
146 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
147 ## Created: December 2009
148 ## Version: 0.1
149
150 function [K, N, gamma, rcond] = mixsyn (G, W1 = [], W2 = [], W3 = [], varargin)
151
152   if (nargin == 0)
153     print_usage ();
154   endif
155
156   [p, m] = size (G);
157
158   P = augw (G, W1, W2, W3);
159   
160   [K, N, gamma, rcond] = hinfsyn (P, p, m, varargin{:});
161
162 endfunction