diff --git a/RoccarasoFlight/postprocessing/GNC/mainPP.m b/RoccarasoFlight/postprocessing/GNC/mainPP.m index d843da6e6a415fe59dad7474efecbc23d4054c13..757ce1ce0a5768b1eaa175863b536c481c43b975 100644 --- a/RoccarasoFlight/postprocessing/GNC/mainPP.m +++ b/RoccarasoFlight/postprocessing/GNC/mainPP.m @@ -2,6 +2,7 @@ clear; close all; clc; addpath(genpath('../commonFunctions/')) addpath('../RCS/Functions&Files/') +addpath('../../../general-utilities/') %% import data from logs % import and parse data diff --git a/RoccarasoFlight/postprocessing/GNC/postProcess.m b/RoccarasoFlight/postprocessing/GNC/postProcess.m index 373d4d6be0bce280c9728c0e394570935d4156e0..888d7b3440d89c1ca7676056612a810aa9c21ed1 100644 --- a/RoccarasoFlight/postprocessing/GNC/postProcess.m +++ b/RoccarasoFlight/postprocessing/GNC/postProcess.m @@ -1,5 +1,12 @@ % post process information + +figure +stairs(motor.mainServoData(:,1),motor.mainServoData(:,2),'DisplayName','motore') +hold on; +stairs(RIG.mainValve(:,1),RIG.mainValve(:,2),'DisplayName','RIG') + + %% engine acceleration vs pressure in chamber figure sgtitle('Engine: Pressure and Acceleration') @@ -43,7 +50,7 @@ plot(main.ADAData(:,1),main.ADAData(:,3),'DisplayName','Altitude','color','#4658 ylabel('ADA Altitude') hold on; ylabel('ADA altitude') -ylim([1300,1360]) +% ylim([1300,1360]) exportStandardizedFigure(gcf, 'Expulsion far',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false) set(gca,"YColor",'#4658A9') yyaxis right @@ -55,14 +62,9 @@ xline(COTS.MainData{COTS.MainDeploymentIndex,4},'--','COTS deploy','HandleVisibi plot(main.RCS_PRESSURE(:,1),main.RCS_PRESSURE(:,2),'DisplayName','RCS bay pressure','Color','#D3212D') legend set(gca,"YColor",'#D3212D') -xlim([18,19]) - -exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false) - -return - - +% xlim([18,19]) +exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false) figure title('ADA vs COTS expulsion') @@ -86,34 +88,47 @@ legend %% TARS +textDim = 0.49; figure -sgtitle('TARS') -subplot(2,1,1) +% sgtitle('TARS') yyaxis left -plot(RIG.TARSData(:,1),RIG.TARSData(:,3),'DisplayName','TARS Pressure') -ylabel('Pressure [bar]') +plot(RIG.TARSData(:,1),RIG.TARSData(:,3),'DisplayName','Tank Pressure','Color','#4658A9') +ylabel('Tank Pressure [bar]') +set(gca,"YColor",'#4658A9') +exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false) yyaxis right -plot(RIG.TARSData(:,1),RIG.TARSData(:,4),'DisplayName','TARS Mass') -xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'MOTOR_START_TARS',main.EVENTNames),1),'k--',"START TARS") -xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'TARS_PRESSURE_STABILIZED',main.EVENTNames),1),'b--',"PRESSURE STABILIZED") +plot(RIG.TARSData(:,1),RIG.TARSData(:,4),'DisplayName','TARS Mass','Color','#D3212D') +xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'MOTOR_START_TARS',main.EVENTNames),1),'k--',"START TARS",'HandleVisibility','off') +xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'TARS_PRESSURE_STABILIZED',main.EVENTNames),1),'--',"PRESSURE STABILIZED",'HandleVisibility','off','Color','#00A86B') title('Pressure and Mass measures') xlabel('Time [s]') ylabel('Mass [kg]') -xlim([12900,13100]) +set(gca,"YColor",'#D3212D') +xlim([-1180,-900]) +legend +exportStandardizedFigure(gcf, 'TARS pressure mass',textDim, 'addMarkers',false,'changeColors',false) -subplot(2,1,2) + +figure yyaxis left -plot(RIG.TARScheckMass(2:end,1),abs(diff(RIG.TARScheckMass(:,2))),'DisplayName','M tank') +plot(RIG.TARScheckMass(2:end,1),abs(diff(RIG.TARScheckMass(:,2))),'DisplayName','OX mass difference','Color','#4658A9') +set(gca,"YColor",'#4658A9') yline(0.2,'k--','TARGET OFFSET','HandleVisibility','off') -ylabel('Mass [kg]') +ylabel('Mass Offset [kg]') hold on; grid on; +exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false) yyaxis right -plot(RIG.ventValve(:,1),RIG.ventValve(:,2),'DisplayName','Venting Valve Position') -ylabel('Position [%]') +stairs(RIG.ventValve(:,1),RIG.ventValve(:,2)*100,'DisplayName','Venting Valve Position','Color','#D3212D') +xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'MOTOR_START_TARS',main.EVENTNames),1),'k--',"START TARS",'HandleVisibility','off') +xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'TARS_PRESSURE_STABILIZED',main.EVENTNames),1),'--',"PRESSURE STABILIZED",'HandleVisibility','off','Color','#00A86B') +ylabel('Valve Position [%]') xlabel('Time [s]') legend -xlim([12900,13100]) -title('Mass finite difference 1HZ vs venting valve') +set(gca,"YColor",'#D3212D') +xlim([-1180,-900]) +title('Mass finite difference vs venting valve') +exportStandardizedFigure(gcf, 'TARS mass offset',textDim, 'addMarkers',false,'changeColors',false) + % % % commento: non abbiamo lasciato che TARS finisse, ma abbiamo stoppato % % % noi perché abbiamo visto fase liquida. Probabilmente si % % % sarebbe stoppato a vedere l'andamento della massa prima del venting @@ -523,31 +538,58 @@ title('Apogee prediction') xlabel('Time [s]') ylabel('Altitude [m]') +%% report images for MEA +figure +plot(main.MEAControllerStatus(main.MEAControllerStatus(:,1)<t_end,1),main.MEAControllerStatus(main.MEAControllerStatus(:,1)<t_end,2),'DisplayName','OBSW') +hold on; +plot(sensorTot_OBSW.mea.time,sensorTot_OBSW.mea.estimatedMass,'DisplayName','Last HIL test') +legend +title('Estimated Mass') +xlabel('Time [s]') +ylabel('Mass [kg]') + +figure +plot(main.MEAControllerStatus(main.MEAControllerStatus(:,1)<t_end,1),main.MEAControllerStatus(main.MEAControllerStatus(:,1)<t_end,3),'DisplayName','OBSW') +hold on; +plot(sensorTot_OBSW.mea.time,sensorTot_OBSW.mea.predictedApogee,'DisplayName','Last HIL test') +legend +title('Estimated Mass') +xlabel('Time [s]') +ylabel('Mass [kg]') + + + %% ABK wrt references +textDim = 0.6; main.ABKServoData(:,5) = zeros(length(main.ABKServoData(:,1)),1); for i = 1:length(main.ABKServoData(:,1)) main.ABKServoData(i,5) = -main.NASData(find((main.NASData(:,1)-main.ABKServoData(i,1))>0,1,'first'),4); end figure yyaxis left -plot(-main.NASData(1:main.NASApogeeIndex,4),-main.NASData(1:main.NASApogeeIndex,7),'b','DisplayName','NAS OBSW') +plot(-main.NASData(1:main.NASApogeeIndex,4),-main.NASData(1:main.NASApogeeIndex,7),'DisplayName','NAS OBSW','Color','#4658A9') hold on; -plot(-sensorTot_NoPitot.nas.states(1:main.NASApogeeIndex,3),-sensorTot_NoPitot.nas.states(1:main.NASApogeeIndex,6),'b','DisplayName','NAS Simulatore NoPitot') -plot(-sensorTot_WithPitot.nas.states(1:main.NASApogeeIndex,3),-sensorTot_WithPitot.nas.states(1:main.NASApogeeIndex,6),'b','DisplayName','NAS Simulatore Pitot') +% plot(-sensorTot_NoPitot.nas.states(1:main.NASApogeeIndex,3),-sensorTot_NoPitot.nas.states(1:main.NASApogeeIndex,6),'b','DisplayName','NAS Simulatore NoPitot') +% plot(-sensorTot_WithPitot.nas.states(1:main.NASApogeeIndex,3),-sensorTot_WithPitot.nas.states(1:main.NASApogeeIndex,6),'b','DisplayName','NAS Simulatore Pitot') plot(ABK.closedTrajectory(:,1),ABK.closedTrajectory(:,2),'k--','DisplayName','Closed Trajectory') plot(ABK.openTrajectory(:,1),ABK.openTrajectory(:,2),'ks-','DisplayName','Open Trajectory') ylabel('Vertical Velocity [m/s]') h = gca; -h.YColor = 'b'; +h.YColor = '#4658A9'; +exportStandardizedFigure(gcf, 'Expulsion far',textDim, 'addMarkers',false,'forcedMarkers',5,'changeColors',false,'exportPDF',false) + yyaxis right -stairs(main.ABKServoData(:,5),main.ABKServoData(:,4),'r','DisplayName','ABK') +stairs(main.ABKServoData(:,5),main.ABKServoData(:,4),'DisplayName','ABK','Color','#D3212D') h = gca; -h.YColor = 'r'; +h.YColor = '#D3212D'; ylabel('ABK position') xlabel('Altitude [m]') legend title('ABK vs References') +ylim([0,1.1]) +exportStandardizedFigure(gcf, 'ABK wrt references',textDim, 'addMarkers',false,'forcedMarkers',5,'changeColors',false) + % % % commento: la shadowmode probabilmente si è mangiata il fatto che il primo % % % comando dovrebbe essere senza filtro, per permettere agli aerofreni di @@ -563,4 +605,4 @@ title('ABK vs References') for i = 1:length(main.NASData(:,1)) dcm(:,:,i) = quat2dcm(sensorTot_NoPitot.nas.states(i,[10,7:9])); end -animateOrientation(dcm, sensorTot_NoPitot.nas.time, 'prova1') \ No newline at end of file +% animateOrientation(dcm, sensorTot_NoPitot.nas.time, 'prova1') \ No newline at end of file diff --git a/RoccarasoFlight/postprocessing/commonFunctions/parseData.m b/RoccarasoFlight/postprocessing/commonFunctions/parseData.m index 620cdd499246542c1339eb794d903ac3cf30cf70..e7f558f78d6e5a0dc8bf15789fdd88a58a07525f 100644 --- a/RoccarasoFlight/postprocessing/commonFunctions/parseData.m +++ b/RoccarasoFlight/postprocessing/commonFunctions/parseData.m @@ -160,11 +160,18 @@ if ~isempty(fieldnames(motor)) end %% RIG if ~isempty(fieldnames(RIG)) + RIG.t_offset_main = 14094.1-0.281972; RIG.actuatorData(:,1) = RIG.actuatorData(:,1)/1e6; RIG.LoadCellData(:,1) = RIG.LoadCellData(:,1)/1e6; RIG.can_pressure(:,1) = RIG.can_pressure(:,1)/1e6; RIG.TARSData(:,1) = RIG.TARSData(:,1)/1e6; RIG.EVENTData(:,1) = RIG.EVENTData(:,1)/1e6; + % readjust timestamps to main valve opening + RIG.actuatorData(:,1) = RIG.actuatorData(:,1)-RIG.t_offset_main; + RIG.LoadCellData(:,1) = RIG.LoadCellData(:,1)-RIG.t_offset_main; + RIG.can_pressure(:,1) = RIG.can_pressure(:,1)-RIG.t_offset_main; + RIG.TARSData(:,1) = RIG.TARSData(:,1)-RIG.t_offset_main; + RIG.EVENTData(:,1) = RIG.EVENTData(:,1)-RIG.t_offset_main; % extract actuators from ADC RIG.mainValve = RIG.actuatorData(RIG.actuatorData(:,2) == 5,[1,3]); RIG.ventValve = RIG.actuatorData(RIG.actuatorData(:,2) == 6,[1,3]);