28
%%%%%%% UAV Weight Estimation and Sensitivity Analysis %%%%%%%%%%%% wwto=[330 440 451 418 443 584 451 339 661]; wwe=[110 220 304 275 324 328 275 200 473]; wwto=log10(wwto) wwe=log10(wwe) e1=[ones(size(wwto')) wwe']; C1=e1\wwto' %%%%%%% UAV Weight Calculations %%%%%%%%%%%% Wto =160*2.2; %%%%%%%% Wto in LB Wpl = 30*2.2; %%%%%%%%% Wpl in LB a=0.04; %%%%%%%0.05; %C1(1); %%%%0.05; %%%%%%%%%%%%%%Light Airplane - 0.114; %%%%%%%%% Regression Line b=1.086; %%%%%%%%%%1.078; %C1(2); %%%%1.078; %%%%%%%% Light Airplane 1.1162; %%%%%%%%% Regression Line Vcr=75; %%%%%%%%% in mph %%%%%%% Regression Line for Allowable Value of Empty Weight %%%%%%%%%%% log10We = (log10(Wto)- a)/b Weall=10^(log10We) %%%%%%%%%%% We in LB W1_Wto = 0.97; W2_W1 = 0.985; W3_W2 = 0.988; W4_W3 = 0.999; W6_W5 = 0.988;

Matlab codes for Sizing and Calculating the Aircraft Stability & Performance

Embed Size (px)

Citation preview

%%%%%%% UAV Weight Estimation and Sensitivity Analysis %%%%%%%%%%%%

wwto=[330 440 451 418 443 584 451 339 661];wwe=[110 220 304 275 324 328 275 200 473];

wwto=log10(wwto)wwe=log10(wwe)

e1=[ones(size(wwto')) wwe'];C1=e1\wwto'

%%%%%%% UAV Weight Calculations %%%%%%%%%%%%

Wto =160*2.2; %%%%%%%% Wto in LB

Wpl = 30*2.2; %%%%%%%%% Wpl in LB

a=0.04; %%%%%%%0.05; %C1(1); %%%%0.05; %%%%%%%%%%%%%%Light Airplane -0.114; %%%%%%%%% Regression Line

b=1.086; %%%%%%%%%%1.078; %C1(2); %%%%1.078; %%%%%%%% Light Airplane 1.1162; %%%%%%%%% Regression Line

Vcr=75; %%%%%%%%% in mph

%%%%%%% Regression Line for Allowable Value of Empty Weight %%%%%%%%%%%

log10We = (log10(Wto)- a)/b

Weall=10^(log10We) %%%%%%%%%%% We in LB

W1_Wto = 0.97;

W2_W1 = 0.985;

W3_W2 = 0.988;

W4_W3 = 0.999;

W6_W5 = 0.988;

W7_W6 = 0.995;

Rcr=960/1.6 ;%%%%%%%%%%%%% in miles

Eff_Pcr = 0.8; %%%%%%% between 0.75-0.8

Cpcr = 0.9 ; %%%%%%%%%%%%%%%%%%% Lbs/hp/hr

LDcr = 14 ; %%%%%%%%%%%% Selected According to Datcom Calculation

lnW4_W5 = Rcr/(375*(Eff_Pcr/Cpcr)*LDcr); %%%%%%%%%Breguet's Range equation for propeller driven airplanes

W5_W4 =1/exp(lnW4_W5);

Mff=W1_Wto*W2_W1*W3_W2*W4_W3*W5_W4*W6_W5*W7_W6 %%%%%%%%%%Fuel Fraction

Wfused=(1-Mff)*Wto ;%%%%%%%%%%% Used Fuel

Wf = 1.25*Wfused %%%%%%%%%%%%%%% Total Fuel Weight

Woe = Wto - Wf - Wpl ; %%%%%%%%%%%%% Operating Empty Weight

We = Woe - 0.008*Wto %%%%%%%%%%%%% Empty weight

%%%%%%%%%%%%%%%%%%%%% Sensitivity of TakeOff Weight to Payload %%%%%%%%%%%%%%%%%%%%%%%%%%%%

c=1-(1+0.25)*(1-Mff)-0.008 %%%%%%%%%%

WTO_To_WPL = b*Wto/(Wpl-c*(1-b)*Wto)

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Empty weight %%%%%%%%%%%%%%%%%%%%%%%%%

WTO_TO_WE = b*Wto/(10^((log10(Wto)-a)/b))

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Range%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

f = (-b*(Wto)^2*(1+0.25)*Mff)/(c*(1-b)*Wto-Wpl)

RR = Cpcr/(375*Eff_Pcr*LDcr);

WTO_TO_R = f*RR

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Cpcr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

WTO_TO_Cpcr = f*Rcr/(375*Eff_Pcr*LDcr)

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Propeller Efficiency %%%%%%%%%%%%%%%%%%

WTO_TO_Eff_Pcr= -f*Rcr*Cpcr/(375*(Eff_Pcr)^2*(LDcr))

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to L/D %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

WTO_TO_LDcr = -f*Rcr*Cpcr/(375*Eff_Pcr*(LDcr)^2)

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Endurance %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

EE = Vcr*Cpcr/(375*Eff_Pcr*LDcr);

WTO_TO_E = f*EE

%%%%%%% Sensitivity Analysis (Continuous) %%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%% UAV Weight Calculations %%%%%%%%%%%%

Wto = 80*2.25; %%%%%%%% Wto in LB

Wpl = 15*2.25; %%%%%%%%% Wpl in LB

Wto1=[57 77 96 115 133 150 167 184 200 217].*2.25;Wpl1=[10 15 20 25 30 35 40 45 50 55].*2.25;LD1=[10 11 12 13 14 15 16 17 18 19];

for j=1:1:10

for i=1:1:10

Wto = Wto1(i); %%%%%%%% Wto in Kg

Wpl = Wpl1(i); %%%%%%%%% Wpl in Kg

a=0.05; %%%%%%%%%%%%%%Light Airplane -0.114;%%%%%%%%% Regression Line

b=1.078; %%%%%%%% Light Airplane 1.1162; %%%%%%%%% Regression Line

Vcr=75; %%%%%%%%% in mph

%%%%%%% Regression Line for Allowable Value of Empty Weight %%%%%%%%%%%5

log10We = (log10(Wto)- a)/b;

Weall=10^(log10We) %%%%%%%%%%% We in LB

W1_Wto = 0.97;

W2_W1 = 0.997;

W3_W2 = 0.998;

W4_W3 = 0.992;

W6_W5 = 0.993;

W7_W6 = 0.993;

Rcr=960/1.6 ;%%%%%%%%%%%%% in miles

Eff_Pcr = 0.8; %%%%%%% between 0.75-0.8

Cpcr = 0.483 ; %%%%%%%%%%%%%%%%%%% Lbs/hp/hr

LDcr = 10+j ; %%%%%%%%%%%%LDcr=14 Selected According to Datcom Calculation according to the proposed platform

lnW4_W5 = Rcr/(375*(Eff_Pcr/Cpcr)*LDcr); %%%%%%%%%Breguet's Range equation for propeller driven airplanes

W5_W4 =1/exp(lnW4_W5);

Mff=W1_Wto*W2_W1*W3_W2*W4_W3*W5_W4*W6_W5*W7_W6 ; %%%%%%%%%%Fuel Fraction

Wfused=(1-Mff)*Wto ;%%%%%%%%%%% Used Fuel

Wf = 1.25*Wfused ; %%%%%%%%%%%%%%% Total Fuel Weight

Woe = Wto - Wf - Wpl ; %%%%%%%%%%%%% Operating Empty Weight

We = Woe - 0.008*Wto %%%%%%%%%%%%% Empty weight

%%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Payload %%%%%%%%%%%%%%%%%%%%%%%%%%%%

c=1-(1+0.25)*(1-Mff)-0.008 %%%%%%%%%%

WTO_To_WPL(j,i) = b*Wto/(Wpl-c*(1-b)*Wto);WTO_To_WPL_R(j,i) = (b*Wto/(Wpl-c*(1-b)*Wto))/Wto;%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Empty weight %%%%%%%%%%%%%%%%%%%%%%%%%

WTO_TO_WE(j,i) = b*Wto/(10^((log10(Wto)-a)/b));WTO_TO_WE_R(j,i) = (b*Wto/(10^((log10(Wto)-a)/b)))/Wto;%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Range%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

f = (-b*(Wto)^2*(1+0.25)*Mff)/(c*(1-b)*Wto-Wpl);

RR = Cpcr/(375*Eff_Pcr*LDcr);

WTO_TO_R(j,i) = f*RR;WTO_TO_R_R(j,i) = (f*RR)/Wto;%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Cpcr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

WTO_TO_Cpcr(j,i) = f*Rcr/(375*Eff_Pcr*LDcr);WTO_TO_Cpcr_R(j,i) =(f*Rcr/(375*Eff_Pcr*LDcr))/Wto;

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Propeller Efficiency %%%%%%%%%%%%%%%%%%

WTO_TO_Eff_Pcr(j,i)= -f*Rcr*Cpcr/(375*(Eff_Pcr)^2*(LDcr));WTO_TO_Eff_Pcr_R(j,i)= (-f*Rcr*Cpcr/(375*(Eff_Pcr)^2*(LDcr)))/Wto;

%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to L/D %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

WTO_TO_LDcr(j,i) = -f*Rcr*Cpcr/(375*Eff_Pcr*(LDcr)^2);WTO_TO_LDcr_R(j,i) = (-f*Rcr*Cpcr/(375*Eff_Pcr*(LDcr)^2))/Wto;%%%%%%%%%%%%%%%%%%%% Sensitivity of Take Off Weight to Endurance %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

EE = Vcr*Cpcr/(375*Eff_Pcr*LDcr);

WTO_TO_E(j,i) = f*EE;WTO_TO_E_R(j,i) = (f*EE)/Wto;

endend

%mesh(Wto1,LD1,WTO_To_WPL)

figure(1)surf(Wto1,LD1,WTO_To_WPL)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to PayLoad');

figure(2)surf(Wto1,LD1,WTO_TO_R)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to Range');

figure(3)surf(Wto1,LD1,WTO_TO_LDcr)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to (L/D)cr');

figure(4)surf(Wto1,LD1,WTO_TO_E)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to Endurance');

figure(5)surf(Wto1,LD1,WTO_To_WPL_R)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to PayLoad Relative to Take Off Weight');

figure(6)

surf(Wto1,LD1,WTO_TO_R_R)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to Range Relative to Take Off Weight');

figure(7)surf(Wto1,LD1,WTO_TO_LDcr_R)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to (L/D)cr Relative to Take Off Weight');

figure(8)surf(Wto1,LD1,WTO_TO_E_R)xlabel('Take off weight in LB');ylabel('L/D cruise');zlabel('Sensitivity to Endurance Relative to Take Off Weight');

%figure(1);%plot(Wto1,WTO_To_WPL)%xlabel('Take off weight in LB');%ylabel('Sensitivity to PayLoad');

%figure(2);%plot(Wto1,WTO_TO_R)%xlabel('Take off weight in LB');%ylabel('Sensitivity to Range');

%figure(3);%plot(Wto1,WTO_TO_Cpcr)%xlabel('Take off weight in LB');%ylabel('Sensitivity to Specific Fuel Consumption');

%figure(4);%plot(Wto1,WTO_TO_LDcr)%xlabel('Take off weight in LB');%ylabel('Sensitivity to (L/D)cr');

%figure(5);%plot(Wto1,WTO_TO_E)%xlabel('Take off weight in LB');%ylabel('Sensitivity to Endurance');

%%%%%%%%%%%%%% Preliminary Sizing of UAV %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%% Sizing to Take Off Distance %%%%%%%%%%%%%%%%%%%%%%%%

GL=300; %%%%%%%%%%%%%%%%%%%%%%% Ground Roll in feet..........Design Requirement

GLP=solve('0.009*x^2+4.9*x-300');%%%%%%%%%%%%%%% Calculating Take Off Parameter

TOP=GLP(2) ; %%%%%%%%%%%% Take Off Parameterrow=0.002378 ; %%%%% Slugs/Cubic ftAR=12; %%%%%%%%%%%%% Aspect RatioCD0=0.031; %%%%% at zero lift curveOswald=0.8; %%%%%%%%%%%%%Oswald Effeiciency Factor Eff_Pcr=0.8 ; %%%%%%%%%%%% Propeller Efficiencyrow_rel=0.95; %%%%%%%%%%%%%%% Relative Density at 2000 meter altitudeLDcr = 14 ; %%%%%%%%%%%% Selected According to Datcom CalculationW_P1=[1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8;1 2 3 4 5 6 7 8];

j=0;for CLmax =1.6:0.1:2.3 %%%%%%%%%%%%%%%%%%%%%%%%select CLmaxTO up to 2 in take off as it should be less than the CLmax in the normal case j=j+1; i=0;for W_S = 2:2:20 i=i+1; W_P1(i,j)=(TOP*row_rel*CLmax/W_S);

endend

W_S = 2:2:20;plot(W_S, W_P1(:,1)', W_S, W_P1(:,2)', W_S, W_P1(:,3)', W_S, W_P1(:,4)', W_S, W_P1(:,5)', W_S, W_P1(:,6)',W_S, W_P1(:,7)', W_S, W_P1(:,8)')

%%%%%%%%%%%%%% Sizing to Stall Speed %%%%%%%%%%%%%%%%%%%%%%%%

row=0.002378 ; %%%%% Slugs/Cubic ft

j=0;forVstall =60:10:90 %%%%%%%%%% km/hr j=j+1;

CLmax = 2.3;

W_S1(j)=(0.5*row*CLmax*Vstall^2)/1.204;

end

j=0;for j=0:1:3 j=j+1 i=0for i=0:1:7 i=i+1 W_S2 (i,j)=W_S1(j)endend

W_P2 = 0:10:70;plot(W_S2(:,1)', W_P2, W_S2(:,2)', W_P2, W_S2(:,3)', W_P2, W_S2(:,4)', W_P2, W_S, W_P1(:,1)', W_S, W_P1(:,2)', W_S, W_P1(:,3)', W_S, W_P1(:,4)', W_S, W_P1(:,5)', W_S, W_P1(:,6)',W_S, W_P1(:,7)', W_S, W_P1(:,8)')

%%%%%%%%%%%%%% Sizing to Landing Limits %%%%%%%%%%%%%%%%%%%%%%%%

CLmax = 2.3;row=0.002378 ; %%%%% Slugs/Cubic ftCLland=CLmax-0.2; %%%%%%%%%%% Landing Lift Coefficient CLmax=2.1

j=0;forVstall =60:10:90 %%%%%%%%%% km/hr j=j+1;

W_S10(j)=(0.5*row*CLland*(Vstall*1.3)^2)/1.204;

end

j=0;for j=0:1:3 j=j+1 i=0for i=0:1:7 i=i+1 W_S20 (i,j)=W_S10(j)endend%%%%%%%%%%%%%% Sizing to Cruise Speed %%%%%%%%%%%%%%%%%%%%%%%%

row=0.002378 ; %%%%% Slugs/Cubic ft

j=0;for Vcruise =100:10:200 %%%%%%%%%%%%%%% Vcruise in Km/hr j=j+1;

i=0;for W_S = 2:2:20 i=i+1; Ip=Vcruise/227; W_P3(i,j)=W_S/(row_rel*(Ip^3));end

endW_S = 2:2:20;%plot(W_S2(:,1)', W_P2, W_S2(:,2)', W_P2, W_S2(:,3)', W_P2, W_S2(:,4)', W_P2, W_S, W_P1(:,1)', W_S, W_P1(:,2)', W_S, W_P1(:,3)', W_S, W_P1(:,4)', W_S, W_P1(:,5)', W_S, W_P1(:,6)',W_S, W_P1(:,7)', W_S, W_P1(:,8)',W_S, W_P3(:,1)', W_S, W_P3(:,2)', W_S, W_P3(:,3)', W_S, W_P3(:,4)', W_S, W_P3(:,5)',W_S, W_P3(:,6)', W_S, W_P3(:,7)', W_S, W_P3(:,8)', W_S, W_P3(:,9)', W_S, W_P3(:,10)')

%%%%%%%%%%%%%% Sizing to Rate of Climb %%%%%%%%%%%%%%%%%%%%%%%%

row=0.002378 ; %%%%% Slugs/Cubic ftrow_rel=0.95; %%%%%%%%%% Relative densityCL32CD=(1.345*(AR*Oswald)^(3/4))/(CD0^(1/4)) j=0;for RC =0:100:600 j=j+1; RCP=RC/33000; i=0;for W_S = 2:2:20 i=i+1; W_P4=Eff_Pcr/(RCP+(W_S^0.5)/(19*CL32CD*(row_rel^0.5))) W_P5(i,j)=W_P4;end

end

W_S = 2:2:20;%plot(W_S2(:,1)', W_P2, W_S2(:,2)', W_P2, W_S2(:,3)', W_P2, W_S2(:,4)', W_P2, W_S, W_P1(:,1)', W_S, W_P1(:,2)', W_S, W_P1(:,3)', W_S, W_P1(:,4)', W_S, W_P1(:,5)', W_S, W_P1(:,6)',W_S, W_P1(:,7)', W_S, W_P1(:,8)',W_S, W_P3(:,1)', W_S, W_P3(:,2)', W_S, W_P3(:,3)', W_S, W_P3(:,4)', W_S, W_P3(:,5)',W_S, W_P3(:,6)', W_S, W_P3(:,7)', W_S, W_P3(:,8)', W_S, W_P3(:,9)', W_S, W_P3(:,10)',W_S, W_P5(:,1)', W_S, W_P5(:,2)', W_S, W_P5(:,3)', W_S, W_P5(:,4)', W_S, W_P5(:,5)', W_S, W_P5(:,6)',W_S, W_P5(:,7)')

%plot(W_S, W_P5(:,1)', W_S, W_P5(:,2)', W_S, W_P5(:,3)')

%%%%%%%%%%%%%% Sizing to of Climb Gradient %%%%%%%%%%%%%%%%%%%%%%%%

row=0.002378 ; %%%%% Slugs/Cubic ftrow_rel=0.95; %%%%%%%%%% Relative densityCL32CD=(1.345*(AR*Oswald)^(3/4))/(CD0^(1/4));

CLClimb=1.4; %%%%%%%%%%%%CL Climb=CLmax-0.2%%%%%%%%%%%CLmax for clean configuration as it is a requirementVstall=3298;%%%%%%% ft/min ===== 60 km/hrVto=1.3*Vstall%%%%%%%%%%%Consider Vto=VRoCmax

j=0;for RC =0:100:600 j=j+1; CGR=RC/Vto; CGRP=(CGR+LDcr^(-1))/(CLClimb^(0.5));

i=0;for W_S = 2:2:20 i=i+1; W_P6=(18.97*Eff_Pcr*row_rel^(0.5))/(CGRP*(W_S^(0.5))); W_P7(i,j)=W_P6;end

end

W_S =2:2:20;plot(W_S20(:,1)', W_P2, W_S20(:,2)', W_P2, W_S20(:,3)', W_P2, W_S20(:,4)', W_P2,W_S2(:,1)', W_P2, W_S2(:,2)', W_P2, W_S2(:,3)', W_P2, W_S2(:,4)', W_P2, W_S, W_P1(:,1)', W_S, W_P1(:,2)', W_S, W_P1(:,3)', W_S, W_P1(:,4)', W_S, W_P1(:,5)', W_S, W_P1(:,6)',W_S, W_P1(:,7)', W_S, W_P1(:,8)',W_S, W_P3(:,1)', W_S, W_P3(:,2)', W_S, W_P3(:,3)', W_S, W_P3(:,4)', W_S, W_P3(:,5)',W_S, W_P3(:,6)', W_S, W_P3(:,7)', W_S, W_P3(:,8)', W_S, W_P3(:,9)', W_S, W_P3(:,10)',W_S, W_P5(:,1)', W_S, W_P5(:,2)', W_S, W_P5(:,3)', W_S, W_P5(:,4)', W_S, W_P5(:,5)', W_S, W_P5(:,6)',W_S, W_P5(:,7)',W_S, W_P7(:,1)', W_S, W_P7(:,2)', W_S, W_P7(:,3)', W_S, W_P7(:,4)', W_S, W_P7(:,5)', W_S, W_P7(:,6)',W_S, W_P7(:,7)')grid onxlim([2 20]);ylim([2 30]);set(gca,'XTick',1:1:20)set(gca,'YTick',1:1:30)xlabel('Wing Loading lb/ft2');ylabel('Power Loading lb/hr');title('Matching Graph');

%%%%%%%%%%%%%%%%%%% Performance Program to calculate the Flight%%%%%%%%%%%%%%%%%%% Stability Derivatives of the Final Platform without %%GimbalCLP=[-0.008304 -0.008555 -0.008720 -0.008913 -0.009090 -0.009250 -0.009392 -0.009517 -0.009600 -0.009699 -0.008722 -0.004094 -0.003643 -0.002706];

CNR=[-0.001342 -0.001365 -0.001381 -0.001401 -0.001426 -0.001455 -0.001488 -0.001526 -0.001585 -0.001616 -0.001788 -0.002072 -0.002086 -0.002098];

CM=[0.0632 0.0642 0.0382 0.0323 0.0271 0.0204 0.0131 0.0056 -0.0004 -0.0103 -0.0346 -0.1037 -0.1088 -0.1141];

CMA=[-0.005988 -0.008453 -0.007224 -0.005474 -0.005967 -0.006980 -0.007399 -0.007662 -0.007903 -0.008077 -0.009225 -0.01029 -0.01038 -0.01076];

CLB=[-0.001326 -0.001319 -0.001316 -0.001313 -0.001310 -0.001308 -0.001307 -0.001305 -0.001304 -0.001303 -0.001300 -0.001232 -0.001222 -0.001211];

%%%%%%%%%%%%%%%%%%% Stability Derivatives of the Final Platform with Gimbal

CLP1=[-0.008306 -0.008556 -0.008720 -0.008913 -0.009089 -0.009248 -0.009390 -0.009515 -0.009598 -0.009697 -0.008721 -0.004099 -0.003648 -0.002712];

CNR1=[-0.001519 -0.001544 -0.001562 -0.001584 -0.001609 -0.001639 -0.001673 -0.001712 -0.001745 -0.001804 -0.001977 -0.002260 -0.002274 -0.002286];

CM1=[0.0733 0.0546 0.0443 0.0367 0.0302 0.0227 0.0141 0.0053 -0.0017 -0.0132 -0.0432 -0.1174 -0.1229 -0.1285];

CMA1=[-0.007302 -0.009955 -0.008920 -0.007031 -0.007006 -0.008051 -0.008681 -0.008964 -0.009207 -0.009561 -0.01078 -0.01116 -0.01113 -0.01128];

CLB1=[-0.001383 -0.001368 -0.001360 -0.001353 -0.001347 -0.001341 -0.001335 -0.001329 -0.001325 -0.001319 -0.001304 -0.001213 -0.001201 -0.001188];

%%%%%%%%%%%%%%%%%%% Equilibrium Diagram at different Re numbers....

%%%%%%%%%%%%%%%%%%%% CL, CD for different Re numbers / from DATCOM resultsAlfa=[-3 -1 0 1 2 3 4 5 5.8 7 10 16 16.5 17 18 19]'; %%%% AOA up to Maximum Lift CoefficientAlfa_1=[-3 -1 0 1 2 3 4 5 5.8 7 10 16 16.5 17 18 19]'; %%%%%%%%% AOA up to stall curveAlfa_2=[-3 -1 0 1 2 3 4 5 5.8 7 10 16 16.5 17]'; %%%%%%%%% AOA up to stall curve

CD=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];CL=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];%%%%%%%%%%%%% Re number < 700000CD0=[0.025 0.024 0.024 0.025 0.027 0.029 0.033 0.036 0.040 0.046 0.066 0.107 0.110 0.112 0.115 0.111]';CL0=[-0.132 0.053 0.147 0.242 0.339 0.438 0.539 0.641 0.722 0.850 1.166 1.598 1.620 1.639 1.656 1.599]';%%%%%%%%%%%%% Re number < 1400000CD1=[0.022 0.021 0.021 0.022 0.024 0.027 0.030 0.033 0.037 0.043 0.064 0.104 0.107 0.109 0.112 0.108]';CL1=[-0.132 0.053 0.147 0.242 0.339 0.438 0.539 0.641 0.722 0.850 1.167 1.598 1.620 1.639 1.656 1.599]';%%%%%%%%%%%%% Re number < 3000000CD2=[0.020 0.019 0.020 0.021 0.022 0.025 0.028 0.032 0.035 0.041 0.062 0.102 0.105 0.107 0.110 0.106]';CL2=[-0.132 0.053 0.147 0.243 0.340 0.440 0.541 0.644 0.742 0.852 1.170 1.600 1.622 1.641 1.653 1.596]';%%%%%%%%%%%%% Re number < %%%%%%%%%%%%CD3=[0.025 0.024 0.024 0.025 0.027 0.029 0.033 0.036 0.040 0.046 0.066 0.107 0.110 0.112 0.115 0.111]';CL3=[-0.132 0.053 0.147 0.242 0.339 0.438 0.539 0.641 0.722 0.850 1.166 1.598 1.620 1.639 1.656 1.599]';%%%%%%%%%%%%% Re number < %%%%%%%%%%%%CD4=[0.025 0.024 0.024 0.025 0.027 0.029 0.033 0.036 0.040 0.046 0.066 0.107 0.110 0.112 0.115 0.111]';CL4=[-0.132 0.053 0.147 0.242 0.339 0.438 0.539 0.641 0.722 0.850 1.166 1.598 1.620 1.639 1.656 1.599]';

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Array DefinitionsD=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];TAS=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];%CLCD=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];P_av=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];P_av_1=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];P_req=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];

%%%%%%%%%%%%%%% Efficiency of Propeller versus Advance Ratio

J_R=[0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3]';Eta_R=[0.48 0.6 0.7 0.8 0.9 0.97 1 0.95 0.85 0.6]';e3=[ones(size(J_R)) J_R J_R.^2 J_R.^3 J_R.^4];C3=e3\Eta_R;

z=polyfit(J_R,Eta_R,10)

%%%%%%%%%%%% Engine Design DataJ_Design=30/(7600*0.66); %%%%%%%%%% Advance Ratio at design conditionEff_Design=0.7; %%%%%%%%%%%%%%%% Efficiency at design conditionbhp_sl=28; %%%%%%%%%%%%%%%% Brake Power at sea level

%%%%%%%%%%%%%%%%%%%%% Input Conditions%%%%H=0; %%%%% Altitude in KmMAC=0.59; %%%%%%%% m Mean Aerodynamic ChordMTOW=160; %%%% Kg Maximum Take Off Weight of the UAV CLMAX=2.3; %%%%%%% Maximum Lift Coefficient with flapsCLMAX_noflaps=2.3; %%%%%%% Maximum Lift Coefficient without flaps / sometimes with flapsS=4.1; %%%%%%%%%% m^2 Wing Area%%%row=1.225; %%%%%%%%%% Kg/m^3 Density at Sea LevelP0=101325; %%%%% Pa Pressure at Sea Level ISAT0=288.15; %%%%% deg K Temperature at Sea Level ISAg=9.80665; %%%%% m/s^2 gravityL=6.5; %%%% deg K/Km Lapse rateR=8.31432; %%%%% J/mol*deg K Gas ConstantM=28.9644; %%%%%%%%%% gm/mol Molecular Weightmiu=0.0000178934; %%%%%%%%%%%%%% Air ViscosityP_Dyn_Max=0.5*1.225*40*40; %%%%%%%%%%%% Pa Max Dynamic Pressure at Sea Level %%% 3 times the selected wing loading (980 Pa)

x0=0;x1=0;x2=0;x3=0;x4=0;x5=0;x6=0;x7=0;x11=0;x12=0;x13=0;u=0;q=0;for H=0:0.125:10 %%%%%%%%%%%%%%% change 0.125 to 0.5 for EFDq=q+1%%%%%%%%%%%%% Pressure, Temperature and Density Calculation at ISA

T=T0-L*H;P=P0*(1-((L*H)/T0))^((g*M)/(R*L));row=(P*M)/(R*T*1000);

bhp=bhp_sl*((row/1.225)-((1-row/1.225))/7.55);

v_stall=((2*MTOW*g)/(row*S*CLMAX_noflaps))^(0.5)

for i=1:1:640

%%%%%%%%%%% Speed Increment

TAS(i)=2+0.0625*i;

%%%%%%%%%%% Load Factor / Stalling Limit Calculation %%%%%%%%%%%%%%%%

n(i,q)=(TAS(i)/v_stall)^2;

%%%%%%%%%%% Re number Calculation %%%%%%%%%%%%%%%%

Re=(row*TAS(i)*MAC)/miu

if Re < 700000 %Rule

CL=CL0; CD=CD0;

elseif Re < 1400000 CL=CL1; CD=CD1;

elseif Re < 3000000 CL=CL2; CD=CD2; endj=0;for j=1:1:16

CLCD0(j)=CL0(j)/CD0(j);CLCD1(j)=CL1(j)/CD1(j);CLCD2(j)=CL2(j)/CD2(j);end

e1=[ones(size(Alfa)) Alfa]; C1=e1\CL;

e2=[ones(size(Alfa)) CL.^2]; C2=e2\CD;

%%%%%%%%%%%%%%%% Calculating Required and Available Power

CL_Cal=MTOW*9.8/(0.5*row*TAS(i)^2*S);CD_Cal=[1 CL_Cal^2]*C2;

J_R_Cal=(TAS(i)/(7600*0.66))/J_Design;Eta_R_Cal=[1 J_R_Cal J_R_Cal^2 J_R_Cal^3 J_R_Cal^4]*C3;

Eta_R_Cal_1=polyval(z,J_R_Cal);

Eta_Cal=Eta_R_Cal*Eff_Design; Eta_Cal_1=Eta_R_Cal_1*Eff_Design;

P_av(i)=Eta_Cal*bhp*743; P_av_1(i)=Eta_Cal_1*bhp*743;

D(i)=0.5*row*TAS(i)^2*S*CD_Cal*1.5;%%%%%%%%%%%%%%%%%%%%%%%%% Adding 50% extra of total drag due to landing gear and antennas

P_req(i)=D(i)*TAS(i);

if abs(P_av(i) - P_req(i)) < 10 u=u+1; V_H(u,1)=TAS(i); V_H(u,2)=H;elseend

P_av_H(i,q)=P_av(i);P_req_H(i,q)=P_req(i);

T_av_H(i,q)=P_av(i)/TAS(i);

%%%%%%%%%%% Maximum Load Factor Limit %%%%%%%%%%%%%%%%

C16=(0.5*row*((TAS(i))^2)*S)/(C2(2)*MTOW*g);C71=(0.5*row*((TAS(i))^2)*S*C2(1))/(MTOW*g);

n_max(i,q)=(C16*((T_av_H(i,q)/(MTOW*g))-C71))^(0.5);

r_min(i,q)=(4*C2(2)*(MTOW*g/S))/(g*row*(T_av_H(i,q)/(MTOW*g))*(1-(4*C2(2)*C2(1)/((T_av_H(i,q)/(MTOW*g))^2)))^(0.5));

n_r_min(i,q)=(2-(4*C2(2)*C2(1))/(T_av_H(i,q)/(MTOW*g))^2)^(0.5);

CL_r_min(i,q)=(n_r_min(i,q)*MTOW*g)/(0.5*row*(TAS(i))^2*S);

Fai_r_min(i,q)=57.3*acos(1/n_r_min(i,q));

TAS_r_min(i,q)=((4*C2(2)*(MTOW*g/S))/(row*(T_av_H(i,q)/(MTOW*g))))^(0.5);

%%%%%%%%%%%%% Correct Turn Caculation

Thrust(i)=TAS(i)*10;

r_min1(i,q)=(4*C2(2)*(MTOW*g/S))/(g*row*(Thrust(i)/(MTOW*g))*(1-(4*C2(2)*C2(1)/((Thrust(i)/(MTOW*g))^2)))^(0.5));

n_r_min1(i,q)=(2-(4*C2(2)*C2(1))/(Thrust(i)/(MTOW*g))^2)^(0.5);

Fai_r_min1(i,q)=57.3*acos(1/n_r_min1(i,q));

TAS_r_min1(i,q)=((4*C2(2)*(MTOW*g/S))/(row*(Thrust(i)/(MTOW*g))))^(0.5);

CL_r_min1(i,q)=(n_r_min1(i,q)*MTOW*g)/(0.5*row*(TAS_r_min1(i,q))^2*S);

%%%%%%%%%%% Minimum Time Trajectory

P_Excess_Sp=(P_av(i)-P_req(i))/(MTOW*9.8);

ifP_Excess_Sp< 1 &&P_Excess_Sp>0.5x0=x0+1; V_H_8(x0,1)=TAS(i); V_H_8(x0,2)=H; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

ifP_Excess_Sp< 2 &&P_Excess_Sp>1.5x2=x2+1; V_H_3(x2,1)=TAS(i); V_H_3(x2,2)=H; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

ifP_Excess_Sp< 3 &&P_Excess_Sp>2.5x3=x3+1; V_H_4(x3,1)=TAS(i); V_H_4(x3,2)=H; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; else

end

ifP_Excess_Sp< 4 &&P_Excess_Sp>3.5x4=x4+1; V_H_5(x4,1)=TAS(i); V_H_5(x4,2)=H; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

ifP_Excess_Sp< 5 &&P_Excess_Sp>4.5x5=x5+1; V_H_6(x5,1)=TAS(i); V_H_6(x5,2)=H; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

ifP_Excess_Sp< 6 &&P_Excess_Sp>5.5x6=x6+1; V_H_7(x6,1)=TAS(i); V_H_7(x6,2)=H; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

end

%%%%%%%%%%%%%Maximum Dynamic Pressure Limit

V=((2*P_Dyn_Max)/row)^(0.5);

V_H_1(q,1)=V;V_H_1(q,2)=H;

%%%%%%%%%%%%% Stalling LimitV_min=((2*MTOW*9.8)/(row*CLMAX*S))^(0.5);

V_H_2(q,1)=V_min;V_H_2(q,2)=H;

%%%%%%%%%%%%%%%%%%%%%% Performance Figures

%figure(1)%plot(TAS,D)%xlabel('TAS');%ylabel('Drag');

%figure(2)%plot(Alfa,CL,Alfa,e1*C1)%xlabel('Alfa');%ylabel('CL');

%figure(3)%plot(Alfa,CLCD)%xlabel('Alfa');%ylabel('CL/CD');

%figure(4)%plot(TAS,P_av,TAS,P_req)%xlabel('TAS');%ylabel('Power');

end

%%%%%%%%%%%%% Aircraft Energy Lines

for z=0:0.0625:10

for i=1:1:2640TAS1(i)=0+0.0625*i;AC_Energy=z*1000+(0.5*TAS1(i)*TAS1(i))/g;

ifAC_Energy< 1040 &&AC_Energy>960x1=x1+1;

V_H_80(x1,1)=TAS1(i); V_H_80(x1,2)=z; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

ifAC_Energy< 3040 &&AC_Energy>2960x11=x11+1;

V_H_801(x11,1)=TAS1(i); V_H_801(x11,2)=z; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H;

elseend

ifAC_Energy< 5040 &&AC_Energy>4960x12=x12+1;

V_H_802(x12,1)=TAS1(i); V_H_802(x12,2)=z; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

ifAC_Energy< 7040 &&AC_Energy>6960x13=x13+1;

V_H_803(x13,1)=TAS1(i); V_H_803(x13,2)=z; %P_Excess_Sp(i+(q-1)*640,1)=(P_av(i)-P_req(i))/(MTOW*9.8); %P_Excess_Sp(i+(q-1)*640,2)=TAS(i); %P_Excess_Sp(i+(q-1)*640,3)=H; elseend

endend

figure(3)plot(Alfa,CLCD0,Alfa,CLCD1,Alfa,CLCD2)xlabel('Alfa (deg)');ylabel('CL/CD');

figure(4)plot(TAS,P_av_H(:,1)',TAS,P_req_H(:,1)',TAS,P_av_H(:,2)',TAS,P_req_H(:,2)',TAS,P_av_H(:,3)',TAS,P_req_H(:,3)',TAS,P_av_H(:,4)',TAS,P_req_H(:,4)',TAS,P_av_H(:,5)',TAS,P_req_H(:,5)',TAS,P_av_H(:,6)',TAS,P_req_H(:,6)',TAS,P_av_H(:,7)',TAS,P_req_H(:,7)',TAS,P_av_H(:,8)',TAS,P_req_H(:,8)',TAS,P_av_H(:,9)',TAS,P_req_H(:,9)',TAS,P_av_H(:,10)',TAS,P_req_H(:,10)',TAS,P_av_H(:,11)',TAS,P_req_H(:,11)',TAS,P_av_H(:,12)',TAS,P_req_H(:,12)',TAS,P_av_H(:,13)',TAS,P_req_H(:,13)',TAS,P_av_H(:,14)',TAS,P_req_H(:,14)',TAS,P_av_H(:,15)',TAS,P_req_H(:,15)',TAS,P_av_H(:,16)',TAS,P_req_H(:,16)',TAS,P_av_H(:,17)',TAS,P_req_H(:,17)',TAS,P_av_H(:,18)',TAS,P_req_H(:,18)',TAS,P_av_H(:,19)',TAS,P_req_H(:,19)',TAS,P_av_H(:,20)',TAS,P_req_H(:,20)')xlabel('TAS (m/s)');ylabel('Power (watt)');

figure(5)plot(V_H(:,1),V_H(:,2),'*',V_H_1(:,1),V_H_1(:,2),'o',V_H_2(:,1),V_H_2(:,2),'o')xlabel('TAS (m/s)');ylabel('Altitude (m)');

figure(6)plot(V_H_1(:,1),V_H_1(:,2),'o')xlabel('TAS (m/s)');ylabel('Altitude (m)');

figure(7)plot(Alfa, CL0, Alfa, CL1, Alfa, CL2)xlabel('Angle of Attack (deg)');ylabel('CL');

figure(8)plot(CD0, CL0, CD1, CL1, CD2, CL2)xlabel('CD');ylabel('CL');

figure(9)plot(V_H_3(:,1)',V_H_3(:,2)','*',V_H_4(:,1)',V_H_4(:,2)','*',V_H_5(:,1)',V_H_5(:,2)','*',V_H_6(:,1)',V_H_6(:,2)','*',V_H_7(:,1)',V_H_7(:,2)','*',V_H_8(:,1)',V_H_8(:,2)','*',V_H_80(:,1)',V_H_80(:,2)','-',V_H_801(:,1)',V_H_801(:,2)','-',V_H_802(:,1)',V_H_802(:,2)','-',V_H_803(:,1)',V_H_803(:,2)','-')xlabel('TAS (m/s)');ylabel('Altitude (Km)');

figure(10)plot(TAS,n(:,1)',TAS,n(:,2)')xlabel('TAS (m/s)');ylabel('Load Factor ');

figure(11)plot(TAS,n(:,1)',TAS,n_max(:,1)',TAS,n(:,21)',TAS,n_max(:,21)',TAS,n(:,41)',TAS,n_max(:,41)',TAS,n(:,61)',TAS,n_max(:,61)',TAS,n(:,81)',TAS,n_max(:,81)')xlabel('TAS (m/s)');ylabel('Load Factor ');

figure(12)plot(Alfa_2,CMA1,Alfa_2,CMA)xlabel('Angle of Attack (deg)');ylabel('CMA1 ');

figure(13)plot(Alfa_2,CM1,Alfa_2,CM)xlabel('Angle of Attack (deg)');ylabel('CM ');

figure(14)plot(Alfa_2,CNR1,Alfa_2,CNR)xlabel('Angle of Attack (deg)');ylabel('CNR ');

figure(15)

plot(Alfa_2,CLP1,Alfa_2,CLP)xlabel('Angle of Attack (deg)');ylabel('CLP ');

figure(16)plot(Alfa_2,CLB1,Alfa_2,CLB)xlabel('Angle of Attack (deg)');ylabel('CLB ');

figure(17)plot(TAS,r_min(:,1)',TAS,(n_r_min(:,1)*10)',TAS,(CL_r_min(:,1)*10)',TAS,Fai_r_min(:,1)',TAS,TAS_r_min(:,1)')%plot(TAS_r_min(:,1)',r_min(:,1)',TAS_r_min(:,1)',(n_r_min(:,1)*10)',TAS_r_min(:,1)',(CL_r_min(:,1)*10)',TAS_r_min(:,1)',Fai_r_min(:,1)')xlabel('TAS (m/s)');ylabel('Minimum Turn Radius ');

figure(18)%plot(TAS,r_min(:,1)',TAS,(n_r_min(:,1)*10)',TAS,(CL_r_min(:,1)*10)',TAS,Fai_r_min(:,1)',TAS,TAS_r_min(:,1)')plot(Thrust',r_min1(:,1)',Thrust',(n_r_min1(:,1)*10)',Thrust',(CL_r_min1(:,1)*10)',Thrust',Fai_r_min1(:,1)',Thrust',TAS_r_min1(:,1)')xlabel('TAS (m/s)');ylabel('Minimum Turn Radius ');