ME 405
system_ctrl_design.py File Reference

This file outlines the controller design process for my balancing platform system. More...

Namespaces

 system_ctrl_design
 

Functions

def system_ctrl_design.plot_sim (sim, title='', xlabel='', ylabel1='', ylabel2='', fig_size=(4, 5))
 This function creates an appropriately formatted system test plot. More...
 
def system_ctrl_design.comp_plot_sim (sim1, sim2, ylim1='auto', ylim2='auto', title='', subtitle1='', subtitle2='', xlabel='', ylabel1='', ylabel2='', fig_size=(13, 6))
 This function creates an appropriately formatted system test plot. More...
 
def system_ctrl_design.plot_pole (p, title, fig_size)
 This function creates an appropriately formatted system test plot. More...
 

Variables

 system_ctrl_design.A = np.asmatrix(np.loadtxt('A.txt',delimiter=','))
 
 system_ctrl_design.B = np.asmatrix(np.loadtxt('B.txt',delimiter=',')).transpose()
 
 system_ctrl_design.C = np.matrix()
 
int system_ctrl_design.D = 0
 
 system_ctrl_design.sys_full_OL = control.StateSpace(A,B,C,D)
 
 system_ctrl_design.A_p = np.matrix([[A[1,1], A[1,3]], [A[3,1], A[3,3]]])
 
 system_ctrl_design.B_p = np.matrix([[B[1,0]], [B[3,0]]])
 
 system_ctrl_design.C_p = np.matrix()
 
int system_ctrl_design.D_p = 0
 
 system_ctrl_design.sys_plat_OL = control.StateSpace(A_p,B_p,C_p,D_p)
 
 system_ctrl_design.plat_OL_pole = control.pole(sys_plat_OL)
 
 system_ctrl_design.Q_plat = np.diag([1,1])
 
 system_ctrl_design.R_plat = np.diag([1])
 
 system_ctrl_design.K
 
 system_ctrl_design.S
 
 system_ctrl_design.E
 
 system_ctrl_design.K_plat_0 = np.matrix(K)
 
 system_ctrl_design.A_p_CL0 = A_p - (B_p*K_plat_0)
 
 system_ctrl_design.sys_plat_CL0 = control.StateSpace(A_p_CL0,0*B_p,C_p,D_p)
 
 system_ctrl_design.plat_CL0_pole = control.pole(sys_plat_CL0)
 
 system_ctrl_design.T = np.arange(0,3,.001)
 
list system_ctrl_design.X0 = [5*3.14159/180, 0]
 
 system_ctrl_design.R_plat_CL0 = control.initial_response(sys_plat_CL0,T,X0)
 
 system_ctrl_design.fig = plt.figure()
 
 system_ctrl_design.title
 
 system_ctrl_design.xlabel
 
 system_ctrl_design.ylabel1
 
 system_ctrl_design.ylabel2
 
 system_ctrl_design.K_plat_1 = np.matrix(K)
 
 system_ctrl_design.A_p_CL1 = A_p - (B_p*K_plat_1)
 
 system_ctrl_design.sys_plat_CL1 = control.StateSpace(A_p_CL1,0*B_p,C_p,D_p)
 
 system_ctrl_design.plat_CL1_pole = control.pole(sys_plat_CL1)
 
 system_ctrl_design.R_plat_CL1 = control.initial_response(sys_plat_CL1,T,X0)
 
 system_ctrl_design.subtitle1
 
 system_ctrl_design.subtitle2
 
 system_ctrl_design.sys_OL_pole = control.pole(sys_full_OL)
 
 system_ctrl_design.Q_sys = np.diag([1,1,1,1])
 
 system_ctrl_design.R_sys = np.diag([1])
 
 system_ctrl_design.K_sys_0 = np.matrix(K)
 
 system_ctrl_design.A_CL0 = A - (B*K_sys_0)
 
 system_ctrl_design.sys_CL0 = control.StateSpace(A_CL0,0*B,C,D)
 
 system_ctrl_design.sys_CL0_pole = control.pole(sys_CL0)
 
 system_ctrl_design.R_sys_CL0 = control.initial_response(sys_CL0,T,X0)
 
 system_ctrl_design.K_sys_1 = np.matrix(K)
 
 system_ctrl_design.A_CL1 = A - (B*K_sys_1)
 
 system_ctrl_design.sys_CL1 = control.StateSpace(A_CL1,0*B,C,D)
 
 system_ctrl_design.sys_CL1_pole = control.pole(sys_CL1)
 
 system_ctrl_design.R_sys_CL1 = control.initial_response(sys_CL1,T,X0)
 

Detailed Description

This file outlines the controller design process for my balancing platform system.

Author
E. Nicholson
Date
March 10, 2021

I completed a symbolic kinematic and kinetic analysis of the system on paper to define my equations of motion. I then used MATLAB as a symbolic algebra tool to simplfy / linearize my system and place it in state space form. This script pulls the most recent matrix output from my MATLAB script and uses it to design two full state feedback controllers. One controller is used to balance the platform by itself. The other is used to balance the platform and ball together.

The source code for this file can be found here:

LINK