Hinf synthesis, based on Scherer et al. 1997 example 7
Code
1"""Hinf design using hinfsyn.
2
3Demonstrate Hinf design for a SISO plant using hinfsyn. Based on [1], Ex. 7.
4
5[1] Scherer, Gahinet, & Chilali, "Multiobjective Output-Feedback Control via
6LMI Optimization", IEEE Trans. Automatic Control, Vol. 42, No. 7, July 1997.
7"""
8# %%
9# Packages
10import numpy as np
11import control
12
13# %%
14# State-space system.
15
16# Process model.
17A = np.array([[0, 10, 2],
18 [-1, 1, 0],
19 [0, 2, -5]])
20B1 = np.array([[1],
21 [0],
22 [1]])
23B2 = np.array([[0],
24 [1],
25 [0]])
26
27# Plant output.
28C2 = np.array([[0, 1, 0]])
29D21 = np.array([[2]])
30D22 = np.array([[0]])
31
32# Hinf performance.
33C1 = np.array([[1, 0, 0],
34 [0, 0, 0]])
35D11 = np.array([[0],
36 [0]])
37D12 = np.array([[0],
38 [1]])
39
40# Dimensions.
41n_x, n_u, n_y = 3, 1, 1
42
43# %%
44# Hinf design using hinfsyn.
45
46# Create augmented plant.
47Baug = np.block([B1, B2])
48Caug = np.block([[C1], [C2]])
49Daug = np.block([[D11, D12], [D21, D22]])
50Paug = control.ss(A, Baug, Caug, Daug)
51
52# Input to hinfsyn is Paug, number of inputs to controller,
53# and number of outputs from the controller.
54K, Tzw, gamma, rcond = control.hinfsyn(Paug, n_y, n_u)
55print(f'The closed-loop H_inf norm of Tzw(s) is {gamma}.')
56
57# %%
Notes
1. The environment variable PYCONTROL_TEST_EXAMPLES is used for testing to turn off plotting of the outputs.