Skip to content
Snippets Groups Projects
Commit fe4d40e3 authored by Emilio Corigliano's avatar Emilio Corigliano
Browse files

[outcomes] fixed printed outcomes

parent 2dff1429
Branches
No related tags found
No related merge requests found
......@@ -60,23 +60,43 @@ abs_V = vecnorm(Va');
[max_dist, imax_dist] = max(abs_X);
[max_v, imax_v] = max(abs_V);
% closing the serial connection
if settings.electronics
serialbridge("Close")
end
% DATA RECORD (display)
fprintf('OUTCOMES:\n\n')
fprintf('OUTCOMES: (times dt from liftoff)\n\n')
fprintf('total computational Time: %.3f [s]: \n', sum(cpuTimes))
fprintf('mean step computational Time: %.3f [s]: \n', mean(cpuTimes))
fprintf('max step omputational Time: %.3f [s]: \n\n', max(cpuTimes))
fprintf('apogee: %.1f [m] \n', max_z);
fprintf('@time: %g [sec] \n\n', T_apo)
fprintf('max step computational Time: %.3f [s]: \n\n', max(cpuTimes))
fprintf('max speed reached: %g [m/s] \n', max_v)
fprintf('max speed reached: \n')
fprintf('@time: %g [sec] \n', Tf(imax_v) - otherData.tLaunch)
fprintf('@altitude: %g [m] \n', za(imax_v))
fprintf('@time: %g [sec] \n\n', Tf(imax_v))
fprintf("@velocity: %g [m/s] \n\n", max_v);
fprintf('activation airbrakes (end burning phase):\n');
fprintf("@altitude: %g [m] \n", otherData.z_aerobrakeOn);
fprintf("@velocity: %g [m/s] \n", otherData.vz_aerobrakeOn);
fprintf('@time: %g [sec] \n', otherData.t_aerobrakes - otherData.tLaunch)
fprintf("@altitude: %g [m] \n", otherData.z_aerobrakes);
fprintf("@velocity: %g [m/s] \n\n", otherData.vz_aerobrakes);
fprintf('apogee:\n');
fprintf('@time: %g [sec] \n', T_apo - otherData.tLaunch)
fprintf('@altitude: %.1f [m] \n\n', max_z)
if(not(settings.ballisticFligth))
fprintf('parachute 1:\n');
fprintf('@time: %g [sec] \n', otherData.t_para1 - otherData.tLaunch)
fprintf("@altitude: %g [m] \n", otherData.z_para1);
fprintf("@velocity: %g [m/s] \n\n", otherData.vz_para1);
fprintf('parachute 2:\n');
fprintf('@time: %g [sec] \n', otherData.t_para2 - otherData.tLaunch)
fprintf("@altitude: %g [m] \n", otherData.z_para2);
fprintf("@velocity: %g [m/s] \n\n", otherData.vz_para2);
end
if not(settings.electronics)
M = data_flight.interp.M;
......@@ -141,8 +161,4 @@ if settings.plots && not(settings.electronics)
end
if settings.electronics
serialbridge("Close")
end
clearvars -except Yf data_flight settings
......@@ -104,7 +104,6 @@ magneticFieldApprox = @(zSlm) XYZ0 + (XYZh-XYZ0)./hmax.*zSlm;
%% INTEGRATION
% setting initial condition before control phase
otherData.z_aerobrakeOn = 0;
dt = 1/settings.frequencies.controlFrequency;
t0 = 0;
t1 = t0 + dt;
......@@ -158,6 +157,7 @@ while flagStopIntegration || n_old < nmax
lastFlagAscent = flagAscent;
if not(lastLaunchflag) && launchFlag
tLaunch = t0;
otherData.tLaunch = t0;
end
if launchFlag && (t0 - tLaunch) <= settings.tb
......@@ -167,6 +167,11 @@ while flagStopIntegration || n_old < nmax
end
if flagAscent && not(flagBurning) && mach <=0.7
if not(flagAeroBrakes)
otherData.t_aerobrakes = t0;
otherData.z_aerobrakes = z;
otherData.vz_aerobrakes = vz;
end
flagAeroBrakes = true;
else
flagAeroBrakes = false;
......@@ -186,9 +191,19 @@ while flagStopIntegration || n_old < nmax
if not(flagAscent) && launchFlag
if z >= settings.para(1).z_cut
if not(flagPara1)
otherData.t_para1 = t0;
otherData.z_para1 = z;
otherData.vz_para1 = vz;
end
flagPara1 = true;
flagPara2 = false;
else
if not(flagPara2)
otherData.t_para2 = t0;
otherData.z_para2 = z;
otherData.vz_para2 = vz;
end
flagPara1 = false;
flagPara2 = true;
end
......@@ -267,7 +282,7 @@ while flagStopIntegration || n_old < nmax
% if the obsw sends an opening of -1 while the flag isLaunch is still
% false, triggers the liftoff and the opening of aerobrake is set to 0
if(alpha_degree < 0 && not(isLaunch))
if(alpha_degree == -1 && not(isLaunch))
alpha_degree = 0;
isLaunch = true;
disp("Liftoff (obsw signal)!");
......@@ -276,10 +291,6 @@ while flagStopIntegration || n_old < nmax
x = get_extension_from_angle(alpha_degree);
if flagAeroBrakes
if otherData.z_aerobrakeOn == 0
otherData.z_aerobrakeOn = z;
otherData.vz_aerobrakeOn = vz;
end
plot_control_variable(index_plot) = alpha_degree;
index_plot = index_plot + 1;
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment