ME 405
system_ctrl_design Namespace Reference

Functions

def plot_sim (sim, title='', xlabel='', ylabel1='', ylabel2='', fig_size=(4, 5))
 This function creates an appropriately formatted system test plot. More...
 
def 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 plot_pole (p, title, fig_size)
 This function creates an appropriately formatted system test plot. More...
 

Variables

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

Function Documentation

◆ comp_plot_sim()

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.

This function plots the time response of a given parameter and its derrivative. The parameter sim shold be a nx3 array type object of the following format [time,x,x_dot]

Parameters
sim1A matrix with the first system simulation output.
sim2A matrix with the second system simulation output.
ylim1Tuple describing the ylimits for the first comparison
ylim2Tuple describing the ylimits for the second comparison
titleA str describing the whole figure.
subtitle1A str describing the first simulation
subtitle2A str describing the second simulation
xlabelA str describing the x axes
ylabel1A str describing the y axis of the first comparison
ylabel2A str describing the y axis of the second comparison
fig_sizeA tuple giving the width and height of the figure.

◆ plot_pole()

def system_ctrl_design.plot_pole (   p,
  title,
  fig_size 
)

This function creates an appropriately formatted system test plot.

Parameters
pA vector containing the system poles for plotting.
sim_resultsa matrix with the system simulation output.
titleA str describing the plot.
fig_sizeA tuple giving the width and height of the figure.

◆ plot_sim()

def system_ctrl_design.plot_sim (   sim,
  title = '',
  xlabel = '',
  ylabel1 = '',
  ylabel2 = '',
  fig_size = (4,5) 
)

This function creates an appropriately formatted system test plot.

This function plots the time response of a given parameter and its derrivative. The parameter sim shold be a nx3 array type object of the following format [time,x,x_dot]

Parameters
sim_resultsa matrix with the system simulation output.
titleA str describing the whole figure.
xlabelA str describing the x axis
ylabel1A str describing the y axis of the first plot
ylabel2A str describing the y axis of the second plot
fig_sizeA tuple giving the width and height of the figure.

Variable Documentation

◆ A

system_ctrl_design.A = np.asmatrix(np.loadtxt('A.txt',delimiter=','))

◆ A_CL0

system_ctrl_design.A_CL0 = A - (B*K_sys_0)

◆ A_CL1

system_ctrl_design.A_CL1 = A - (B*K_sys_1)

◆ A_p

system_ctrl_design.A_p = np.matrix([[A[1,1], A[1,3]], [A[3,1], A[3,3]]])

◆ A_p_CL0

system_ctrl_design.A_p_CL0 = A_p - (B_p*K_plat_0)

◆ A_p_CL1

system_ctrl_design.A_p_CL1 = A_p - (B_p*K_plat_1)

◆ B

system_ctrl_design.B = np.asmatrix(np.loadtxt('B.txt',delimiter=',')).transpose()

◆ B_p

system_ctrl_design.B_p = np.matrix([[B[1,0]], [B[3,0]]])

◆ C

system_ctrl_design.C = np.matrix()

◆ C_p

system_ctrl_design.C_p = np.matrix()

◆ D

int system_ctrl_design.D = 0

◆ D_p

int system_ctrl_design.D_p = 0

◆ E

system_ctrl_design.E

◆ fig

system_ctrl_design.fig = plt.figure()

◆ K

system_ctrl_design.K

◆ K_plat_0

system_ctrl_design.K_plat_0 = np.matrix(K)

◆ K_plat_1

system_ctrl_design.K_plat_1 = np.matrix(K)

◆ K_sys_0

system_ctrl_design.K_sys_0 = np.matrix(K)

◆ K_sys_1

system_ctrl_design.K_sys_1 = np.matrix(K)

◆ plat_CL0_pole

system_ctrl_design.plat_CL0_pole = control.pole(sys_plat_CL0)

◆ plat_CL1_pole

system_ctrl_design.plat_CL1_pole = control.pole(sys_plat_CL1)

◆ plat_OL_pole

system_ctrl_design.plat_OL_pole = control.pole(sys_plat_OL)

◆ Q_plat

system_ctrl_design.Q_plat = np.diag([1,1])

◆ Q_sys

system_ctrl_design.Q_sys = np.diag([1,1,1,1])

◆ R_plat

system_ctrl_design.R_plat = np.diag([1])

◆ R_plat_CL0

system_ctrl_design.R_plat_CL0 = control.initial_response(sys_plat_CL0,T,X0)

◆ R_plat_CL1

system_ctrl_design.R_plat_CL1 = control.initial_response(sys_plat_CL1,T,X0)

◆ R_sys

system_ctrl_design.R_sys = np.diag([1])

◆ R_sys_CL0

system_ctrl_design.R_sys_CL0 = control.initial_response(sys_CL0,T,X0)

◆ R_sys_CL1

system_ctrl_design.R_sys_CL1 = control.initial_response(sys_CL1,T,X0)

◆ S

system_ctrl_design.S

◆ subtitle1

system_ctrl_design.subtitle1

◆ subtitle2

system_ctrl_design.subtitle2

◆ sys_CL0

system_ctrl_design.sys_CL0 = control.StateSpace(A_CL0,0*B,C,D)

◆ sys_CL0_pole

system_ctrl_design.sys_CL0_pole = control.pole(sys_CL0)

◆ sys_CL1

system_ctrl_design.sys_CL1 = control.StateSpace(A_CL1,0*B,C,D)

◆ sys_CL1_pole

system_ctrl_design.sys_CL1_pole = control.pole(sys_CL1)

◆ sys_full_OL

system_ctrl_design.sys_full_OL = control.StateSpace(A,B,C,D)

◆ sys_OL_pole

system_ctrl_design.sys_OL_pole = control.pole(sys_full_OL)

◆ sys_plat_CL0

system_ctrl_design.sys_plat_CL0 = control.StateSpace(A_p_CL0,0*B_p,C_p,D_p)

◆ sys_plat_CL1

system_ctrl_design.sys_plat_CL1 = control.StateSpace(A_p_CL1,0*B_p,C_p,D_p)

◆ sys_plat_OL

system_ctrl_design.sys_plat_OL = control.StateSpace(A_p,B_p,C_p,D_p)

◆ T

system_ctrl_design.T = np.arange(0,3,.001)

◆ title

system_ctrl_design.title

◆ X0

list system_ctrl_design.X0 = [5*3.14159/180, 0]

◆ xlabel

system_ctrl_design.xlabel

◆ ylabel1

system_ctrl_design.ylabel1

◆ ylabel2

system_ctrl_design.ylabel2