- #1
strive
- 51
- 4
Hi
I have written a set of equations for rocket flight (below) as i need to know the final altitude at various configurations (fuel mass/payload/exhaust mass flow/thrust).
I would ask if someone can please verify if this is correct (i have compared the results to results gained from Tsiolkovsky equation but it is difficult to approximate varying Isp with altitude and to include drag). Although the results are near.
I am calculating iteratively because i need to know the following parameters at 1 second intervals: vehicle velocity, acceleration, altitude and mass.
I know i should be using natural logarithm for mass ratios, but at 100 steps per second i postulated the error is negligible (a max error of 2% is allowed).
The equations in question are blue, the rest is just the programs structure (it's matlab/octave syntax).
Atmospheric conditions for each iteration are derived by a large number of equations which i have already verified thus i have not included them.m0=1100; % initial rocket mass [kg/s]
masso=500; % initial oxidator mass [kg]
massouto=6; % oxidator consumption [kg/s]
massoutg=1.5; % fuel consumption [kg/s]
massout=massouto+massoutg; % total propellant consumption [kg/s]
flightdur=(masso)/massouto % time of powered flight
t=0.01; % timestep
Rmax=0.826; % max vessel radius [m]
A=pi*Rmax^2; % max vessel cross-section [m2]
R=287; % air gas constant [J/kgK]
h0=0; % starting altitude [m]
T0=288.15; % temperature at 0m isa [K]
v0=0; % starting velocity [m/s]
g=9.81; % starting gravitational acceleration [m/s^2]
Cd1=0.015; % subsonic drag coefficient [/]
Cd2=0.04; % supersonic drag coefficient [/]
Xtotal=flightdur/t; % total number of timesteps [/]
% START CONDITIONS--------------------------------------------------------------
m=m0;
s=h0;
v=v0;
% TIMESTEP EQUATION BLOCK-------------------------------------------------------
for i=1:Xtotal
TIME=t*i;
%%% CALCULATION OF ATMOSPHERIC CONDITIONS (also defines vout)
(vout % exhaust gas velocity [m/s])
F=vout*massout; % generated thrust [N]
ro=p/(R*T); % ambient density [kg/m^3]
if v<340
Fd=A*v^2*ro*Cd1/2; % subsonic flight drag [N]
else
Fd=A*v^2*ro*Cd2/2; % supersonic drag [N]
end
Fu=F-Fd; % useful thrust [N]
dm=(massout*t); % mass change in timestep X [kg]
ma=m-(dm/2); % average mass during timestep X [kg]
a=(Fu/ma)-g; % acceleration in timestep X [m/s^2]
s=(a*(t^2)/2)+v*t+s; % altitude in timestep X [m]
v=(a*t)+v; % velocity at the end of timestep X [m/s]
m=m-dm; % vehicle mass at the end of timestep X [kg]
end
%%% COASTING PERIOD--------------------------------------------------------
ii=0;
while v>0
ii=ii+1;
TIMEcoasting=ii*t;
%%% CALCULATION OF ATMOSPHERIC CONDITIONS
ro=p/(R*T); % ambient density [kg/m^3]
if v<340
Fd=A*v^2*ro*Cd1/2; % subsonic flight drag [N]
else
Fd=A*v^2*ro*Cd2/2; % supersonic drag [N]
end
a=-(Fd/massempty)-g; % acceleration in timestep X [m/s^2]
s=(a*(t^2)/2)+v*t+s; % altitude in timestep X [m]
v=(a*t)+v; % velocity at the end of timestep X [m/s]
end
Thank you for your time
I have written a set of equations for rocket flight (below) as i need to know the final altitude at various configurations (fuel mass/payload/exhaust mass flow/thrust).
I would ask if someone can please verify if this is correct (i have compared the results to results gained from Tsiolkovsky equation but it is difficult to approximate varying Isp with altitude and to include drag). Although the results are near.
I am calculating iteratively because i need to know the following parameters at 1 second intervals: vehicle velocity, acceleration, altitude and mass.
I know i should be using natural logarithm for mass ratios, but at 100 steps per second i postulated the error is negligible (a max error of 2% is allowed).
The equations in question are blue, the rest is just the programs structure (it's matlab/octave syntax).
Atmospheric conditions for each iteration are derived by a large number of equations which i have already verified thus i have not included them.m0=1100; % initial rocket mass [kg/s]
masso=500; % initial oxidator mass [kg]
massouto=6; % oxidator consumption [kg/s]
massoutg=1.5; % fuel consumption [kg/s]
massout=massouto+massoutg; % total propellant consumption [kg/s]
flightdur=(masso)/massouto % time of powered flight
t=0.01; % timestep
Rmax=0.826; % max vessel radius [m]
A=pi*Rmax^2; % max vessel cross-section [m2]
R=287; % air gas constant [J/kgK]
h0=0; % starting altitude [m]
T0=288.15; % temperature at 0m isa [K]
v0=0; % starting velocity [m/s]
g=9.81; % starting gravitational acceleration [m/s^2]
Cd1=0.015; % subsonic drag coefficient [/]
Cd2=0.04; % supersonic drag coefficient [/]
Xtotal=flightdur/t; % total number of timesteps [/]
% START CONDITIONS--------------------------------------------------------------
m=m0;
s=h0;
v=v0;
% TIMESTEP EQUATION BLOCK-------------------------------------------------------
for i=1:Xtotal
TIME=t*i;
%%% CALCULATION OF ATMOSPHERIC CONDITIONS (also defines vout)
(vout % exhaust gas velocity [m/s])
F=vout*massout; % generated thrust [N]
ro=p/(R*T); % ambient density [kg/m^3]
if v<340
Fd=A*v^2*ro*Cd1/2; % subsonic flight drag [N]
else
Fd=A*v^2*ro*Cd2/2; % supersonic drag [N]
end
Fu=F-Fd; % useful thrust [N]
dm=(massout*t); % mass change in timestep X [kg]
ma=m-(dm/2); % average mass during timestep X [kg]
a=(Fu/ma)-g; % acceleration in timestep X [m/s^2]
s=(a*(t^2)/2)+v*t+s; % altitude in timestep X [m]
v=(a*t)+v; % velocity at the end of timestep X [m/s]
m=m-dm; % vehicle mass at the end of timestep X [kg]
end
%%% COASTING PERIOD--------------------------------------------------------
ii=0;
while v>0
ii=ii+1;
TIMEcoasting=ii*t;
%%% CALCULATION OF ATMOSPHERIC CONDITIONS
ro=p/(R*T); % ambient density [kg/m^3]
if v<340
Fd=A*v^2*ro*Cd1/2; % subsonic flight drag [N]
else
Fd=A*v^2*ro*Cd2/2; % supersonic drag [N]
end
a=-(Fd/massempty)-g; % acceleration in timestep X [m/s^2]
s=(a*(t^2)/2)+v*t+s; % altitude in timestep X [m]
v=(a*t)+v; % velocity at the end of timestep X [m/s]
end
Thank you for your time