]> Creatis software - CreaPhase.git/blob - octave_packages/control-2.3.52/spamodred.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / control-2.3.52 / spamodred.m
1 ## Copyright (C) 2011   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{Gr}, @var{info}] =} spamodred (@var{G}, @dots{})
20 ## @deftypefnx{Function File} {[@var{Gr}, @var{info}] =} spamodred (@var{G}, @var{nr}, @dots{})
21 ## @deftypefnx{Function File} {[@var{Gr}, @var{info}] =} spamodred (@var{G}, @var{opt}, @dots{})
22 ## @deftypefnx{Function File} {[@var{Gr}, @var{info}] =} spamodred (@var{G}, @var{nr}, @var{opt}, @dots{})
23 ##
24 ## Model order reduction by frequency weighted Singular Perturbation Approximation (SPA).
25 ## The aim of model reduction is to find an LTI system @var{Gr} of order
26 ## @var{nr} (nr < n) such that the input-output behaviour of @var{Gr}
27 ## approximates the one from original system @var{G}.
28 ##
29 ## SPA is an absolute error method which tries to minimize
30 ## @iftex
31 ## @tex
32 ## $$ || G - G_r ||_{\\infty} = min $$
33 ## $$ || V \\ (G - G_r) \\ W ||_{\\infty} = min $$
34 ## @end tex
35 ## @end iftex
36 ## @ifnottex
37 ## @example
38 ## ||G-Gr||    = min
39 ##         inf
40 ##
41 ## ||V (G-Gr) W||    = min
42 ##               inf
43 ## @end example
44 ## @end ifnottex
45 ## where @var{V} and @var{W} denote output and input weightings.
46 ##
47 ##
48 ## @strong{Inputs}
49 ## @table @var
50 ## @item G
51 ## LTI model to be reduced.
52 ## @item nr
53 ## The desired order of the resulting reduced order system @var{Gr}.
54 ## If not specified, @var{nr} is chosen automatically according
55 ## to the description of key @var{'order'}.
56 ## @item @dots{}
57 ## Optional pairs of keys and values.  @code{"key1", value1, "key2", value2}.
58 ## @item opt
59 ## Optional struct with keys as field names.
60 ## Struct @var{opt} can be created directly or
61 ## by command @command{options}.  @code{opt.key1 = value1, opt.key2 = value2}.
62 ## @end table
63 ##
64 ## @strong{Outputs}
65 ## @table @var
66 ## @item Gr
67 ## Reduced order state-space model.
68 ## @item info
69 ## Struct containing additional information.
70 ## @table @var
71 ## @item info.n
72 ## The order of the original system @var{G}.
73 ## @item info.ns
74 ## The order of the @var{alpha}-stable subsystem of the original system @var{G}.
75 ## @item info.hsv
76 ## The Hankel singular values of the @var{alpha}-stable part of
77 ## the original system @var{G}, ordered decreasingly.
78 ## @item info.nu
79 ## The order of the @var{alpha}-unstable subsystem of both the original
80 ## system @var{G} and the reduced-order system @var{Gr}.
81 ## @item info.nr
82 ## The order of the obtained reduced order system @var{Gr}.
83 ## @end table
84 ## @end table
85 ##
86 ##
87 ## @strong{Option Keys and Values}
88 ## @table @var
89 ## @item 'order', 'nr'
90 ## The desired order of the resulting reduced order system @var{Gr}.
91 ## If not specified, @var{nr} is chosen automatically such that states with
92 ## Hankel singular values @var{info.hsv} > @var{tol1} are retained.
93 ##
94 ## @item 'left', 'output'
95 ## LTI model of the left/output frequency weighting @var{V}.
96 ## Default value is an identity matrix.
97 ##
98 ## @item 'right', 'input'
99 ## LTI model of the right/input frequency weighting @var{W}.
100 ## Default value is an identity matrix.
101 ##
102 ## @item 'method'
103 ## Approximation method for the L-infinity norm to be used as follows:
104 ## @table @var
105 ## @item 'sr', 's'
106 ## Use the square-root Singular Perturbation Approximation method.
107 ## @item 'bfsr', 'p'
108 ## Use the balancing-free square-root Singular Perturbation Approximation method.  Default method.
109 ## @end table
110 ##
111 ## @item 'alpha'
112 ## Specifies the ALPHA-stability boundary for the eigenvalues
113 ## of the state dynamics matrix @var{G.A}.  For a continuous-time
114 ## system, ALPHA <= 0 is the boundary value for
115 ## the real parts of eigenvalues, while for a discrete-time
116 ## system, 0 <= ALPHA <= 1 represents the
117 ## boundary value for the moduli of eigenvalues.
118 ## The ALPHA-stability domain does not include the boundary.
119 ## Default value is 0 for continuous-time systems and
120 ## 1 for discrete-time systems.
121 ##
122 ## @item 'tol1'
123 ## If @var{'order'} is not specified, @var{tol1} contains the tolerance for
124 ## determining the order of the reduced model.
125 ## For model reduction, the recommended value of @var{tol1} is
126 ## c*info.hsv(1), where c lies in the interval [0.00001, 0.001].
127 ## Default value is info.ns*eps*info.hsv(1).
128 ## If @var{'order'} is specified, the value of @var{tol1} is ignored.
129 ##
130 ## @item 'tol2'
131 ## The tolerance for determining the order of a minimal
132 ## realization of the ALPHA-stable part of the given
133 ## model.  TOL2 <= TOL1.
134 ## If not specified, ns*eps*info.hsv(1) is chosen.
135 ##
136 ## @item 'gram-ctrb'
137 ## Specifies the choice of frequency-weighted controllability
138 ## Grammian as follows:
139 ## @table @var
140 ## @item 'standard'
141 ## Choice corresponding to a combination method [4]
142 ## of the approaches of Enns [1] and Lin-Chiu [2,3].  Default method.
143 ## @item 'enhanced'
144 ## Choice corresponding to the stability enhanced
145 ## modified combination method of [4].
146 ## @end table
147 ##
148 ## @item 'gram-obsv'
149 ## Specifies the choice of frequency-weighted observability
150 ## Grammian as follows:
151 ## @table @var
152 ## @item 'standard'
153 ## Choice corresponding to a combination method [4]
154 ## of the approaches of Enns [1] and Lin-Chiu [2,3].  Default method.
155 ## @item 'enhanced'
156 ## Choice corresponding to the stability enhanced
157 ## modified combination method of [4].
158 ## @end table
159 ##
160 ## @item 'alpha-ctrb'
161 ## Combination method parameter for defining the
162 ## frequency-weighted controllability Grammian.
163 ## abs(alphac) <= 1.
164 ## If alphac = 0, the choice of
165 ## Grammian corresponds to the method of Enns [1], while if
166 ## alphac = 1, the choice of Grammian corresponds
167 ## to the method of Lin and Chiu [2,3].
168 ## Default value is 0.
169 ##
170 ## @item 'alpha-obsv'
171 ## Combination method parameter for defining the
172 ## frequency-weighted observability Grammian.
173 ## abs(alphao) <= 1.
174 ## If alphao = 0, the choice of
175 ## Grammian corresponds to the method of Enns [1], while if
176 ## alphao = 1, the choice of Grammian corresponds
177 ## to the method of Lin and Chiu [2,3].
178 ## Default value is 0.
179 ##
180 ## @item 'equil', 'scale'
181 ## Boolean indicating whether equilibration (scaling) should be
182 ## performed on system @var{G} prior to order reduction.
183 ## Default value is true if @code{G.scaled == false} and
184 ## false if @code{G.scaled == true}.
185 ## Note that for @acronym{MIMO} models, proper scaling of both inputs and outputs
186 ## is of utmost importance.  The input and output scaling can @strong{not}
187 ## be done by the equilibration option or the @command{prescale} command
188 ## because these functions perform state transformations only.
189 ## Furthermore, signals should not be scaled simply to a certain range.
190 ## For all inputs (or outputs), a certain change should be of the same
191 ## importance for the model.
192 ## @end table
193 ##
194 ##
195 ## @strong{References}@*
196 ## [1] Enns, D.
197 ## Model reduction with balanced realizations: An error bound
198 ## and a frequency weighted generalization.
199 ## Proc. 23-th CDC, Las Vegas, pp. 127-132, 1984.
200 ##
201 ## [2] Lin, C.-A. and Chiu, T.-Y.
202 ## Model reduction via frequency-weighted balanced realization.
203 ## Control Theory and Advanced Technology, vol. 8,
204 ## pp. 341-351, 1992.
205 ##
206 ## [3] Sreeram, V., Anderson, B.D.O and Madievski, A.G.
207 ## New results on frequency weighted balanced reduction
208 ## technique.
209 ## Proc. ACC, Seattle, Washington, pp. 4004-4009, 1995.
210 ##
211 ## [4] Varga, A. and Anderson, B.D.O.
212 ## Square-root balancing-free methods for the frequency-weighted
213 ## balancing related model reduction.
214 ## (report in preparation)
215 ##
216 ##
217 ## @strong{Algorithm}@*
218 ## Uses SLICOT AB09ID by courtesy of
219 ## @uref{http://www.slicot.org, NICONET e.V.}
220 ## @end deftypefn
221
222 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
223 ## Created: November 2011
224 ## Version: 0.1
225
226 function [Gr, info] = spamodred (varargin)
227
228   [Gr, info] = __modred_ab09id__ ("spa", varargin{:});
229
230 endfunction
231
232 ## TODO: add a test