Observer and feedback controller design for rear wheel speed control.
Design notes:
In [13]:
from sympy import symbols, Poly
import numpy as np
c, J, kT, T, s, w, x, z, I = symbols('c J kT T s w x z I')
#bilinear_transform = {s : 2/T*(z-1)/(z+1)}
forward_difference_transform = {s : (z-1)/T}
# Continuous time transfer function from I(s) to w(s) of the following plant
# model:
# dw/dt = -c/J*w + kT/J*I
G_s = kT/J/(s + c/J)
G_z_num, G_z_den = G_s.subs(forward_difference_transform).as_numer_denom()
G_z_den = Poly(G_z_den, z)
G_z_num = Poly(G_z_num / G_z_den.LC(), z) # divide by leading coefficient of den
G_z_den = G_z_den.monic() # make denominator monic
assert(G_z_den.coeffs()[0] == 1)
print(G_z_num)
print(G_z_den)
print(G_z_num / G_z_den)
A = - G_z_den.coeffs()[1]
B = G_z_num.coeffs()[0]
C = 1
In [14]:
for n, m in [('A', A), ('B', B), ('C', C)]: print(n + " = " + str(m))
In [2]: