Ejemplo n.º 1
0
from utils import tf, RHPonly
import numpy as np

s = tf([1, 0], [1])
G = 10 * (s - 2) / (s**2 - 2 * s + 5)

RHPpoles = RHPonly(G.poles())
RHPzeros = RHPonly(G.zeros())

print("The RHP poles of the system are:", RHPpoles)
print("The RHP zeros of the system are:", RHPzeros)

Ms = 1
for p in RHPpoles:
    Ms *= np.abs(RHPzeros + p) / np.abs(RHPzeros - p)

print("The tight lower bound on ||S|| and ||T|| is:", Ms)
Ejemplo n.º 2
0
def Gstable(G, poles):
    Gmul = 1
    for p in poles:
        Gmul *= (s - p) / (s + p)
    Gs = Gmul * G
    num = Gs.numerator.c
    den = Gs.denominator.c
    sym_num = symbolic_poly(num)
    sym_den = symbolic_poly(den)
    fraction = (sym_num / sym_den).simplify()
    numer, denom = fraction.as_numer_denom()
    if numer.find('s'):
        num_coeff = ceoff_symbolic_poly(numer)
    else:
        num_coeff = as_int(numer)
    if denom.find('s'):
        den_coeff = ceoff_symbolic_poly(denom)
    else:
        den_coeff = denom
    return tf(num_coeff, den_coeff)


G_RHPpoles = RHPonly(G.poles())
Gs = Gstable(G, G_RHPpoles)
Gd_RHPpoles = RHPonly(Gd.poles())
Gds = Gstable(Gd_noDT, Gd_RHPpoles)

KSGd_bound = np.abs((Gs(G_RHPpoles[0]))**(-1) * Gds(G_RHPpoles[0]))
print('The lower bound on the peak of ||KSGd|| is: ', KSGd_bound)
Ejemplo n.º 3
0
s = tf([1, 0])

p = 3
z = 2
d = 30. / 180. * np.pi
g1 = mimotf([[1 / (s - p), 0], [0, 1 / (s + 3)]])
g2 = mimotf([[np.cos(d), -np.sin(d)], [np.sin(d), np.cos(d)]])
g3 = mimotf([[(s - z) / (0.1 * s + 1), 0], [0, (s + 2) / (0.1 * s + 1)]])
G = g1 * g2 * g3

p = G.poles()
z = G.zeros()
print('All Poles: {0}'.format(p))
print('All Zeros: {0}\n'.format(z))

RHPzeros = RHPonly(z)
RHPpoles = RHPonly(p)
print("RHP poles only: ", RHPpoles)
print("RHP zeros only: ", RHPzeros)

# selected p & z
p = [3.]
z = [2.]

pdata = pole_zero_directions(G, p, 'p')
zdata = pole_zero_directions(G, z, 'z')
rowhead = ['u', 'y', 'e ']
display_export_data(pdata, 'Poles', rowhead)
display_export_data(zdata, 'Zeros', rowhead)

zdata, _ = pole_zero_directions(G, z, 'z', 'y')
Ejemplo n.º 4
0
from __future__ import print_function
import numpy as np
import numpy.linalg as nplinalg
from utils import tf, BoundST, RHPonly
from scipy.linalg import sqrtm
from numpy import sqrt

s = tf([1, 0], [1])

G = ((s - 1) * (s - 3)) / ((s - 2) * (s + 1)**2)

poles = G.poles()
zeros = G.zeros()

RHPzeros = RHPonly(zeros)
RHPpoles = RHPonly(poles)

# Directions = one because SISO system
pole_dir = np.ones(len(RHPpoles))
zero_dir = np.ones(len(RHPzeros))


def Q(x, x_dir, y=0, y_dir=0):
    if y == 0 and y_dir == 0:
        row = np.shape(x)[0]
        col = row
        Q_return = np.zeros((row, col))
        for i in range(row):
            for j in range(col):
                Q_return[i, j] = (x_dir[i] * x_dir[j]) / (x[i] + x[j])
    else: