mirror of
https://gitlab.com/lander-team/lander-sim.git
synced 2025-08-03 03:41:32 +00:00
27 lines
543 B
Matlab
27 lines
543 B
Matlab
function [h0, vb, burnStartTime] = burnStartTimeCalc(Tcurve, tb, M0, mdot, Mb)
|
|
Mavg = (M0 + Mb)/2;
|
|
g = -9.81;
|
|
|
|
A_tot = 0;
|
|
|
|
% Riemann Sum
|
|
for i = 2:length(Tcurve)
|
|
if i > 1
|
|
A = (Tcurve(i, 1) - Tcurve(i - 1, 1)) * Tcurve(i, 2);
|
|
else
|
|
A = Tcurve(i, 1) * Tcurve(i, 2);
|
|
end
|
|
A_tot = A_tot + A;
|
|
end
|
|
|
|
Tavg = A_tot / tb;
|
|
ueq = Tavg / mdot;
|
|
delta_ub = ueq * log(M0/Mb) + g*tb;
|
|
a_avg = (Tavg/Mavg) + g;
|
|
|
|
hf = ((delta_ub^2) / (2*-g));
|
|
hb = ((delta_ub^2) / (2*a_avg))
|
|
|
|
h0 = hf + hb + 1;
|
|
vb = delta_ub;
|
|
burnStartTime = vb / -g; |