Filter löschen
Filter löschen

How to deduct obtained fuel value from initial weight

2 Ansichten (letzte 30 Tage)
Ke Yeun Yong
Ke Yeun Yong am 21 Sep. 2023
Bearbeitet: Ke Yeun Yong am 21 Sep. 2023
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 Kommentare
William Rose
William Rose am 21 Sep. 2023
Bearbeitet: William Rose am 21 Sep. 2023
As @Dyuman Joshi pointed out, it is not clear what quantities are vectors and what quatities are scalars.
Dyuman Joshi
Dyuman Joshi am 21 Sep. 2023
It will be better if you can attach your whole code including values for variables, as has been mentioned before.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 21 Sep. 2023
Bearbeitet: Torsten am 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 Kommentare
Ke Yeun Yong
Ke Yeun Yong am 21 Sep. 2023
Bearbeitet: Ke Yeun Yong am 21 Sep. 2023
I applied your coding and i got the following error in command window;
Unable to perform assignment because the left and right sides have a different number of elements.
Error in Copy_of_Calculation_22K (line 86)
Time(i+1) = (Altitude(i+1)-Altitude(i))./ROC; % [sec]
Furthermore, the time and fuel increases with altitude so i think i dont have to do sum for them. As the calculation shows the time and fuel at each altitude and not the difference between two altitude. Please correct me if I am wrong.
Thank you.
Torsten
Torsten am 21 Sep. 2023
Bearbeitet: Torsten am 21 Sep. 2023
ROC = (TAS.*(Thrust_22K - D))./W(i); % [m/s]
Use the local value for all arrays that are part of this expression.
Maybe
ROC = TAS(i)*(Thrust_22K(i)-D)/W(i);
?
We don't know. You must use the local values (at Altitude(i+1)) everywhere where needed.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by