WingMotion.mpos = MechMotion.mpos WingMotion.dt = dt WingMotion.run() """ Define elements along equivalent axis (P_1) """ Nele = 100 P_1 = np.zeros((len(theta),Nele,3)) Woc = np.linspace(0,1,Nele*(WingInit.fOC/(WingInit.fCD+WingInit.fOC))+1) Wcd = np.linspace(0,1,Nele*(WingInit.fCD/(WingInit.fCD+WingInit.fOC))+2) for i in range(len(theta)): C = rotx(np.radians(-90),(roty(np.radians(-90),np.array([WingMotion.wpos.front.C[0,i], WingMotion.wpos.front.C[1,i], WingMotion.wpos.front.C[2,i]])))) D = rotx(np.radians(-90),(roty(np.radians(-90),np.array([WingMotion.wpos.front.D[0,i], WingMotion.wpos.front.D[1,i], WingMotion.wpos.front.D[2,i]])))) DC = D-C for j in range(len(Woc)-1): P_1[i,j] = Woc[j] * C J_a = j+1 for j in range(len(Wcd)-1): P_1[i,j+J_a] = C + Wcd[j] * DC #print P_1[0,:,1][0]
def bet(P_1,V0_1,Vi_1,Vflap_1,J_a,Twist,Pitch,Chord,PLE,Polar,rho,dt): """ Blade Element Theory according to B. Parslew in general for state matrices: i - moment in time, where 0 is the first moment and end the last moment in time j - blade element, where 0 is the shoulder hinge-element and end is the wing tip-element k - vector component, where 0 is the x-, 1 the y- and 2 the z-component """ Phi = np.zeros_like(Twist) V_4 = np.zeros_like(P_1) dV_4 = np.zeros_like(P_1) F_5 = np.zeros_like(P_1) F_4 = np.zeros_like(P_1) F_1 = np.zeros_like(P_1) l = np.zeros_like(Twist) d = np.zeros_like(Twist) m = np.zeros_like(Twist) aoa = np.zeros_like(Twist) daoa = np.zeros_like(Twist) cl = np.zeros_like(Twist) cd = np.zeros_like(Twist) cm = np.zeros_like(Twist) w = np.zeros_like(Chord) wy = np.zeros_like(Twist) S = np.zeros_like(Twist) Vflap_1[np.abs(Vflap_1) < 1e-8] = 0 for i in range(len(P_1)): for j in range(len(P_1[i])): # Calculate wing element elevation angle if j <= J_a: dz = P_1[i,J_a,2] dy = P_1[i,J_a,1] Phi[i,j] = np.arctan(dz/dy) else: dz = P_1[i,-1,2]-P_1[i,J_a+1,2] dy = P_1[i,-1,1]-P_1[i,J_a+1,1] Phi[i,j] = np.arctan(dz/dy) # Calculate local flow velocity V_4[i,j] = roty((Twist[i,j]+Pitch[j]), rotx(-Phi[i,j],(V0_1 + Vi_1 + Vflap_1[i,j]))) V_4[np.abs(V_4) < 1e-12] = 0 # Calculate angle of attack aoa[i,j] = np.arctan(-V_4[i,j,2]/V_4[i,j,0]) # Find cl,cd,cm from polars with linear interpolation cl[i,j] = np.interp(np.degrees(aoa[i,j]),Polar[j,0],Polar[j,1]) cd[i,j] = np.interp(np.degrees(aoa[i,j]),Polar[j,0],Polar[j,2]) cm[i,j] = np.interp(np.degrees(aoa[i,j]),Polar[j,0],Polar[j,3]) # Calculate element width if j < len(P_1[i])-1: wy[i,j] = P_1[i,j+1,1]-P_1[i,j,1] else: wy[i,j] = P_1[i,j,1]-P_1[i,j-1,1] # Calculate element surface area S[i,j] = Chord[j] * wy[i,j] # Calculate aerodynamic forces l[i,j] = 0.5 * rho * np.linalg.norm(V_4[i,j])**2 * S[i,j] * cl[i,j] d[i,j] = 0.5 * rho * np.linalg.norm(V_4[i,j])**2 * S[i,j] * cd[i,j] m[i,j] = 0.5 * rho * np.linalg.norm(V_4[i,j])**2 * S[i,j] * cm[i,j] # Force vector in Blade Element local axes F_5[i,j] = np.array([-d[i,j], 0, l[i,j]]) # Force vector in Blade local axes F_4[i,j] = roty(aoa[i,j],F_5[i,j]) """ Add mass effect and rotate to stroke plane axes """ for i in range(len(P_1)): for j in range(len(P_1[i])): # Add mass effects if i==0: daoa[i,j] = (aoa[1,j]-aoa[0,j])/dt dV_4[i,j] = (V_4[1,j]-V_4[0,j])/dt elif i < len(P_1)-1: daoa[i,j] = (aoa[i+1,j]-aoa[i-1,j])/(2*dt) dV_4[i,j] = (V_4[i+1,j]-V_4[i-1,j])/(2*dt) else: daoa[i,j] = (aoa[i,j]-aoa[i-1,j])/dt dV_4[i,j] = (V_4[i,j]-V_4[i-1,j])/dt F_4[i,j,0] = F_4[i,j,0] - 0.25 * rho * np.pi * Chord[j] * S[i,j] * V_4[i,j,2] * daoa[i,j] F_4[i,j,2] = F_4[i,j,2] + 0.25 * rho * np.pi * Chord[j] * S[i,j] * dV_4[i,j,2] # Tranform to Stroke Plane Axes F_1[i,j] = rotx(Phi[i,j],roty(-(Twist[i,j]+Pitch[j]),F_4[i,j])) return F_1