diff --git a/RoccarasoFlight/postprocessing/AFD/NASData_recalib.mat b/RoccarasoFlight/postprocessing/AFD/NASData_recalib.mat new file mode 100644 index 0000000000000000000000000000000000000000..5a1dc66e1259db5e22f7a0cbe45c41c736760e75 Binary files /dev/null and b/RoccarasoFlight/postprocessing/AFD/NASData_recalib.mat differ diff --git a/RoccarasoFlight/postprocessing/AFD/estimationCA.m b/RoccarasoFlight/postprocessing/AFD/estimationCA.m index 6f8df89b604f07b9498a9b3ff32eb1a3a1c5099c..805d5ab89239f5505b97a760b618fbbf02ba0423 100644 --- a/RoccarasoFlight/postprocessing/AFD/estimationCA.m +++ b/RoccarasoFlight/postprocessing/AFD/estimationCA.m @@ -23,11 +23,12 @@ function results = estimationCA(main, alt0) altNasFlight = -main.NASData(1:main.NASApogeeIndex, 4); velNasFlight = vecnorm(main.NASData(1:main.NASApogeeIndex, 5:7), 2, 2); - load nasSim.mat - indNasSim = sensorTot_NoPitot.nas.time < main.tApogee; - tNasSim = sensorTot_NoPitot.nas.time(indNasSim); - velNasSim = vecnorm(sensorTot_NoPitot.nas.states(indNasSim, 4:6), 2,2); - altNasSim = -sensorTot_NoPitot.nas.states(indNasSim, 3); + load NASData_recalib.mat + sensorTot = sensorTot_WithPitot; + indNasSim = sensorTot.nas.time < main.tApogee; + tNasSim = sensorTot.nas.time(indNasSim); + velNasSim = vecnorm(sensorTot.nas.states(indNasSim, 4:6), 2,2); + altNasSim = -sensorTot.nas.states(indNasSim, 3); % Normalize data @@ -46,7 +47,7 @@ function results = estimationCA(main, alt0) velNasSimNorm = interp1(tNasSim, velNasSim, timeRef); velVertNasFlightNorm = interp1(tNasFlight, movmean(-main.NASData(1:main.NASApogeeIndex, 7), 10), timeRef); - velVertNasSimNorm = interp1(tNasSim, -sensorTot_NoPitot.nas.states(indNasSim, 6), timeRef); + velVertNasSimNorm = interp1(tNasSim, -sensorTot.nas.states(indNasSim, 6), timeRef); altFlightNorm = interp1(tNasFlight, altNasFlight, timeRef); altSimNorm = interp1(tNasSim, altNasSim, timeRef); diff --git a/RoccarasoFlight/postprocessing/AFD/mainPostprocess.m b/RoccarasoFlight/postprocessing/AFD/mainPostprocess.m index c7b1fde450c038776b8e966e81df3b186d692a5f..2788f77efc30fbd6e88a1b6edc5a6b64e8226041 100644 --- a/RoccarasoFlight/postprocessing/AFD/mainPostprocess.m +++ b/RoccarasoFlight/postprocessing/AFD/mainPostprocess.m @@ -3,7 +3,7 @@ clc; close all; %% Select options -opt.flagTraj = true; +opt.flagTraj = false; opt.flagCA = true; alt0 = 1414; @@ -33,7 +33,7 @@ end if opt.flagCA configSimPostp; - settings.Local = [1414, 25 + 273, 88369]; + settings.Local = [1414, 22 + 273, 88369]; % CONTINUE Thrust = res.Thrust(1:indexCO); @@ -41,7 +41,7 @@ if opt.flagCA timeThrust = res.time(2:indexCO); timeThrust = [0, timeThrust]; - settings.motor.expM = res.mass.propMass(1:indexCO); + settings.motor.expM = res.mass.propMass(1:indexCO)'; settings.motor.Pe = reshapeVector(timeThrust, settings.motor.expTime, settings.motor.Pe); settings.mTotalTime = res.mass.rocketMass(1:indexCO); settings.ms = res.mass.rocketMass(end); @@ -62,8 +62,14 @@ if opt.flagCA settings.tb = settings.motor.expTime(end); settings.tControl = settings.tb; - settings.z0 = settings.z0 - 100; + settings.mDotTotalTime = [diff(settings.motor.expM)./diff(settings.motor.expTime) 0]; + [TfMDOT, YfMDOT, TaMDOT, YaMDOT, bound_valueMDOT] = stdRun(settings); + load ascent_plot.mat; + data_ascentMDOT = data_ascent; + clear data_ascent; + + settings.mDotTotalTime = zeros(size(settings.motor.expThrust)); [Tf, Yf, Ta, Ya, bound_value] = stdRun(settings); load ascent_plot.mat; @@ -75,33 +81,36 @@ if opt.flagCA hold on plot(res.time, res.altitude.alt_NasSim); plot(Ta, -Ya(:, 3)) + plot(TaMDOT, -YaMDOT(:, 3)) xlabel('Time [s]'); ylabel('Altitude [m]'); title('Altitude'); grid on - legend('NAS - flight', 'NAS - simulated', 'Simulation', 'Location','southoutside', 'Orientation', 'horizontal'); + legend('NAS - flight', 'NAS - simulated', 'Simulation','Simulation mDot', 'Location','southoutside', 'Orientation', 'horizontal'); figure plot(res.time, res.velocity.vel_NasFlight); hold on plot(res.time, res.velocity.vel_NasSim); plot(Ta, vecnorm(Ya(:, 4:6), 2, 2)); + plot(TaMDOT, vecnorm(YaMDOT(:, 4:6), 2, 2)); xlabel('Time [s]'); ylabel('Velocity [m/s]'); title('Total Velocity'); grid on - legend('NAS - flight', 'NAS - simulated', 'Simulation', 'Location','southoutside', 'Orientation', 'horizontal'); + legend('NAS - flight', 'NAS - simulated', 'Simulation', 'Simulation mDot','Location','southoutside', 'Orientation', 'horizontal'); figure plot(res.time, res.velocity.velVert_NasFlight); hold on plot(res.time, res.velocity.velVert_NasSim); plot(Ta, -data_ascent.velocities(3, :)); + plot(TaMDOT, -data_ascentMDOT.velocities(3, :)); xlabel('Time [s]'); ylabel('Velocity [m/s]'); title('Vertical Velocity'); grid on - legend('NAS - flight', 'NAS - simulated', 'Simulation', 'Location','southoutside', 'Orientation', 'horizontal'); + legend('NAS - flight', 'NAS - simulated', 'Simulation', 'Simulation mDot', 'Location','southoutside', 'Orientation', 'horizontal'); figure @@ -110,11 +119,12 @@ if opt.flagCA plot(res.time(indexCO:end),res.CA.CA_NasSim(indexCO:end)); plot(res.time(indexCO:end), [res.CA.CA0(indexCO:indexOpeningARB) res.CA.CA100(indexOpeningARB+1:end)]); plot(data_ascent.integration.t, data_ascent.coeff.CA); + plot(data_ascentMDOT.integration.t, data_ascentMDOT.coeff.CA); xlabel('Time [s]'); ylabel('CA [-]'); title('CA from telemetry'); grid on - legend('NAS - flight', 'NAS - simulated', 'MD', 'Simulation', 'Location','southoutside', 'Orientation', 'horizontal'); + legend('NAS - flight', 'NAS - simulated', 'MD', 'Simulation', 'Simulation mDot', 'Location','southoutside', 'Orientation', 'horizontal'); end diff --git a/RoccarasoFlight/postprocessing/AFD/trajectory.m b/RoccarasoFlight/postprocessing/AFD/trajectory.m index 2d4a64cf57d69aabd4ea775c1697b763fec17e48..6887ad2b290f2388abc4a108b6260d70efe9a889 100644 --- a/RoccarasoFlight/postprocessing/AFD/trajectory.m +++ b/RoccarasoFlight/postprocessing/AFD/trajectory.m @@ -23,4 +23,4 @@ altNasInterp = interp1(tNas, altNas, tGps); uif = uifigure; g = geoglobe(uif); -geoplot3(g,lat,lon,altNasInterp + alt0,'b','Linewidth',2.5); \ No newline at end of file +geoplot3(g,lat,lon,altNasInterp + alt0,'b','Linewidth',2.5, 'Color','#D3212D'); \ No newline at end of file diff --git a/RoccarasoFlight/postprocessing/commonFunctions/parseData.m b/RoccarasoFlight/postprocessing/commonFunctions/parseData.m index e7f558f78d6e5a0dc8bf15789fdd88a58a07525f..5e15fca18cf7f3344065e35b8727990b9fe4ace2 100644 --- a/RoccarasoFlight/postprocessing/commonFunctions/parseData.m +++ b/RoccarasoFlight/postprocessing/commonFunctions/parseData.m @@ -34,7 +34,7 @@ if ~isempty(fieldnames(main)) main.IMU_CORRECTED(:,9) = main.MAGNETOMETER(1:2:end,1); %%% flight timestamps - main.tLiftoff = main.EVENTData{main.EVENTData{:,2}==40,1} -1 ; % pin detach event -1 sec + main.tLiftoff = main.EVENTData{main.EVENTData{:,2}==40,1} - 0.52; % pin detach event -1 sec main.tLanding = main.tLiftoff+tLanding; % landing (circa) %%% trim matrices