if __name__ == "__main__": has_break = True k = 0; Ts = 2e-06; # Inport mat file mat = io.loadmat('WithoutTorq.mat') speed = mat['Speed']['signals'][0][0][0][0][0] time = mat['Speed']['time'][0][0] voltage = mat['Voltage']['signals'][0][0][0][0][0] current = mat['Current']['signals'][0][0][0][0][0] teta = mat['Teta']['signals'][0][0][0][0][0] acim = ACIM(Rr=9.295e-3, Rs=14.85e-3, Lr=0.3027e-3, \ Ls=0.3027e-3, Lm=10.46e-3, J=0.01, p=2) coord_trans = CT() k += 1; # Initialization xk = array([[0], [0], [0], [0], [0]]) PP = 1e-3 * identity(5) Q = identity(5) """ri = random.uniform( 1e-7, 1e-2, ) fi = random.uniform( 1e-7, 1e-2 ) wi = random.uniform( 1e-7, 1e-2 )""" Q[0][0] = 1e-4 Q[1][1] = 1e-4 Q[2][2] = 3e-2 Q[3][3] = 3e-2
# u = array( [[200.], [2.]] ) # yo[i, :] = pmsm.dlsim( u, Ts = Ts )[1][:, 0] # if( i % 1000 ) == 0: # print "%d of %d" % ( i, len( mtime ) ) # # pylab.figure() # pylab.plot( yo[:, 2] ) # # pylab.show() #Control signals # squareW = squarewave( Ts = Ts, mtime = 10 , freq = 0.2, amp = 30 ) # sw = squareW.signal() sinW = sinwave( Ts = Ts, mtime = 1, freq = 2, amp = 30 ) sw = sinW.signal() ct = CT() #Number of horizon N = 2 ( Ak, Bk, Ck, Dk ) = pmsm.mdss( x, Ts ) dlqr = DSTLQR( Ak, Bk, Ck, N ) w_s = zeros( ( len( sw ), 1 ) ) U_s = zeros( ( len( sw ), 2 ) ) x_s = zeros( ( len( sw ), 5 ) ) error = zeros( ( len( sw ), 1 ) ) w_est = zeros( ( len( sw ), 1 ) ) O_est = zeros( ( len( sw ), 1 ) ) U_abc = zeros( ( len( sw ), 3 ) )
from numpy import array, arange, zeros from tools.signalgenerator import threephase from coordinate_transformations.CT import CT import pylab if __name__ == "__main__": Ts = 0.001 mtime = 0.1 three_phase = threephase(amp=220, freq=50, Ts=Ts, mtime=mtime) signal = three_phase.signal() transf = CT() atime = arange(0, mtime, Ts) a_alpha_beta = zeros((3, len(atime))) a_a_b_c = zeros((3, len(atime))) for i in range(len(atime)): alpha_beta = transf.clarke_p_i_i0(signal[0][i], signal[1][i], signal[2][i]) a_b_c = transf.inv_clarke_p_i_i0(alpha_beta[0][0], alpha_beta[1][0], alpha_beta[2][0]) a_alpha_beta[0][i] = alpha_beta[0][0] a_alpha_beta[1][i] = alpha_beta[1][0] a_alpha_beta[2][i] = alpha_beta[2][0] a_a_b_c[0][i] = a_b_c[0][0] a_a_b_c[1][i] = a_b_c[1][0]
from numpy import array, arange, zeros from tools.signalgenerator import threephase from coordinate_transformations.CT import CT import pylab if __name__ == "__main__": Ts = 0.001 mtime = 0.1 three_phase = threephase(amp = 220, freq = 50, Ts = Ts, mtime = mtime) signal = three_phase.signal() transf = CT() atime = arange( 0, mtime, Ts ) a_alpha_beta = zeros((3, len( atime ) )) a_a_b_c = zeros((3, len( atime ) )) for i in range( len( atime ) ): alpha_beta = transf.clarke_p_i_i0(signal[0][i], signal[1][i], signal[2][i]) a_b_c = transf.inv_clarke_p_i_i0(alpha_beta[0][0], alpha_beta[1][0], alpha_beta[2][0]) a_alpha_beta[0][i] = alpha_beta[0][0] a_alpha_beta[1][i] = alpha_beta[1][0] a_alpha_beta[2][i] = alpha_beta[2][0] a_a_b_c[0][i] = a_b_c[0][0] a_a_b_c[1][i] = a_b_c[1][0] a_a_b_c[2][i] = a_b_c[2][0]
if __name__ == "__main__": has_break = True k = 0; Ts = 2e-06; #Inport mat file mat = io.loadmat( 'WithoutTorq.mat' ) speed = mat['Speed']['signals'][0][0][0][0][0] time = mat['Speed']['time'][0][0] voltage = mat['Voltage']['signals'][0][0][0][0][0] current = mat['Current']['signals'][0][0][0][0][0] teta = mat['Teta']['signals'][0][0][0][0][0] acim = acim( Rr = 9.295e-3, Rs = 14.85e-3, Lr = 0.3027e-3, \ Ls = 0.3027e-3, Lm = 10.46e-3, J = 0.01, p = 2 ) coord_trans = CT() k += 1; #Initialization xk = array( [[0], [0], [0], [0], [0], [0]] ) PP = 1e-3 * identity( 6 ) Q = identity( 6 ) """ri = random.uniform( 1e-7, 1e-2, ) fi = random.uniform( 1e-7, 1e-2 ) wi = random.uniform( 1e-7, 1e-2 )""" Q[0][0] = 1e-2 Q[1][1] = 1e-2 Q[2][2] = 1e-4 Q[3][3] = 1e-4