Carpet plot for engine design variables

조회 수: 11 (최근 30일)
Carlos Torelli
Carlos Torelli 2023년 11월 13일
답변: prabhat kumar sharma 2023년 11월 27일
I need to create a carpet plot for to determine how variations in pif pic and alpha ffect f/mdot and tsfc where design variables pic and alpha are varied for a constant value of pif, I have coded all the caculations but so far have been unable to create any carpet plots. code below for reference:
clc, clear
%% Listing/Defining Constants:
M_o = 0.6;
Alt = 65000;
T_o = 390;
P_o = 118.9;
gc = 32.2;
M_9 = 1; %choked
M_19 = 1; %choked
T_n = 1; %adiabatic
Tau_d = 1;
%Specific Heats
Cpc = 0.24; Cpt = 0.295;
%values of Gamma
gamma_c = 1.4; gamma_t = 1.33;
Tt4_max = 3200;
Q_r = 18400;
%Pressure Ratios
Pi_d_max = 0.98; Pi_b = 0.98; Pi_n = 0.995; Pi_fn = 0.98;
%Polytropic Efficiencies
e_c = 0.9; e_f = 0.89; e_t = 0.91;
%Adiabatic Efficiencies
n_b = 0.99; n_m = 0.995;
%Design variables to be varied (Adjusted Increments in order to properly match all vector lengths)
Pi_c = [20:6:50];
Pi_f = [1.8:0.24:3];
alpha = [1:1.6:9];
%% Calculations:
Tau_r = 1 + ((gamma_c-1)/2)*M_o^2;
Pi_r = Tau_r^(gamma_c/(gamma_c-1));
a_o = sqrt((gamma_c-1)*Cpc*T_o*gc*778.16);
V_o = M_o*a_o;
%Calculation of Temperature Ratios:
Tau_lam = (Cpt*Tt4_max)/(Cpc*T_o);
Tau_c = Pi_c.^((gamma_c-1)/(gamma_c*e_c)); %calculated for each value of Pi_f using Vector
Tau_f = Pi_f.^((gamma_c-1)/(gamma_c*e_f));
f = (Tau_lam-(Tau_r*Tau_c))/((Q_r*n_b)/(Cpc*T_o) - Tau_lam);
Tau_t = 1- (Tau_r.*((Tau_c-1) + alpha.*(Tau_f-1)))./(n_m*(1+f)*Tau_lam);
Pi_t = Tau_t.^(gamma_t/((gamma_t-1)*e_t));
%Chain Rule
format short g %I dont like seeing them in scientific notation
%P9 Calculation
Pt_9 = P_o*Pi_r*Pi_d_max*Pi_c*Pi_b.*Pi_t*1*Pi_n;
P_9 = Pt_9/(1+ ((gamma_t-1)/2)*M_9^2 )^(gamma_t/(gamma_t-1));
%T9 Calculation
T_9 = (T_o*(Cpc/Cpt)*Tau_lam*Tau_t*T_n)/(1+ ((gamma_t-1)/2)*M_9^2 );
% speed of sound at station 9 = V9 bc mach9 = 1
a_9 = sqrt( (gamma_t-1)*Cpt*T_9*gc*778.16 );
V_9 = a_9;
%Bypass Fan duct
%P19 T19 Calculations
Pt_19 = P_o*Pi_r*Pi_d_max*Pi_f*Pi_fn;
P_19 = Pt_19/ ( (1+ ((gamma_c-1)/2)*M_19^2 ) )^(gamma_c/(gamma_c-1));
T_19 = (T_o*Tau_r*Tau_d*Tau_f)/(1+ ((gamma_c-1)/2)*M_19^2 );
%Velocity in fan duct
a_19 = sqrt( (gamma_c-1)*Cpc*T_19*gc*778.16 );
V_19 = a_19; %because Mach19 = 1 choked
%Specific thrust and TSFC calculations
Specific_Thrust = ( (1+f).*V_9 - V_o + alpha.*(V_19 - V_o) )./( (1+alpha)*a_o );
TSFC = (f*gc)./ ( (1+alpha).*Specific_Thrust );
%M dot calculation
F_Over_Mdot = Specific_Thrust*a_o.*(1+alpha);
%% Carpet Plots:
  댓글 수: 2
Image Analyst
Image Analyst 2023년 11월 13일
I don't see any plotting routines executed by your code, and so no plots are generated.
Carlos Torelli
Carlos Torelli 2023년 11월 13일
all previous plots have failed so they have been omitted

댓글을 달려면 로그인하십시오.

답변 (1개)

prabhat kumar sharma
prabhat kumar sharma 2023년 11월 27일
Hello Carlos,
I found there no code piece is written to create any chart or graph. I have tried plotting using the below code. Here you can update the assignments of variables according to your requirements.
%% Carpet Plots:
% Create a grid of Pi_c and Pi_f
[Pi_c_grid, Pi_f_grid] = meshgrid(Pi_c, Pi_f);
% Calculate f/mdot and TSFC for each combination of Pi_c and Pi_f
F_Over_Mdot = zeros(length(Pi_f), length(Pi_c));
TSFC = zeros(length(Pi_f), length(Pi_c));
for i = 1:length(Pi_f)
for j = 1:length(Pi_c)
% Perform the necessary calculations using Pi_c_grid(i, j), Pi_f_grid(i, j), and alpha
% Example:
F_Over_Mdot(i, j) =length(Pi_f) % calculation for f/mdot
TSFC(i, j) = length(Pi_c) % calculation for TSFC
end
end
% Creating the carpet plot for f/mdot
figure;
surf(Pi_c_grid, Pi_f_grid, F_Over_Mdot, 'EdgeColor', 'none');
xlabel('Pi_c');
ylabel('Pi_f');
zlabel('f/mdot');
title('Carpet Plot for f/mdot');
% Creating the carpet plot for TSFC
figure;
surf(Pi_c_grid, Pi_f_grid, TSFC, 'EdgeColor', 'none');
xlabel('Pi_c');
ylabel('Pi_f');
zlabel('TSFC');
title('Carpet Plot for TSFC');
I hope it helps!

카테고리

Help CenterFile Exchange에서 Guidance, Navigation, and Control (GNC)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by