def G(s): G = 0.01**(-5*s)/((s + 1.72e-4)*(4.32*s + 1))*np.matrix([[-34.54*(s + 0.0572), 1.913], [-30.22*s, -9.188*(s + 6.95e-4)]]) return G I1 = np.asmatrix(np.identity(2)) I2 = np.matrix([[0, 1], [1, 0]]) plt.figure('Figure 3.8') plt.subplot(1, 2, 1) plt.title('(a) Magnitude of RGA elements') rga_plot(G, -5, 1, [None, None, 0, 1], plot_type='all') plt.text(3e-4, 0.8, '|$\lambda$$_1$$_2$| = |$\lambda$$_2$$_1$|', fontsize=15) plt.text(3e-4, 0.2, '|$\lambda$$_1$$_1$| = |$\lambda$$_2$$_2$|', fontsize=15) plt.subplot(1, 2, 2) plt.title('(b) RGA numbers') rga_nm_plot(G, [I1, I2], ['Diagonal pairing','Off-diagonal pairing'], -5, 1, plot_type='all') plt.show() # The section below demonstrates more utilsplot functions plt.figure('RGA per element') rga_plot(G, -5, 1, plot_type='elements') plt.figure('RGA per output') rga_plot(G, -5, 1, plot_type='outputs') plt.figure('RGA per input') rga_plot(G, -5, 1, plot_type='inputs') plt.show()
# a) Controllability analysis G_poles = G.poles() G_rhp_poles = utils.RHPonly(G_poles) # G has stable poles, -10 with multiplicity of 2 and -1 G_zeros = G.zeros() G_rhp_zeros = utils.RHPonly(G_zeros) # G has a LHP zero @ -10 and a RHP zero @ 0.1 # Zero at 0.1 limits bandwidth to wB* < 0.05 pairing1 = np.asmatrix(np.eye(2)) pairing2 = np.asmatrix(pairing1[[1, 0]]) utilsplot.rga_nm_plot(G, pairing_list=[pairing1, pairing2], pairing_names=['Diagonal pairing', 'Off diagonal pairing'], w_start=-3, w_end=3, points=1000, plot_type='all') # RGA Number of Off-diagonal pairing exhibits the lowest RGA Number for w < wB* # b) Disturbance rejection and input saturation w = np.logspace(-3, 3, 1000) dim = G(0).shape[0] Sv_G = np.zeros((len(w), dim)) Sv_G_min = np.zeros((len(w), 1)) Sv_G_max = np.zeros((len(w), 1)) wB_index = 0 for i in range(len(w)): _, Sv_G[i, :], _ = np.linalg.svd(G(1j*w[i])) Sv_G_min[i] = np.min(Sv_G[i, :])
G_poles = G.poles() G_rhp_poles = utils.RHPonly(G_poles) # G has stable poles, -10 with multiplicity of 2 and -1 G_zeros = G.zeros() G_rhp_zeros = utils.RHPonly(G_zeros) # G has a LHP zero @ -10 and a RHP zero @ 0.1 # Zero at 0.1 limits bandwidth to wB* < 0.05 pairing1 = np.asmatrix(np.eye(2)) pairing2 = np.asmatrix(pairing1[[1, 0]]) utilsplot.rga_nm_plot( G, pairing_list=[pairing1, pairing2], pairing_names=['Diagonal pairing', 'Off diagonal pairing'], w_start=-3, w_end=3, points=1000, plot_type='all') # RGA Number of Off-diagonal pairing exhibits the lowest RGA Number for w < wB* # b) Disturbance rejection and input saturation w = np.logspace(-3, 3, 1000) dim = G(0).shape[0] Sv_G = np.zeros((len(w), dim)) Sv_G_min = np.zeros((len(w), 1)) Sv_G_max = np.zeros((len(w), 1)) wB_index = 0 for i in range(len(w)):
G_poles = G.poles() G_rhp_poles = G_poles[np.real(G_poles) >= 0] # G has stable poles, -10 with multiplicity of 2 and -1 G_zeros = G.zeros() G_rhp_zeros = G_zeros[np.real(G_zeros) >= 0] # G has a LHP zero @ -10 and a RHP zero @ 0.1 # Zero at 0.1 limits bandwidth to wB* < 0.05 pairing1 = np.asmatrix(np.eye(2)) pairing2 = np.asmatrix(pairing1[[1, 0]]) utilsplot.rga_nm_plot( G, pairing_list=[pairing1, pairing2], pairing_names=["Diagonal pairing", "Off diagonal pairing"], w_start=-3, w_end=3, points=1000, plot_type="all", ) # RGA Number of Off-diagonal pairing exhibits the lowest RGA Number for w < wB* # b) Disturbance rejection and input saturation w = np.logspace(-3, 3, 1000) dim = G(0).shape[0] Sv_G = np.zeros((len(w), dim)) Sv_G_min = np.zeros((len(w), 1)) Sv_G_max = np.zeros((len(w), 1)) wB_index = 0