我正在尝试使用以下等式计算9x1阵列的Ct值。我已编辑了我的问题以显示我当前的代码:
% Inputs
R=0.4; % Radius of Rotor
B=3; % Number of blades
V=2; % Fluid velocity
Rho=998; % Fluid Density
N=9; % Number of Blade Elements
Cp_estimate=0.5; % Estimate power coefficient
Alpha_design=4; % Design alpha
Cl_design=1; % Design lift coefficient
% Variables
TSR=1; % Initial tip speed ratio
Cp=0; % Initial power coefficient
i=1; % Counter
alpha_new=0; % Initial value for alpha new
axial_induction=0; % Initial axial induction factor
tolerance=0.01; % Tolerance Value
Check=1; % Initial check value
axial_induction_old=0; % Initial value for old axial induction factor
Cl=[1.3; 1.1; 1; 0.9; 0.86; 0.83; 0.8; 0.75; 0.5]; % Lift Coefficients
Cd=[0.027; 0.024; 0.02; 0.019; 0.018; 0.016; 0.013; 0.012; 0.01]; % Drag Coefficients
r_local=R/N*(1:9)';
r_over_R=r_local / R;
for TSR=1:10 % TSR from 1 to 10
disp(TSR)
Check=1;
Cp=0;
while abs(Check)>=tolerance
TSR_local=r_over_R .* TSR;
Phi=(2/3)*atan(1./TSR_local);
C=((8*pi.*r_local) ./ (B.*Cl_design)).*(1-cos(Phi));
sigma=(B*C) ./ (pi.*r_local.*2);
axial_induction= 1 ./ (((4.*(sin(Phi).^2)) ./ (sigma.*Cl_design.*cos(Phi)))+1);
angular_induction= (1-(3*axial_induction)) ./ ((4.*axial_induction)-1);
axial_induction_old = axial_induction;
TSR_local = TSR .* (r_local./R); % Local Tip Speed Ratio
Phi = (2/3) .* atan(1./TSR_local); % Angle of Relative Fluid
relative_wind = atan((1-axial_induction) ./ ((1+angular_induction) .* TSR));
F=(2/pi) .* acos(exp(-(((B/2) .* (1-(r_over_R))) ./ ((r_over_R) .* sin(relative_wind))))); % Tip Loss Factor
C_T=(sigma .* ((1-axial_induction).^2) .* ((Cl.*cos(relative_wind))+(Cd.*sin(relative_wind)))) ./ ((sin(relative_wind)).^2);
for i=1:length(C_T)
if C_T(i)<=0.96
axial_induction(i)=1 ./ (1+(4.*F.*(sin(relative_wind).^2)) ./ (sigma.*Cl.*cos(relative_wind)));
elseif C_T(i)>0.96
axial_induction(i)=1 ./ (((4.*F.*cos(relative_wind)) ./ (sigma.*Cl))-1);
end
end
D=(8./(TSR.*N)).*(F.*(sin(Phi).^2).*(cos(Phi)-((TSR_local).*(sin(Phi)))).*(sin(Phi)+((TSR_local).*(cos(Phi)))).*(1-(Cd./Cl).*atan(Phi)).*(TSR_local.^2));
Cp=sum(D);
Diff=axial_induction-axial_induction_old;
Check=max(Diff(:));
end
store_Phi(:,TSR)=Phi;
store_TSR_local(:,TSR)=TSR_local;
store_axial_induction(:,TSR)=axial_induction;
store_angular_induction(:,TSR)=angular_induction;
store_relative_wind(:,TSR)=relative_wind;
store_Check(:,TSR)=Check;
store_Diff(:,TSR)=Diff;
store_Cp(:,TSR)=Cp;
store_TSR(:,TSR)=TSR;
end
根据计算的CT值是大于还是小于0.96,您可以看到轴向感应方程的变化。但是我不确定我的if else声明,因为它似乎不起作用?有人可以帮帮我吗?
答案 0 :(得分:0)
如果要将9x1矩阵中的每个单独数字与0.96进行比较,则需要for
循环。如果您包括C_T
也可以是0.96的可能性,它将被简化为
for i=1:length(C_T)
if C_T(i) <= 0.96;
axial_induction(i) = 1 / (1+(4*F(i)*(sin(relative_wind(i))^2)) / (sigma(i)*Cl(i)*cos(relative_wind(i))));
else % C_T(i) > 0.96
axial_induction(i) = 1 / (((4*F(i)*cos(relative_wind(i))) / (sigma(i)*Cl(i)))-1);
end;
end;
答案 1 :(得分:0)
对于循环方法,请查看solution。
你可以像这样对这部分代码进行矢量化,这看起来与你原来的一样 -
axial_induction1 = 1 ./ (1+(4.*F.*(sin(relative_wind).^2)) ./ (sigma.*Cl.*cos(relative_wind)));
axial_induction2 = 1 ./ (((4.*F.*cos(relative_wind)) ./ (sigma.*Cl))-1);
cond1 = C_T<=0.96
axial_induction = cond1.*axial_induction1 + ~cond1.*axial_induction2
希望它适合你!