def heatrate(lw, dw, i, f): rw = dw / 2 rate = [0, 0] Bx = fBcalc.BxSol(i, rc, rw) #i,a,r in order where i= current, a= radius of coil, r= distance from center rho_cg = 3.57 * 10**(3) rho_si = 3.57 * 10**( -8 ) #Reference https://www.engineeringtoolbox.com/resistivity-conductivity-d_418.html # Calculation for derived variables rw = rw * 100 ur = 1 u = ur * 4 * math.pi * 10**(-7) k = math.sqrt((8 * (math.pi**2) * f * ur) / rho_cg) #print(k*rw) Q = 2*(special.ber(k*rw)*special.berp(k*rw) + special.bei(k*rw)*special.beip(k*rw))\ /(k*rw)/((special.ber(k*rw))**2 + (special.bei(k*rw))**2) rw = rw / 100 new_k = math.sqrt(2 * math.pi * u * f / rho_si) #print(new_k*rw) aw = math.pi * rw * rw beta = math.pi * f * aw * Q / (u) rate[0] = beta * (float(Bx.subs(x, lc / 2)** 2)) / (2695 * math.pi * rw * rw * 952.177) rate[1] = beta * ( float(Bx.subs(x, (lc - lw) / 2)**2 + Bx.subs(x, (lc + lw) / 2)**2) / 2) / (2700 * math.pi * rw * rw * 929) return rate
def calc_Zc(f, Rd, r, mu_r, rho): n = np.shape(Rd)[0] Zc = np.empty((n), np.complex128) for i in range(n): m = np.sqrt(2 * np.pi * f * mu_r[i] * 4 * np.pi * 10**-7 / rho[i]) mr = m * r[i] # print(mr) A = special.ber(mr) * special.beip(mr) - special.bei( mr) * special.berp(mr) B = special.bei(mr) * special.beip(mr) + special.ber( mr) * special.berp(mr) C = special.berp(mr)**2 + special.beip(mr)**2 # print('B/C=',B/C,'A/C=',A/C) # print('A/C=',A/C) alphaR = (mr / 2) * (A / C) alphaL = (4 / mr) * (B / C) # print('alphaL = ',alphaL) Rc = Rd[i] * alphaR Xc = np.pi * f * 10**-4 * mu_r[i] * alphaL Zc[i] = Rc + 1j * Xc print(Zc[i]) return Zc
def power(lw, dw, i, f): rw = dw / 2 Bx = fBcalc.BxSol(i, rc, rw) #i,a,r in order where i= current, a= radius of coil, r= distance from center rho_cg = 3.25 * 10**(3) rho_si = 3.25 * 10**( -8 ) #Reference https://www.engineeringtoolbox.com/resistivity-conductivity-d_418.html # Calculation for derived variables rw = rw * 100 ur = 1 u = ur * 4 * math.pi * 10**(-7) k = math.sqrt((8 * (math.pi**2) * f * ur) / rho_cg) #print(k*rw) Q = 2*(special.ber(k*rw)*special.berp(k*rw) + special.bei(k*rw)*special.beip(k*rw))\ /(k*rw)/((special.ber(k*rw))**2 + (special.bei(k*rw))**2) rw = rw / 100 print(k) new_k = math.sqrt(2 * math.pi * u * f / rho_si) print(new_k) aw = math.pi * rw * rw beta = math.pi * f * aw * Q / (u) #beta is a constant and total power is beta times Bx**2 integrated #over the length of the workpiece # Bx involves ellipticl integrals of the first kind and the second kind and # its analytical integral is not possible using python # Approach: Evaluate Bx at a set number of points and implement different types of # numerical integration methods like simpsons, trapezoidal etc. # Maybe define a good criteria of how many points to take versus the computation power consumed for evaluating the numerical integrals # Origin redefined to the center of end coil of the solenoid # Defining linspace in such a way that the distance between two points in the workpiece remains fixed to an order where Bx doesn't change significantly # i.e. lw/(number of points) = constant -- this is not the best way because derivative of Bx is large near the end of coil and linspace is constant # distance between each successive x points be 0.0001 m num_pts = int(lw / 0.0003) x_arr = linspace((lc - lw) / 2, (lc + lw) / 2, num=num_pts) Bx_sq_arr = np.empty(num_pts, dtype='float') for i in range(num_pts): temp = Bx.subs(x, x_arr[i]) Bx_sq_arr[i] = temp**2 P = beta * trap(Bx_sq_arr, x_arr) rate = P / (lw * 2700 * math.pi * rw * rw * 910) return rate
def calc_Zc1(f, Rd, r, mu_r, rho): n = np.shape(Rd)[0] Zc = np.empty((n), np.complex128) for i in range(n): m = np.sqrt(2 * np.pi * f * mu_r[i] * 4 * np.pi * 10**-7 / rho[i]) mr = m * r[i] # print(mr) a = special.ber(mr) + 1j * special.bei(mr) b = special.berp(mr) + 1j * special.beip(mr) c = 1j * a / b # print('a=',a) # print('b=',b) # print('c=',c) alphaR = (mr / 2) * np.real(c) alphaL = (4 / mr) * np.imag(c) # print('alphaL = ',alphaL) Rc = Rd[i] * alphaR Xc = np.pi * f * 10**-4 * mu_r[i] * alphaL Zc[i] = Rc + 1j * Xc print(Zc[i]) return Zc
lol = abs(exp[i] - result) #print(np.amin(five_min)) #print("min val",np.amin(lol)) index = np.where(lol == np.amin(lol)) return index[0][0] if __name__ == '__main__': data = read('thernalDiff5\phaseDiff.txt') phi = data / times * 2 * np.pi * -1 print("phi is", phi) ratio = np.tan(phi) #tan(phi) print(ratio) a = np.linspace(0, 3, 100000) result = fnc.bei(a) / fnc.ber(a) #the bernoulli equations plt.plot(a, result) plt.ylim(-10, 10) index = [] for i in range(len(ratio)): index.append(get_intersect(result, ratio, i)) #get interseciton x = a[index] print('x vals', x) #get x value plt.scatter(x, result[index]) #validate on plot a = np.linspace(0, 10, 100000) result = fnc.bei(a) / fnc.ber(a) #the bernoulli equations
import numpy as np from scipy import linalg from scipy import constants as C from scipy import special conductors_equivalent_radius = 0.001 * np.array([ 6.18, 4.74, 9.03, 49.65, 49.65, 7.22, 4.055, 6.18, 4.74, 9.03, 49.65, 49.65, 7.22, 4.055 ]) conductors_rho = 10**-10 * np.array([ 172.41, 0.185, 0.29731, 2.1121, 2.1121, 0.029667, 0.19264, 172.41, 0.185, 0.29731, 2.1121, 2.1121, 0.029667, 0.19264 ]) f = 50 mu = 4 * np.pi * 10**-7 r = conductors_equivalent_radius rho = conductors_rho m = np.sqrt(2 * np.pi * f * mu / rho) print(rho) print(r) print(m) A1 = m * r / 2 A2 = 4 / (m * r) B1 = special.ber(m * r) B2 = special.bei(m * r) C1 = special.berp(m * r) C2 = special.beip(m * r) aR = A1 * ((B1 * C2 - C1 * B2) / (C1**2 + C2**2)) aL = A2 * ((B2 * C2 - C1 * B1) / (C1**2 + C2**2)) print(aR) print(aL)