Example #1
0
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')
print('M_S,min = M_T,min = {:.2f}'.format(BoundST(G, p, z)))

# TODO fix BoundST with deadtime
print('\nPeak example for deadtime:')
deadtime = np.matrix([[-1, 0], [-2., -3]])

print('M_T,min = {:.2f}'.format(BoundST(G, p, z, deadtime)))
G21 = (s - 2.5) / (0.1 * s + 1)
G22 = 1

G = mimotf([[G11, G12],
            [G21, G22]])

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

# Stable matrix
G11 = (s + 2.5) / (s + 2)
G12 = -(0.1 * s + 1) / (s + 2)
G21 = (s + 2.5) / (0.1 * s + 1)   
G22 = 1    
Gs = mimotf([[G11, G12],
             [G21, G22]])
    
# Select RHP-pole
p = [2.]
pdir = pole_zero_directions(Gs, p, 'p')
display_export_data(pdir, 'Poles', ['   u','   y','   e '])

# e is 0, thus the calculated vectors are not valid
up = np.matrix([[0.966],
                [-0.258]])
print '||KS|| > {:.3}'.format(BoundKS(Gs, p, up))

from utils import pole_zero_directions, tf, mimotf
from reporting import display_export_data

s = tf([1, 0])

G = 1/(s + 2)*mimotf([[s - 1, 4],
                      [4.5, 2*(s - 1)]])

# Poles and zeros calculated in Example 4.11

zerodata = pole_zero_directions(G, [4.], 'z')
poledata = pole_zero_directions(G, [-2.], 'p')
rowhead = ['   u', '   y', '   e ']

display_export_data(zerodata, 'Zeros', rowhead)
display_export_data(poledata, 'Poles', rowhead)
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')
print('M_S,min = M_T,min = {:.2f}'.format(BoundST(G, p, z)))

# TODO fix BoundST with deadtime
print('\nPeak example for deadtime:')
deadtime = np.matrix([[-1, 0],
                      [-2., -3]])
     
print('M_T,min = {:.2f}'.format(BoundST(G, p, z, deadtime)))
Example #5
0
from utils import pole_zero_directions, BoundKS, tf, mimotf
from reporting import display_export_data

s = tf([1, 0])

G11 = (s + 2.5) / (s - 2)
G12 = -(0.1 * s + 1) / (s - 2)
G21 = (s + 2.5) / (0.1 * s + 1)
G22 = 1
G = mimotf([[G11, G12], [G21, G22]])

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

# stable matrix
G11 = (s + 2.5) / (s + 2)
G12 = -(0.1 * s + 1) / (s + 2)
G21 = (s + 2.5) / (0.1 * s + 1)
G22 = 1
Gs = mimotf([[G11, G12], [G21, G22]])

# select RHP-pole
p = [2.]
pdir = pole_zero_directions(G, p, 'p')
display_export_data(pdir, 'Poles', ['   u', '   y', '   e '])

up = pdir[0][1]
print('||KS||inf >= {:.3}'.format(BoundKS(Gs, p, up)))
from utils import pole_zero_directions, tf, mimotf
from reporting import display_export_data

s = tf([1, 0])

G = 1 / (s + 2) * mimotf([[s - 1, 4], [4.5, 2 * (s - 1)]])

# Poles and zeros calculated in Example 4.11

zerodata = pole_zero_directions(G, [4.], 'z')
poledata = pole_zero_directions(G, [-2.], 'p')
rowhead = ['   u', '   y', '   e ']

display_export_data(zerodata, 'Zeros', rowhead)
display_export_data(poledata, 'Poles', rowhead)
from reporting import display_export_data

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

z = 2.5
p = 2

G = np.matrix([[(s - z)/(s - p), -(0.1*s + 1)/(s - p)],[(s - z)/(0.1*s + 1), 1]])
G = mimotf(G)

p_list = G.poles()
z_list = G.zeros()
print('Poles: {0}'.format(p_list))
print('Zeros: {0}\n'.format(z_list))

zerodata = pole_zero_directions(G, z_list, 'z')
poledata = pole_zero_directions(G, p_list, 'p')
rowhead = ['   u', '   y', '   e ']
display_export_data(zerodata, 'Zeros', rowhead)
display_export_data(poledata, 'Poles', rowhead)
up = poledata[0][1]

# Obtain stable plant
p = -2
Gs = np.matrix([[(s - z)/(s - p), -(0.1*s + 1)/(s - p)],[(s - z)/(0.1*s + 1), 1]])
Gs = mimotf(Gs)

#||KS||inf MSmin, MTmin using Utils functions
print('||KS||inf >= {:.2f}'.format(BoundKS(Gs, p_list, up)))
print('M_S,min = M_T,min = {:.2f}'.format(BoundST(G, p_list, z_list)))
s = tf([1, 0], 1)

z = 2.5
p = 2

G = np.matrix([[(s - z) / (s - p), -(0.1 * s + 1) / (s - p)],
               [(s - z) / (0.1 * s + 1), 1]])
G = mimotf(G)

p_list = G.poles()
z_list = G.zeros()
print('Poles: {0}'.format(p_list))
print('Zeros: {0}\n'.format(z_list))

zerodata = pole_zero_directions(G, z_list, 'z')
poledata = pole_zero_directions(G, p_list, 'p')
rowhead = ['   u', '   y', '   e ']
display_export_data(zerodata, 'Zeros', rowhead)
display_export_data(poledata, 'Poles', rowhead)
up = poledata[0][1]

# Obtain stable plant
p = -2
Gs = np.matrix([[(s - z) / (s - p), -(0.1 * s + 1) / (s - p)],
                [(s - z) / (0.1 * s + 1), 1]])
Gs = mimotf(Gs)

#||KS||inf MSmin, MTmin using Utils functions
print('||KS||inf >= {:.2f}'.format(BoundKS(Gs, p_list, up)))
print('M_S,min = M_T,min = {:.2f}'.format(BoundST(G, p_list, z_list)))