ME 405
system_modeling.py File Reference

This file test the behavior of my balancing platform system model. More...

Namespaces

 system_modeling
 

Functions

def system_modeling.plot_plat_sim (sim_time, sim_result, title, fig_size)
 Th function creates an appropriately formatted system test plot. More...
 

Variables

 system_modeling.A = np.asmatrix(np.loadtxt('A.txt',delimiter=','))
 State space system state matrix A. More...
 
 system_modeling.B = np.asmatrix(np.loadtxt('B.txt',delimiter=',')).transpose()
 State space system input matrix B. More...
 
 system_modeling.C = np.matrix()
 State space system state output matrix C. More...
 
int system_modeling.D = 0
 State space system input output matrix D. More...
 
 system_modeling.sys = control.StateSpace(A,B,C,D)
 State space system object. More...
 
 system_modeling.TA = np.arange(0,1,.001)
 Simulation A time vector. More...
 
list system_modeling.X0A = [0, 0, 0, 0]
 Simulation A initial conditions. More...
 
 system_modeling.RA = control.initial_response(sys,TA,X0A)
 Simulation A results. More...
 
 system_modeling.TB = np.arange(0,0.4,.001)
 Simulation B time vector. More...
 
list system_modeling.X0B = [.05, 0, 0, 0]
 Simulation b initial conditions. More...
 
 system_modeling.RB = control.initial_response(sys,TB,X0B)
 Simulation B results. More...
 
 system_modeling.TC = np.arange(0,0.4,.001)
 Simulation C time vector. More...
 
list system_modeling.X0C = [0.001619, 5*3.14159/180, 0, 0]
 Simulation C initial conditions. More...
 
 system_modeling.RC = control.initial_response(sys,TC,X0C)
 Simulation C results. More...
 
 system_modeling.TD = np.arange(0,0.4,.001)
 Simulation D time vector. More...
 
 system_modeling.u0D = np.zeros((1,len(TD)))
 Simulation D input signal. More...
 
list system_modeling.X0D = [0, 0, 0, 0]
 Simulation D input signal. More...
 
 system_modeling.RD = control.forced_response(sys,TD,u0D,X0D)
 Simulation D results. More...
 
 system_modeling.K = np.matrix()
 Closed loop systems gain matrix. More...
 
 system_modeling.A_cl = np.subtract(A,np.matmul(B,K))
 Closed loop state space system state matrix. More...
 
 system_modeling.B_cl = np.matrix()
 Closed loop state space system input matrix set to zeros since the system is used as a regulator. More...
 
 system_modeling.sys_cl = control.StateSpace(A_cl,B_cl,C,D)
 Closed loop state space system object. More...
 
 system_modeling.TA_cl = np.arange(0,1,.001)
 Closed loop simulation A time vector. More...
 
list system_modeling.X0A_cl = [0, 0, 0, 0]
 Closed loop simulation A initial conditions. More...
 
 system_modeling.RA_cl = control.initial_response(sys_cl,TA_cl,X0A_cl)
 Closed loop simulation A results. More...
 
 system_modeling.TB_cl = np.arange(0,20,.001)
 Closed loop simulation B time. More...
 
list system_modeling.X0B_cl = [.05, 0, 0, 0]
 Closed loop simulation B initial conditions. More...
 
 system_modeling.RB_cl = control.initial_response(sys_cl,TB_cl,X0B_cl)
 Closed loop simulation B results. More...
 
 system_modeling.TC_cl = np.arange(0,20,.001)
 Closed loop simulation C time. More...
 
list system_modeling.X0C_cl = [0.001619, 5*3.14159/180, 0, 0]
 Closed loop simulation C initial conditions. More...
 
 system_modeling.RC_cl = control.initial_response(sys_cl,TC_cl,X0C_cl)
 Closed loop simulation C results. More...
 

Detailed Description

This file test the behavior of my balancing platform system model.

Author
E. Nicholson
Date
February 22, 2021

This file works alongside a MATLAB live script that computes the open loop state space system matrices for the ME 405 balancing platform term project. It pulls the matrix output of the script from two text files and tests the behavior in open loop and closed loop configuration using the python controls toolbox.

The source code for this file can be found here:

https://bitbucket.org/ewnichol/me305-me405_labs/src/master/me405/me405%20Term%20Project/system_modeling.py