@@ -173,10 +173,32 @@ def hinfsyn(P,nmeas,ncon):
173
173
return K , CL , gam , rcond
174
174
175
175
176
- def _size_as_needed (w ,wname ,n ):
177
- """_size_as_needed(w,wname,n) -> w2
178
- If w is scalar, reshape to nxn; otherwise check size is OK. Return w as StateSpace object.
179
- If w is None, return empty StateSpace object.
176
+ def _size_as_needed (w , wname , n ):
177
+ """Convert LTI object to appropriately sized StateSpace object.
178
+
179
+ Intended for use in .robust only
180
+
181
+ Parameters
182
+ ----------
183
+ w: None, 1x1 LTI object, or mxn LTI object
184
+ wname: name of w, for error message
185
+ n: number of inputs to w
186
+
187
+ Returns
188
+ -------
189
+ w_: processed weighting function, a StateSpace object:
190
+ - if w is None, empty StateSpace object
191
+ - if w is scalar, w_ will be w * eye(n)
192
+ - otherwise, w as StateSpace object
193
+
194
+ Raises
195
+ ------
196
+ ValueError
197
+ - if w is not None or scalar, and doesn't have n inputs
198
+
199
+ See Also
200
+ --------
201
+ augw
180
202
"""
181
203
from . import append , ss
182
204
if w is not None :
@@ -195,20 +217,36 @@ def _size_as_needed(w,wname,n):
195
217
196
218
197
219
def augw (g ,w1 = None ,w2 = None ,w3 = None ):
198
- """augw(g,w1=None,w2=None,w3=None) -> p
199
- Augment plant for mixed sensitivity problem
200
- g - LTI object, ny-by-nu
201
- w1 - weighting on S; None, scalar, or k1-by-ny LTI object
202
- w2 - weighting on KS; None, scalar, or k2-by-nu LTI object
203
- w3 - weighting on T; None, scalar, or k3-by-ny LTI object
204
- p - augmented plant; StateSpace object
220
+ """Augment plant for mixed sensitivity problem.
221
+
222
+ Parameters
223
+ ----------
224
+ g: LTI object, ny-by-nu
225
+ w1: weighting on S; None, scalar, or k1-by-ny LTI object
226
+ w2: weighting on KS; None, scalar, or k2-by-nu LTI object
227
+ w3: weighting on T; None, scalar, or k3-by-ny LTI object
228
+ p: augmented plant; StateSpace object
229
+
205
230
If a weighting is None, no augmentation is done for it. At least
206
231
one weighting must not be None.
232
+
207
233
If a weighting w is scalar, it will be replaced by I*w, where I is
208
234
ny-by-ny for w1 and w3, and nu-by-nu for w2.
209
235
210
- See also hinfsyn, mixsyn
236
+ Returns
237
+ -------
238
+ p: plant augmented with weightings, suitable for submission to hinfsyn or h2syn.
239
+
240
+ Raises
241
+ ------
242
+ ValueError
243
+ - if all weightings are None
244
+
245
+ See Also
246
+ --------
247
+ h2syn, hinfsyn, mixsyn
211
248
"""
249
+
212
250
from . import append , ss , connect
213
251
214
252
if w1 is None and w2 is None and w3 is None :
@@ -282,22 +320,27 @@ def augw(g,w1=None,w2=None,w3=None):
282
320
283
321
return p
284
322
285
- from collections import namedtuple as _namedtuple
286
- _mixsyn_info = _namedtuple ('mixsyn_info' ,('gamma' ,'rcond' ))
287
-
288
323
def mixsyn (g ,w1 = None ,w2 = None ,w3 = None ):
289
- """mixsyn(g,w1,w2,w3) -> k,cl,info
290
- Mixed-sensitivity H-infinity synthesis
324
+ """Mixed-sensitivity H-infinity synthesis.
325
+
326
+ mixsyn(g,w1,w2,w3) -> k,cl,info
327
+
328
+ Parameters
329
+ ----------
291
330
g: LTI; the plant for which controller must be synthesized
292
331
w1: weighting on s = (1+g*k)**-1; None, or scalar or k1-by-ny LTI
293
332
w2: weighting on k*s; None, or scalar or k2-by-nu LTI
294
333
w3: weighting on t = g*k*(1+g*k)**-1; None, or scalar or k3-by-ny LTI
295
334
At least one of w1, w2, and w3 must not be None.
335
+
336
+ Returns
337
+ -------
296
338
k: synthesized controller; StateSpace object
297
339
cl: closed system mapping evaluation inputs to evaluation outputs; if p is the augmented plant, with
298
340
[z] = [p11 p12] [w], then cl is the system from w->z with u=-k*y. StateSpace object.
299
341
[y] [p21 g] [u]
300
- info: namedtuple with fields, in order,
342
+
343
+ info: tuple with entries, in order,
301
344
gamma: scalar; H-infinity norm of cl
302
345
rcond: array; estimates of reciprocal condition numbers
303
346
computed during synthesis. See hinfsyn for details
@@ -312,5 +355,5 @@ def mixsyn(g,w1=None,w2=None,w3=None):
312
355
p = augw (g ,w1 ,w2 ,w3 )
313
356
314
357
k ,cl ,gamma ,rcond = hinfsyn (p ,nmeas ,ncon )
315
- info = _mixsyn_info ( gamma = gamma ,rcond = rcond )
358
+ info = gamma ,rcond
316
359
return k ,cl ,info
0 commit comments