How to deduct obtained fuel value from initial weight
1 view (last 30 days)
Show older comments
Hi, the following code is the initial calculation, I have obtained the fuel consumed to climb at each altitude (53 x 1 results) (the final code), I want to deduct this fuel consumption from the weight at every altitude (the weight is denoted is W) because weight reduced as the aircraft fly.
May I know how do I code it? I heard can use for-loop with different iteration? (because I have used a for-loop for other calculation before getting onto the coding below)
Please help. Very much appreciate :)
%% Coefficient of Lift
CDO = 0.023; % Zero-lift drag coefficient
K = 0.044; % Lift-induced drag factor
MTOW = 79010; % Maximum take-off mass [kg]
W = MTOW*9.81; % Weight in N
A= Thrust_22K/W;
B = sqrt((A.^2)+(12*CDO*K));
Cl = (6*CDO)./(A+B);
%% Drag Produced
S = 125; % Wing area [m^2]
C = CDO + (K*(Cl.^2));
D = 0.5*Density_altitude.*(TAS.^2)*S.*C; % [N]
%% Power Available
P_available = TAS.*Thrust_22K;
%% Power Required
P_required = TAS.*D;
%% Excess Power
P_excess = P_available - P_required;
%% Rate of Climb (ROC)
ROC = (TAS.*(Thrust_22K - D))./W; % [m/s]
if any(ROC <=1.5)
disp('Service Ceiling.')
else
disp ('Absolute Ceiling.')
end
%% Climb Angle
X = (Thrust_22K - D)./W;
Climb_angle = asind( X ); % [Degree]
%% Time Taken to Climb
Time = Altitude./ROC; % [sec]
%% Mass Flow Rate
m_dot_f = TSFC_22K.*Thrust_22K; % [kg/s]
%% Fuel Consumed to Climb
Fuel = m_dot_f.*Time;
5 Comments
William Rose
on 21 Sep 2023
Edited: William Rose
on 21 Sep 2023
As @Dyuman Joshi pointed out, it is not clear what quantities are vectors and what quatities are scalars.
Dyuman Joshi
on 21 Sep 2023
It will be better if you can attach your whole code including values for variables, as has been mentioned before.
Accepted Answer
Torsten
on 21 Sep 2023
Edited: Torsten
on 21 Sep 2023
Most probably something like this. I don't know where you use some of the defined variables - they seem to be superfluous.
%% Coefficient of Lift
CDO = 0.023; % Zero-lift drag coefficient
K = 0.044; % Lift-induced drag factor
W(1) = MTOW*9.81; % Weight in N;
Time(1) = 0.0;
Fuel(1) = 0.0;
for i = 1:numel(Altitude)-1
A = Thrust_22K/W(i);
B = sqrt((A.^2)+(12*CDO*K));
Cl = (6*CDO)./(A+B);
%% Drag Produced
S = 125; % Wing area [m^2]
C = CDO + (K*(Cl.^2));
D = 0.5*(Density_altitude(i)+Density_altitude(i+1))/2.*(TAS.^2)*S.*C; % [N]
%% Power Available
P_available = TAS.*Thrust_22K;
%% Power Required
P_required = TAS.*D;
%% Excess Power
P_excess = P_available - P_required;
%% Rate of Climb (ROC)
ROC = (TAS.*(Thrust_22K - D))./W(i); % [m/s]
if any(ROC <=1.5)
disp('Service Ceiling.')
else
disp ('Absolute Ceiling.')
end
%% Climb Angle
X = (Thrust_22K - D)./W(i);
Climb_angle = asind( X ); % [Degree]
%% Time Taken to Climb
Time(i+1) = (Altitude(i+1)-Altitude(i))./ROC; % [sec]
%% Mass Flow Rate
m_dot_f = TSFC_22K.*Thrust_22K; % [kg/s]
%% Fuel Consumed to Climb
Fuel(i+1) = m_dot_f.*Time(i+1);
W(i+1) = W(i) - Fuel(i+1);
end
6 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!