summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--README.org7
-rw-r--r--TAGS445
-rw-r--r--example_airfoil.py29
-rw-r--r--tools/creator.py18
5 files changed, 476 insertions, 31 deletions
diff --git a/README.md b/README.md
deleted file mode 100644
index 5427162..0000000
--- a/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# UCLA MAE 154B
-
-## Spring 2019 Final Project
-
-This program enables the creation of NACA airfoils;\
-the analysis of the airfoil's structural properties;\
-the optimization via genetic algorithm of a population of airfoils;\
-With the final objective of designing a lightweight FAR 23 compliant airfoil.
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..caa04a9
--- /dev/null
+++ b/README.org
@@ -0,0 +1,7 @@
+#+TITLE: UCLA MAE 154B
+#+SUBTITLE: Spring 2019 Final Project
+
+This program enables the creation of NACA airfoils;
+the analysis of the airfoil's structural properties;
+the optimization via genetic algorithm of a population of airfoils;
+With the final objective of designing a lightweight FAR 23 compliant airfoil.
diff --git a/TAGS b/TAGS
new file mode 100644
index 0000000..9381a94
--- /dev/null
+++ b/TAGS
@@ -0,0 +1,445 @@
+
+/home/blendux/github/UCLA_MAE_154B/example_airfoil.py,842
+start_time = time.time()start_time15,374
+NACA_NUM = 2412NACA_NUM18,426
+CHORD_LENGTH = 68CHORD_LENGTH19,442
+SEMI_SPAN = 150SEMI_SPAN20,460
+SPAR_THICKNESS = 0.4SPAR_THICKNESS23,491
+SKIN_THICKNESS = 0.1SKIN_THICKNESS24,512
+AIRFOIL_MASS = 10AIRFOIL_MASS27,559
+SPAR_MASS = 10SPAR_MASS28,577
+STRINGER_MASS = 5STRINGER_MASS29,592
+SPAR_CAP_AREA = 0.3SPAR_CAP_AREA32,625
+STRINGER_AREA = 0.1STRINGER_AREA33,645
+TOP_STRINGERS = 6TOP_STRINGERS36,688
+BOTTOM_STRINGERS = 4BOTTOM_STRINGERS37,706
+NOSE_TOP_STRINGERS = 3NOSE_TOP_STRINGERS38,727
+NOSE_BOTTOM_STRINGERS = 5NOSE_BOTTOM_STRINGERS39,750
+SAVE_PATH = '/home/blendux/github/UCLA_MAE_154B/save/'SAVE_PATH41,777
+af = creator.Airfoil.from_dimensions(CHORD_LENGTH, SEMI_SPAN)af45,860
+eval = evaluator.Evaluator(af)eval81,2026
+pop = generator.Population(10)pop89,2245
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/my_progress.m,7747
+Vx = 1; Vz = 1; My = 1; %test loads will be applied individuallyVx5,40
+numStringers = numTopStringers;numStringers15,163
+stringerGap = upperStringerGap;stringerGap16,195
+webThickness = t_upper;webThickness17,227
+tempStringers = topStringers;tempStringers18,251
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx34,786
+ tempInt = get_int(web(i).xStart/chord,web(i).xEnd/chord,1)*chord^2; %integral of airfoil futempInt40,1142
+ triangle1 = abs( (web(i).xStart - sparCaps(1).posX)*web(i).zStart/2);triangle141,1245
+ triangle2 = abs((web(i).xEnd - sparCaps(1).posX)*web(i).zEnd/2);triangle242,1319
+webTop = web;webTop56,2080
+web = [];web57,2094
+dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx67,2319
+webRearSpar = web;webRearSpar87,3367
+web = [];web88,3386
+numStringers = numBottomStringers;numStringers92,3410
+stringerGap = lowerStringerGap;stringerGap93,3445
+webThickness = t_lower;webThickness94,3477
+tempStringers = bottomStringers;tempStringers95,3501
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx103,3817
+ tempInt = get_int(web(i).xEnd/chord,web(i).xStart/chord,0)*chord^2; %integral of airfoil futempInt118,4524
+ triangle2 = abs((web(i).xStart - sparCaps(1).posX)*web(i).zStart/2);triangle2119,4627
+ triangle1 = abs((web(i).xEnd - sparCaps(1).posX)*web(i).zEnd/2);triangle1120,4700
+webBottom = web;webBottom136,5535
+web = [];web137,5552
+dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx147,5779
+webFrontSpar = web;webFrontSpar165,6715
+web = [];web166,6735
+numStringers = numNoseBottomStringers;numStringers174,6781
+stringerGap = lowerNoseStringerGap;stringerGap175,6820
+webThickness = t_lower_front;webThickness176,6856
+tempStringers = noseBottomStringers;tempStringers177,6886
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx185,7206
+ tempInt = get_int(web(i).xEnd/chord,web(i).xStart/chord,0)*chord^2; %integral of airfoil futempInt200,7761
+ triangle1 = abs((web(i).xStart - sparCaps(2).posX)*web(i).zStart/2);triangle1201,7864
+ triangle2 = abs((web(i).xEnd - sparCaps(2).posX)*web(i).zEnd/2);triangle2202,7937
+webLowerNose = web;webLowerNose218,8776
+web = [];web219,8796
+numStringers = numNoseTopStringers;numStringers222,8824
+stringerGap = upperNoseStringerGap;stringerGap223,8860
+webThickness = t_upper_front;webThickness224,8896
+tempStringers = noseTopStringers;tempStringers225,8926
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx233,9205
+ tempInt = get_int(web(i).xStart/chord,web(i).xEnd/chord,1)*chord^2; %integral of airfoil futempInt247,9864
+ triangle2 = abs((web(i).xStart - sparCaps(2).posX)*web(i).zStart/2);triangle2248,9967
+ triangle1 = abs((web(i).xEnd - sparCaps(2).posX)*web(i).zEnd/2);triangle1249,10040
+webUpperNose = web;webUpperNose264,10802
+web = [];web265,10822
+dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx276,11050
+webFrontSparCell2 = web;webFrontSparCell2294,11994
+web = [];web295,12019
+Fx = sum([webTop.qp_dx_X])+webRearSpar.qp_dx_X+ sum([webBottom.qp_dx_X])+webFrontSpar.qp_dx_X; Fx300,12064
+Fx = Fx + sum([webLowerNose.qp_dx_X])+ sum([webUpperNose.qp_dx_X]); %cell 2Fx301,12168
+Fz = sum([webTop.qp_dz_X])+webRearSpar.qp_dz_X+ sum([webBottom.qp_dz_X])+webFrontSpar.qp_dz_X; Fz303,12248
+Fz = Fz + sum([webLowerNose.qp_dz_X])+ sum([webUpperNose.qp_dz_X]); %cell 2Fz304,12352
+Fx = sum([webTop.qp_dx_Z])+webRearSpar.qp_dx_Z+ sum([webBottom.qp_dx_Z])+webFrontSpar.qp_dx_Z; Fx310,12467
+Fx = Fx + sum([webLowerNose.qp_dx_Z])+ sum([webUpperNose.qp_dx_Z]); %cell 2Fx311,12571
+Fz = sum([webTop.qp_dz_Z])+webRearSpar.qp_dz_Z+ sum([webBottom.qp_dz_Z])+webFrontSpar.qp_dz_Z; Fz313,12651
+Fz = Fz + sum([webLowerNose.qp_dz_Z])+ sum([webUpperNose.qp_dz_Z]); %cell 2Fz314,12755
+A11 = sum([webTop.dS_over_t])+webRearSpar.dS_over_t+ sum([webBottom.dS_over_t])+webFrontSpar.dS_A11323,12925
+A22 = sum([webLowerNose.dS_over_t])+ sum([webUpperNose.dS_over_t])+webFrontSparCell2.dS_over_t;A22324,13029
+A12 = -webFrontSpar.dS_over_t;A12325,13125
+A21 = -webFrontSparCell2.dS_over_t;A21326,13156
+B1_X = sum([webTop.q_dS_over_t_X])+webRearSpar.q_dS_over_t_X+ sum([webBottom.q_dS_over_t_X])+webB1_X328,13193
+B2_X = sum([webLowerNose.q_dS_over_t_X])+ sum([webUpperNose.q_dS_over_t_X])+webFrontSparCell2.q_B2_X329,13314
+B1_Z = sum([webTop.q_dS_over_t_Z])+webRearSpar.q_dS_over_t_Z+ sum([webBottom.q_dS_over_t_Z])+webB1_Z330,13423
+B2_Z = sum([webLowerNose.q_dS_over_t_Z])+ sum([webUpperNose.q_dS_over_t_Z])+webFrontSparCell2.q_B2_Z331,13544
+Amat = [A11 A12; A21 A22];Amat333,13654
+Bmat_X = -[B1_X;B2_X];Bmat_X334,13681
+Bmat_Z = -[B1_Z;B2_Z];Bmat_Z335,13704
+qs_X = inv(Amat)*Bmat_X;qs_X337,13728
+qs_Z = inv(Amat)*Bmat_Z;qs_Z338,13753
+sum_2_a_q_X = sum([webTop.two_A_qprime_X])+webRearSpar.two_A_qprime_X+ sum([webBottom.two_A_qprisum_2_a_q_X342,13781
+sum_2_a_q_X = sum_2_a_q_X + sum([webLowerNose.two_A_qprime_X])+ sum([webUpperNose.two_A_qprime_Xsum_2_a_q_X343,13902
+sum_2_a_q_X = sum_2_a_q_X + 2*qs_X(1)*(sum([webTop.Area])+webRearSpar.Area+ sum([webBottom.Areasum_2_a_q_X344,14020
+sum_2_a_q_X = sum_2_a_q_X + 2*qs_X(2)*(sum([webLowerNose.Area])+ sum([webUpperNose.Area]));sum_2_a_q_X345,14121
+sum_2_a_q_Z = sum([webTop.two_A_qprime_Z])+webRearSpar.two_A_qprime_Z+ sum([webBottom.two_A_qprisum_2_a_q_Z347,14215
+sum_2_a_q_Z = sum_2_a_q_Z + sum([webLowerNose.two_A_qprime_Z])+ sum([webUpperNose.two_A_qprime_Zsum_2_a_q_Z348,14336
+sum_2_a_q_Z = sum_2_a_q_Z + 2*qs_Z(1)*(sum([webTop.Area])+webRearSpar.Area+ sum([webBottom.Areasum_2_a_q_Z349,14454
+sum_2_a_q_Z = sum_2_a_q_Z + 2*qs_Z(2)*(sum([webLowerNose.Area])+ sum([webUpperNose.Area]));sum_2_a_q_Z350,14555
+torque_Z = Vz*(sc.posX - 0.25*chord);torque_Z360,14875
+torque_X = -Vx*sc.posZ;torque_X361,14913
+Area1 = sum([webTop.Area]) + webRearSpar.Area + sum([webBottom.Area]);Area1364,14939
+Area1_check = get_int(frontSpar,backSpar,1)*chord^2 + get_int(frontSpar,backSpar,0)*chord^2;Area1_check366,15022
+Area2 = sum([webLowerNose.Area]) + sum([webUpperNose.Area]);Area2368,15116
+Area2_check = get_int(0,frontSpar,1)*chord^2 + get_int(0,frontSpar,0)*chord^2;Area2_check369,15177
+q1t_over_q2t = (A22/Area2 + webFrontSpar.dS_over_t/Area1)/(A11/Area1 + webFrontSpar.dS_over_t/Arq1t_over_q2t374,15312
+q2t = torque_X/(2*Area1*q1t_over_q2t + 2*Area2);q2t376,15415
+q1t = q2t*q1t_over_q2t;q1t377,15464
+qt_X = [q1t;q2t];qt_X378,15488
+q2t = torque_Z/(2*Area1*q1t_over_q2t + 2*Area2);q2t380,15507
+q1t = q2t*q1t_over_q2t;q1t381,15556
+qt_Z = [q1t;q2t];qt_Z382,15580
+xChord = 0:.01:1;xChord403,15777
+xChord = xChord*chord;xChord404,15795
+upperSurface = zeros(1,length(xChord));upperSurface405,15818
+lowerSurface = zeros(1,length(xChord));lowerSurface406,15858
+ vecX = [frontSpar*chord webTop(i).xStart webTop(i).xEnd];vecX421,16255
+ vecZ = [0 webTop(i).zStart webTop(i).zEnd];vecZ422,16316
+ vecX = [frontSpar*chord webBottom(i).xStart webBottom(i).xEnd];vecX427,16429
+ vecZ = [0 webBottom(i).zStart webBottom(i).zEnd];vecZ428,16496
+ vecX = [frontSpar*chord webUpperNose(i).xStart webUpperNose(i).xEnd];vecX433,16618
+ vecZ = [0 webUpperNose(i).zStart webUpperNose(i).zEnd];vecZ434,16691
+ vecX = [frontSpar*chord webLowerNose(i).xStart webLowerNose(i).xEnd];vecX439,16819
+ vecZ = [0 webLowerNose(i).zStart webLowerNose(i).zEnd];vecZ440,16892
+ vecX = [frontSpar*chord sparCaps(3).posX sparCaps(4).posX];vecX444,16989
+ vecZ = [0 sparCaps(3).posZ sparCaps(4).posZ];vecZ445,17052
+sparCapSize = 18;sparCapSize449,17136
+stringerSize = 18;stringerSize450,17154
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/get_z.m,481
+function z = get_z(x,u)get_z1,0
+M = 0.02;M9,66
+P = 0.4;P10,76
+T = 0.12;T11,85
+a0 = 0.2969;a012,95
+a1 = -0.126;a113,108
+a2 = -0.3516;a214,121
+a3 = 0.2843;a315,135
+a4 = -0.1015;a416,148
+ z_camber = M/P^2*(2*P*x - x^2);z_camber19,171
+ z_camber = (M/(1-P)^2)*(1 - 2*P +2*P*x - x^2);z_camber21,212
+z_thickness = (T/0.2)*(a0*x^.5+a1*x+a2*x^2+a3*x^3+a4*x^4);z_thickness25,301
+ z = z_camber + z_thickness;z28,369
+ z = z_camber - z_thickness;z30,406
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/get_dp.m,169
+function z = get_dp(xDist,zDist,Vx,Vz,Ix,Iz,Ixz,A)get_dp1,0
+denom = (Ix*Iz-Ixz^2);denom3,52
+z = -A*xDist*(Ix*Vx-Ixz*Vz)/denom - A*zDist*(Iz*Vz-Ixz*Vx)/denom;z4,75
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/get_int.m,925
+function z = get_int(xi,xf,u)get_int1,0
+M = 0.02;M3,31
+P = 0.4;P4,41
+T = 0.12;T5,50
+a0 = 0.2969;a06,60
+a1 = -0.126;a17,73
+a2 = -0.3516;a28,86
+a3 = 0.2843;a39,100
+a4 = -0.1015;a410,113
+ intCamb = M/P^2*(2*P*xf^2/2 - xf^3/3) - M/P^2*(2*P*xi^2/2 - xi^3/3); intCamb16,214
+ intCamb = (M/(1-P)^2)*((1 - 2*P)*xf +2*P*xf^2/2 - xf^3/3) - (M/(1-P)^2)*((1 - 2*P)*P +2*P*P^intCamb18,303
+ intCamb = intCamb + M/P^2*(2*P*P^2/2 - P^3/3) - M/P^2*(2*P*xi^2/2 - xi^3/3);intCamb19,413
+ intCamb = (M/(1-P)^2)*((1 - 2*P)*xf +2*P*xf^2/2 - xf^3/3) - (M/(1-P)^2)*((1 - 2*P)*xi +2*P*xintCamb21,499
+intThickness = (T/0.2)*(a0*xf^1.5/1.5 + a1*xf^2/2 + a2*xf^3/3 + a3*xf^4/4 +a4*xf^5/5);intThickness27,710
+intThickness = intThickness - (T/0.2)*(a0*xi^1.5/1.5 + a1*xi^2/2 + a2*xi^3/3 + a3*xi^4/4 +a4*xi^intThickness28,797
+ z = intCamb + intThickness; z32,964
+ z = abs(intCamb - intThickness);z34,1001
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/eye_beam_example.m,1004
+length = 20; % inlength4,44
+force = 10000; %lbsforce5,62
+max_width = 4; % inmax_width9,105
+min_width = 1; % inmin_width10,125
+y_max = 4; % iny_max11,145
+center_y = 2; % incenter_y12,161
+M = force*length;M17,218
+I = min_width*(2*center_y)^3/12 + 2*( max_width*(y_max-center_y)^3/12 + ...I19,237
+sigma_max = M * y_max / I;sigma_max22,370
+tempCoeff = force / (I * max_width);tempCoeff29,542
+int_y_da = ((y_max+center_y)/2) * max_width*(y_max-center_y);int_y_da30,579
+shear_1 = tempCoeff*int_y_da;shear_131,641
+tempCoeff = force / (I * min_width);tempCoeff34,749
+shear_2 = tempCoeff*int_y_da;shear_235,786
+tempCoeff = force / (I * min_width);tempCoeff39,857
+int_y_da = (center_y/2) * min_width*center_y;int_y_da40,894
+shear_3 = shear_2+tempCoeff*int_y_da;shear_341,940
+int_y_da_4 = force / (I * max_width)*4*(y_max^2/2 - (center_y:.1:y_max).^2/2);int_y_da_444,1027
+int_y_da_1 = shear_2 + force / (I * min_width)*1*(center_y^2/2 - (0:.1:center_y).^2/2);int_y_da_147,1155
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/get_ds.m,378
+function ds = get_ds(xi,xf,u)get_ds1,0
+dist = 0;dist3,31
+numSteps = 10;numSteps4,41
+dx = (xf-xi)/numSteps;dx5,56
+z0 = get_z(xi,u);z06,79
+x0 = xi;x07,97
+ tempX = x0+dx;tempX9,117
+ tempZ = get_z(tempX,u);tempZ11,153
+ tempZ = 0;tempZ13,195
+ dist = dist + (dx^2+(tempZ-z0)^2)^.5;dist15,222
+ z0 = tempZ;z016,264
+ x0 = tempX;x017,280
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/stringersBeamExample.m,837
+force = 8000; % lbsforce2,12
+stringer_A = 0.5; % in^2stringer_A3,32
+thickness = 0.04; % inthickness4,57
+top_stringers_y = 6; % intop_stringers_y6,81
+middle_stringers_y = 2; % inmiddle_stringers_y7,107
+I = 2*stringer_A*top_stringers_y^2 + 2*stringer_A*middle_stringers_y^2;I9,137
+shear_top_web = force / (I*thickness) * top_stringers_y * stringer_A;shear_top_web15,381
+shear_middle_web = shear_top_web + (force / (I*thickness) * middle_stringers_y * stringer_A);shear_middle_web16,451
+d_sigma = force * top_stringers_y / I; %(lbs/in^2)d_sigma36,1520
+d_force_top = d_sigma * stringer_A;d_force_top37,1572
+d_sigma = force * middle_stringers_y / I; %(lbs/in^2)d_sigma40,1631
+d_force_middle = d_force_top + d_sigma*stringer_A;d_force_middle41,1686
+check_load = 2*d_force_top*4 + d_force_middle*4;check_load44,1762
+
+/home/blendux/github/UCLA_MAE_154B/wing_scripts/wingAnalysis_190422.m,10240
+Vx = 1; Vz = 1; My = 1; %test loads will be applied individuallyVx8,43
+numTopStringers = 6;numTopStringers11,124
+numBottomStringers = 8;numBottomStringers12,145
+numNoseTopStringers = 4;numNoseTopStringers13,169
+numNoseBottomStringers = 4;numNoseBottomStringers14,194
+t_upper = 0.02/12;t_upper16,223
+t_lower = 0.02/12;t_lower17,242
+t_upper_front = 0.02/12;t_upper_front18,261
+t_lower_front = 0.02/12;t_lower_front19,286
+t_frontSpar = 0.04/12;t_frontSpar20,311
+t_rearSpar = 0.04/12;t_rearSpar21,334
+frontSpar = 0.2;frontSpar23,357
+backSpar = 0.7;backSpar24,374
+chord = 5;chord25,390
+upperStringerGap = (sparCaps(3).posX - sparCaps(1).posX)/(numTopStringers + 1);upperStringerGap42,817
+lowerStringerGap = (sparCaps(3).posX - sparCaps(1).posX)/(numBottomStringers + 1);lowerStringerGap43,897
+upperNoseStringerGap = (sparCaps(1).posX - 0)/(numNoseTopStringers + 1);upperNoseStringerGap44,980
+lowerNoseStringerGap = (sparCaps(1).posX - 0)/(numNoseBottomStringers + 1);lowerNoseStringerGap45,1053
+Ix = 0; Iz = 0; Ixz = 0;Ix98,3144
+ Ix = Ix + sparCaps(i).area*(sparCaps(i).posZ-centroid.posZ)^2;Ix101,3191
+ Iz = Iz + sparCaps(i).area*(sparCaps(i).posX-centroid.posX)^2;Iz102,3258
+ Ixz = Ixz + sparCaps(i).area*(sparCaps(i).posX-centroid.posX)*(sparCaps(i).posZ-centroid.posIxz103,3325
+ Ix = Ix + topStringers(i).area*(topStringers(i).posZ-centroid.posZ)^2;Ix108,3470
+ Iz = Iz + topStringers(i).area*(topStringers(i).posX-centroid.posX)^2;Iz109,3545
+ Ixz = Ixz + topStringers(i).area*(topStringers(i).posX-centroid.posX)*(topStringers(i).posZ-Ixz110,3620
+ Ix = Ix + bottomStringers(i).area*(bottomStringers(i).posZ-centroid.posZ)^2;Ix113,3781
+ Iz = Iz + bottomStringers(i).area*(bottomStringers(i).posX-centroid.posX)^2;Iz114,3862
+ Ixz = Ixz + bottomStringers(i).area*(bottomStringers(i).posX-centroid.posX)*(bottomStringersIxz115,3943
+ Ix = Ix + noseTopStringers(i).area*(noseTopStringers(i).posZ-centroid.posZ)^2;Ix118,4116
+ Iz = Iz + noseTopStringers(i).area*(noseTopStringers(i).posX-centroid.posX)^2;Iz119,4199
+ Ixz = Ixz + noseTopStringers(i).area*(noseTopStringers(i).posX-centroid.posX)*(noseTopStringIxz120,4282
+ Ix = Ix + noseBottomStringers(i).area*(noseBottomStringers(i).posZ-centroid.posZ)^2;Ix123,4464
+ Iz = Iz + noseBottomStringers(i).area*(noseBottomStringers(i).posX-centroid.posX)^2;Iz124,4553
+ Ixz = Ixz + noseBottomStringers(i).area*(noseBottomStringers(i).posX-centroid.posX)*(noseBotIxz125,4642
+numStringers = numTopStringers;numStringers135,4835
+stringerGap = upperStringerGap;stringerGap136,4867
+webThickness = t_upper;webThickness137,4899
+tempStringers = topStringers;tempStringers138,4923
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx154,5458
+ tempInt = get_int(web(i).xStart/chord,web(i).xEnd/chord,1)*chord^2; %integral of airfoil futempInt160,5814
+ triangle1 = abs( (web(i).xStart - sparCaps(1).posX)*web(i).zStart/2);triangle1161,5917
+ triangle2 = abs((web(i).xEnd - sparCaps(1).posX)*web(i).zEnd/2);triangle2162,5991
+webTop = web;webTop176,6752
+web = [];web177,6766
+dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx187,6991
+webRearSpar = web;webRearSpar207,8039
+web = [];web208,8058
+numStringers = numBottomStringers;numStringers212,8082
+stringerGap = lowerStringerGap;stringerGap213,8117
+webThickness = t_lower;webThickness214,8149
+tempStringers = bottomStringers;tempStringers215,8173
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx223,8489
+ tempInt = get_int(web(i).xEnd/chord,web(i).xStart/chord,0)*chord^2; %integral of airfoil futempInt238,9196
+ triangle2 = abs((web(i).xStart - sparCaps(1).posX)*web(i).zStart/2);triangle2239,9299
+ triangle1 = abs((web(i).xEnd - sparCaps(1).posX)*web(i).zEnd/2);triangle1240,9372
+webBottom = web;webBottom256,10207
+web = [];web257,10224
+dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx267,10451
+webFrontSpar = web;webFrontSpar285,11387
+web = [];web286,11407
+numStringers = numNoseBottomStringers;numStringers294,11453
+stringerGap = lowerNoseStringerGap;stringerGap295,11492
+webThickness = t_lower_front;webThickness296,11528
+tempStringers = noseBottomStringers;tempStringers297,11558
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx305,11878
+ tempInt = get_int(web(i).xEnd/chord,web(i).xStart/chord,0)*chord^2; %integral of airfoil futempInt320,12433
+ triangle1 = abs((web(i).xStart - sparCaps(2).posX)*web(i).zStart/2);triangle1321,12536
+ triangle2 = abs((web(i).xEnd - sparCaps(2).posX)*web(i).zEnd/2);triangle2322,12609
+webLowerNose = web;webLowerNose338,13448
+web = [];web339,13468
+numStringers = numNoseTopStringers;numStringers342,13496
+stringerGap = upperNoseStringerGap;stringerGap343,13532
+webThickness = t_upper_front;webThickness344,13568
+tempStringers = noseTopStringers;tempStringers345,13598
+ dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx353,13877
+ tempInt = get_int(web(i).xStart/chord,web(i).xEnd/chord,1)*chord^2; %integral of airfoil futempInt367,14536
+ triangle2 = abs((web(i).xStart - sparCaps(2).posX)*web(i).zStart/2);triangle2368,14639
+ triangle1 = abs((web(i).xEnd - sparCaps(2).posX)*web(i).zEnd/2);triangle1369,14712
+webUpperNose = web;webUpperNose384,15474
+web = [];web385,15494
+dx = web(i).xStart-centroid.posX; dz = web(i).zStart-centroid.posZ;dx396,15722
+webFrontSparCell2 = web;webFrontSparCell2414,16666
+web = [];web415,16691
+Fx = sum([webTop.qp_dx_X])+webRearSpar.qp_dx_X+ sum([webBottom.qp_dx_X])+webFrontSpar.qp_dx_X; Fx420,16736
+Fx = Fx + sum([webLowerNose.qp_dx_X])+ sum([webUpperNose.qp_dx_X]); %cell 2Fx421,16840
+Fz = sum([webTop.qp_dz_X])+webRearSpar.qp_dz_X+ sum([webBottom.qp_dz_X])+webFrontSpar.qp_dz_X; Fz423,16920
+Fz = Fz + sum([webLowerNose.qp_dz_X])+ sum([webUpperNose.qp_dz_X]); %cell 2Fz424,17024
+Fx = sum([webTop.qp_dx_Z])+webRearSpar.qp_dx_Z+ sum([webBottom.qp_dx_Z])+webFrontSpar.qp_dx_Z; Fx430,17139
+Fx = Fx + sum([webLowerNose.qp_dx_Z])+ sum([webUpperNose.qp_dx_Z]); %cell 2Fx431,17243
+Fz = sum([webTop.qp_dz_Z])+webRearSpar.qp_dz_Z+ sum([webBottom.qp_dz_Z])+webFrontSpar.qp_dz_Z; Fz433,17323
+Fz = Fz + sum([webLowerNose.qp_dz_Z])+ sum([webUpperNose.qp_dz_Z]); %cell 2Fz434,17427
+A11 = sum([webTop.dS_over_t])+webRearSpar.dS_over_t+ sum([webBottom.dS_over_t])+webFrontSpar.dS_A11443,17597
+A22 = sum([webLowerNose.dS_over_t])+ sum([webUpperNose.dS_over_t])+webFrontSparCell2.dS_over_t;A22444,17701
+A12 = -webFrontSpar.dS_over_t;A12445,17797
+A21 = -webFrontSparCell2.dS_over_t;A21446,17828
+B1_X = sum([webTop.q_dS_over_t_X])+webRearSpar.q_dS_over_t_X+ sum([webBottom.q_dS_over_t_X])+webB1_X448,17865
+B2_X = sum([webLowerNose.q_dS_over_t_X])+ sum([webUpperNose.q_dS_over_t_X])+webFrontSparCell2.q_B2_X449,17986
+B1_Z = sum([webTop.q_dS_over_t_Z])+webRearSpar.q_dS_over_t_Z+ sum([webBottom.q_dS_over_t_Z])+webB1_Z450,18095
+B2_Z = sum([webLowerNose.q_dS_over_t_Z])+ sum([webUpperNose.q_dS_over_t_Z])+webFrontSparCell2.q_B2_Z451,18216
+Amat = [A11 A12; A21 A22];Amat453,18326
+Bmat_X = -[B1_X;B2_X];Bmat_X454,18353
+Bmat_Z = -[B1_Z;B2_Z];Bmat_Z455,18376
+qs_X = inv(Amat)*Bmat_X;qs_X457,18400
+qs_Z = inv(Amat)*Bmat_Z;qs_Z458,18425
+sum_2_a_q_X = sum([webTop.two_A_qprime_X])+webRearSpar.two_A_qprime_X+ sum([webBottom.two_A_qprisum_2_a_q_X462,18453
+sum_2_a_q_X = sum_2_a_q_X + sum([webLowerNose.two_A_qprime_X])+ sum([webUpperNose.two_A_qprime_Xsum_2_a_q_X463,18574
+sum_2_a_q_X = sum_2_a_q_X + 2*qs_X(1)*(sum([webTop.Area])+webRearSpar.Area+ sum([webBottom.Areasum_2_a_q_X464,18692
+sum_2_a_q_X = sum_2_a_q_X + 2*qs_X(2)*(sum([webLowerNose.Area])+ sum([webUpperNose.Area]));sum_2_a_q_X465,18793
+sum_2_a_q_Z = sum([webTop.two_A_qprime_Z])+webRearSpar.two_A_qprime_Z+ sum([webBottom.two_A_qprisum_2_a_q_Z467,18887
+sum_2_a_q_Z = sum_2_a_q_Z + sum([webLowerNose.two_A_qprime_Z])+ sum([webUpperNose.two_A_qprime_Zsum_2_a_q_Z468,19008
+sum_2_a_q_Z = sum_2_a_q_Z + 2*qs_Z(1)*(sum([webTop.Area])+webRearSpar.Area+ sum([webBottom.Areasum_2_a_q_Z469,19126
+sum_2_a_q_Z = sum_2_a_q_Z + 2*qs_Z(2)*(sum([webLowerNose.Area])+ sum([webUpperNose.Area]));sum_2_a_q_Z470,19227
+torque_Z = Vz*(sc.posX - 0.25*chord);torque_Z480,19547
+torque_X = -Vx*sc.posZ;torque_X481,19585
+Area1 = sum([webTop.Area]) + webRearSpar.Area + sum([webBottom.Area]);Area1484,19611
+Area1_check = get_int(frontSpar,backSpar,1)*chord^2 + get_int(frontSpar,backSpar,0)*chord^2;Area1_check486,19694
+Area2 = sum([webLowerNose.Area]) + sum([webUpperNose.Area]);Area2488,19788
+Area2_check = get_int(0,frontSpar,1)*chord^2 + get_int(0,frontSpar,0)*chord^2;Area2_check489,19849
+q1t_over_q2t = (A22/Area2 + webFrontSpar.dS_over_t/Area1)/(A11/Area1 + webFrontSpar.dS_over_t/Arq1t_over_q2t494,19984
+q2t = torque_X/(2*Area1*q1t_over_q2t + 2*Area2);q2t496,20087
+q1t = q2t*q1t_over_q2t;q1t497,20136
+qt_X = [q1t;q2t];qt_X498,20160
+q2t = torque_Z/(2*Area1*q1t_over_q2t + 2*Area2);q2t500,20179
+q1t = q2t*q1t_over_q2t;q1t501,20228
+qt_Z = [q1t;q2t];qt_Z502,20252
+xChord = 0:.01:1;xChord523,20449
+xChord = xChord*chord;xChord524,20467
+upperSurface = zeros(1,length(xChord));upperSurface525,20490
+lowerSurface = zeros(1,length(xChord));lowerSurface526,20530
+ vecX = [frontSpar*chord webTop(i).xStart webTop(i).xEnd];vecX541,20927
+ vecZ = [0 webTop(i).zStart webTop(i).zEnd];vecZ542,20988
+ vecX = [frontSpar*chord webBottom(i).xStart webBottom(i).xEnd];vecX547,21101
+ vecZ = [0 webBottom(i).zStart webBottom(i).zEnd];vecZ548,21168
+ vecX = [frontSpar*chord webUpperNose(i).xStart webUpperNose(i).xEnd];vecX553,21290
+ vecZ = [0 webUpperNose(i).zStart webUpperNose(i).zEnd];vecZ554,21363
+ vecX = [frontSpar*chord webLowerNose(i).xStart webLowerNose(i).xEnd];vecX559,21491
+ vecZ = [0 webLowerNose(i).zStart webLowerNose(i).zEnd];vecZ560,21564
+ vecX = [frontSpar*chord sparCaps(3).posX sparCaps(4).posX];vecX564,21661
+ vecZ = [0 sparCaps(3).posZ sparCaps(4).posZ];vecZ565,21724
+sparCapSize = 18;sparCapSize569,21808
+stringerSize = 18;stringerSize570,21826
+
+/home/blendux/github/UCLA_MAE_154B/gui.py,393
+import tkinter as tktk20,820
+import tkinter.ttk as ttkttk21,841
+class MainWindow(tk.Frame):MainWindow27,963
+ def __init__(self, *args, **kwargs):__init__30,1022
+ def create_window(self):create_window64,2364
+def new_field(parent, name):new_field72,2661
+def set_naca(name):set_naca80,2826
+def set_chord(name):set_chord85,2894
+def set_semi_span(name):set_semi_span90,2957
+
+/home/blendux/github/UCLA_MAE_154B/README.md,94
+# UCLA MAE 154BUCLA MAE 154B1,0
+## Spring 2019 Final ProjectSpring 2019 Final Project3,17
+
+/home/blendux/github/UCLA_MAE_154B/tools/evaluator.py,1051
+import numpy as npnp24,959
+import matplotlib.pyplot as pltplt26,1000
+class Evaluator:Evaluator29,1034
+ def __init__(self, airfoil):__init__32,1130
+ def __str__(self):__str__56,1932
+ def info_print(self, round):info_print59,1991
+ def info_save(self, save_path, number):info_save74,2570
+ def get_lift_rectangular(self, lift):get_lift_rectangular92,3362
+ def get_lift_elliptical(self, L_0):get_lift_elliptical96,3507
+ def get_lift_total(self):get_lift_total103,3719
+ def get_mass_distribution(self, total_mass):get_mass_distribution108,3900
+ def get_drag(self, drag):get_drag112,4047
+ def get_centroid(self):get_centroid124,4473
+ def get_inertia_terms(self):get_inertia_terms147,5377
+ def get_dx(self, component):get_dx180,6841
+ def get_dz(self, component):get_dz183,6940
+ def get_dP(self, xDist, zDist, V_x, V_z, area):get_dP186,7039
+ def analysis(self, V_x, V_z):analysis199,7491
+def plot_geom(evaluator):plot_geom219,8423
+def plot_lift(evaluator):plot_lift272,10194
+
+/home/blendux/github/UCLA_MAE_154B/tools/creator.py,1569
+import numpy as npnp31,1142
+import bisect as bibi33,1193
+import matplotlib.pyplot as pltplt34,1213
+class Airfoil:Airfoil37,1247
+ chord = 100chord51,1727
+ semi_span = 200semi_span52,1743
+ def __init__(self):__init__54,1764
+ def from_dimensions(cls, chord, semi_span):from_dimensions65,2007
+ def __str__(self):__str__75,2337
+ def add_naca(self, naca_num):add_naca78,2396
+ def get_camber(x):get_camber99,3112
+ def get_thickness(x):get_thickness113,3714
+ def get_theta(x):get_theta124,4162
+ def get_upper_coord(x):get_upper_coord132,4452
+ def get_lower_coord(x):get_lower_coord137,4637
+ def add_mass(self, mass):add_mass165,5804
+ def info_print(self, round):info_print168,5860
+ def info_save(self, save_path, number):info_save183,6442
+class Spar(Airfoil):Spar200,7175
+ def __init__(self):__init__203,7242
+ def add_coord(self, airfoil, x_loc_percent):add_coord211,7427
+ def add_spar_caps(self, spar_cap_area):add_spar_caps238,8357
+ def add_mass(self, mass):add_mass242,8460
+ def add_webs(self, thickness):add_webs246,8550
+class Stringer(Airfoil):Stringer257,8896
+ def __init__(self):__init__260,8975
+ def add_coord(self, airfoil,add_coord269,9188
+ def add_area(self, area):add_area329,11686
+ def add_mass(self, mass):add_mass333,11762
+ def add_webs(self, thickness):add_webs337,11873
+ def info_print(self, round):info_print347,12223
+def plot_geom(airfoil, view: False):plot_geom353,12375
+def main():main410,14137
+
+/home/blendux/github/UCLA_MAE_154B/tools/generator.py,332
+def default_airfoil():default_airfoil23,867
+class Population(creator.Airfoil):Population45,1474
+ def __init__(self, size):__init__48,1551
+ def mutate(self, prob_mt):mutate54,1720
+ def crossover(self, prob_cx):crossover57,1824
+ def reproduce(self, prob_rp):reproduce60,1923
+ def fitness():fitness63,2034
diff --git a/example_airfoil.py b/example_airfoil.py
index 0fd0aba..e0eb532 100644
--- a/example_airfoil.py
+++ b/example_airfoil.py
@@ -10,26 +10,27 @@ Generate a population of airfoils & optimize.
from tools import creator, evaluator, generator
+
import time
start_time = time.time()
-# Airfoil dimensions
+# Airfoil dimensions (in)
NACA_NUM = 2412
-CHORD_LENGTH = 68 # inches
-SEMI_SPAN = 150 # inches
+CHORD_LENGTH = 68
+SEMI_SPAN = 150
# Thicknesses
SPAR_THICKNESS = 0.4
SKIN_THICKNESS = 0.1
-# Component masses
-AIRFOIL_MASS = 10 # lbs
-SPAR_MASS = 10 # lbs
-STRINGER_MASS = 5 # lbs
+# Component masses (lbs)
+AIRFOIL_MASS = 10
+SPAR_MASS = 10
+STRINGER_MASS = 5
-# Area
-SPAR_CAP_AREA = 0.3 # sqin
-STRINGER_AREA = 0.1 # sqin
+# Area (sqin)
+SPAR_CAP_AREA = 0.3
+STRINGER_AREA = 0.1
# Amount of stringers
TOP_STRINGERS = 6
@@ -37,7 +38,7 @@ BOTTOM_STRINGERS = 4
NOSE_TOP_STRINGERS = 3
NOSE_BOTTOM_STRINGERS = 5
-SAVE_PATH = 'C:/Users/blend/github/UCLA_MAE_154B/save'
+SAVE_PATH = '/home/blendux/github/UCLA_MAE_154B/save/'
# Create airfoil instance
@@ -87,9 +88,9 @@ evaluator.plot_lift(eval)
pop = generator.Population(10)
-print(help(creator))
-print(help(evaluator))
-print(help(generator))
+# print(help(creator))
+# print(help(evaluator))
+# print(help(generator))
# Print final execution time
print("--- %s seconds ---" % (time.time() - start_time))
diff --git a/tools/creator.py b/tools/creator.py
index 01f73ad..6d074f8 100644
--- a/tools/creator.py
+++ b/tools/creator.py
@@ -37,7 +37,7 @@ import matplotlib.pyplot as plt
class Airfoil:
"""This class represents a single NACA airfoil.
- Please note: the coordinates are saved as two lists
+ The coordinates are saved as two lists
for the x- and z-coordinates. The coordinates start at
the leading edge, travel over the airfoil's upper edge,
then loop back to the leading edge via the lower edge.
@@ -69,7 +69,7 @@ class Airfoil:
else:
cls.chord = 20
print('Chord too small, using minimum value of 20.')
- cls.semi_span = semi_span
+ cls.semi_span = semi_span
return Airfoil()
def __str__(self):
@@ -175,7 +175,7 @@ class Airfoil:
for k, v in self.__dict__.items():
if type(v) != list:
print('{}:\n'.format(k), v)
- print(num_of_dashes * '-')
+ print(num_of_dashes * '-')
for k, v in self.__dict__.items():
if type(v) == list:
print('{}:\n'.format(k), np.around(v, round))
@@ -251,7 +251,7 @@ class Spar(Airfoil):
self.x_end.append(self.x[_][1])
self.z_start.append(self.z[_][0])
self.z_end.append(self.z[_][1])
- self.thickness = thickness
+ self.thickness = thickness
return None
@@ -296,8 +296,8 @@ class Stringer(Airfoil):
self.x.append(airfoil.x[i])
self.z.append(airfoil.z[i])
x += interval
- # Add upper stringers from first spar until last spar
- # TODO: stringer placement if only one spar is created
+ # Add upper stringers from first spar until last spar
+ # TODO: stringer placement if only one spar is created
interval = (airfoil.spar.x[-1][0]
- airfoil.spar.x[0][0]) / (stringer_u_2 + 1)
x = interval + airfoil.spar.x[0][0]
@@ -316,7 +316,7 @@ class Stringer(Airfoil):
self.x.append(airfoil.x[-i])
self.z.append(airfoil.z[-i])
x += interval
- # Add lower stringers from first spar until last spar
+ # Add lower stringers from first spar until last spar
interval = (airfoil.spar.x[-1][1]
- airfoil.spar.x[0][1]) / (stringer_l_2 + 1)
x = interval + airfoil.spar.x[0][1]
@@ -342,7 +342,7 @@ class Stringer(Airfoil):
self.x_end.append(self.x[_ + 1])
self.z_start.append(self.z[_])
self.z_end.append(self.z[_ + 1])
- self.thickness = thickness
+ self.thickness = thickness
return None
def info_print(self, round):
@@ -379,7 +379,7 @@ def plot_geom(airfoil, view: False):
ax.plot(x, y, '-', color='y', linewidth='4')
except AttributeError:
print('No spars to plot.')
- # Plot stringers
+ # Plot stringers
try:
for _ in range(0, len(airfoil.stringer.x)):
x = airfoil.stringer.x[_]
Copyright 2019--2024 Marius PETER