Skip to content
Snippets Groups Projects
Commit 857269d4 authored by Marco Marchesi's avatar Marco Marchesi
Browse files

added plots for report, plus synchronization of RIG with main

parent 891286c6
Branches
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ clear; close all; clc; ...@@ -2,6 +2,7 @@ clear; close all; clc;
addpath(genpath('../commonFunctions/')) addpath(genpath('../commonFunctions/'))
addpath('../RCS/Functions&Files/') addpath('../RCS/Functions&Files/')
addpath('../../../general-utilities/')
%% import data from logs %% import data from logs
% import and parse data % import and parse data
......
% post process information % 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 %% engine acceleration vs pressure in chamber
figure figure
sgtitle('Engine: Pressure and Acceleration') sgtitle('Engine: Pressure and Acceleration')
...@@ -43,7 +50,7 @@ plot(main.ADAData(:,1),main.ADAData(:,3),'DisplayName','Altitude','color','#4658 ...@@ -43,7 +50,7 @@ plot(main.ADAData(:,1),main.ADAData(:,3),'DisplayName','Altitude','color','#4658
ylabel('ADA Altitude') ylabel('ADA Altitude')
hold on; hold on;
ylabel('ADA altitude') ylabel('ADA altitude')
ylim([1300,1360]) % ylim([1300,1360])
exportStandardizedFigure(gcf, 'Expulsion far',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false) exportStandardizedFigure(gcf, 'Expulsion far',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false)
set(gca,"YColor",'#4658A9') set(gca,"YColor",'#4658A9')
yyaxis right yyaxis right
...@@ -55,14 +62,9 @@ xline(COTS.MainData{COTS.MainDeploymentIndex,4},'--','COTS deploy','HandleVisibi ...@@ -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') plot(main.RCS_PRESSURE(:,1),main.RCS_PRESSURE(:,2),'DisplayName','RCS bay pressure','Color','#D3212D')
legend legend
set(gca,"YColor",'#D3212D') set(gca,"YColor",'#D3212D')
xlim([18,19]) % xlim([18,19])
exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false)
return
exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false)
figure figure
title('ADA vs COTS expulsion') title('ADA vs COTS expulsion')
...@@ -86,34 +88,47 @@ legend ...@@ -86,34 +88,47 @@ legend
%% TARS %% TARS
textDim = 0.49;
figure figure
sgtitle('TARS') % sgtitle('TARS')
subplot(2,1,1)
yyaxis left yyaxis left
plot(RIG.TARSData(:,1),RIG.TARSData(:,3),'DisplayName','TARS Pressure') plot(RIG.TARSData(:,1),RIG.TARSData(:,3),'DisplayName','Tank Pressure','Color','#4658A9')
ylabel('Pressure [bar]') ylabel('Tank Pressure [bar]')
set(gca,"YColor",'#4658A9')
exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false)
yyaxis right yyaxis right
plot(RIG.TARSData(:,1),RIG.TARSData(:,4),'DisplayName','TARS Mass') 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") 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),'b--',"PRESSURE STABILIZED") xline(RIG.EVENTData(findEventIndex(RIG.EVENTData,2,'TARS_PRESSURE_STABILIZED',main.EVENTNames),1),'--',"PRESSURE STABILIZED",'HandleVisibility','off','Color','#00A86B')
title('Pressure and Mass measures') title('Pressure and Mass measures')
xlabel('Time [s]') xlabel('Time [s]')
ylabel('Mass [kg]') 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 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') yline(0.2,'k--','TARGET OFFSET','HandleVisibility','off')
ylabel('Mass [kg]') ylabel('Mass Offset [kg]')
hold on; grid on; hold on; grid on;
exportStandardizedFigure(gcf, 'Expulsion zoom',textDim, 'addMarkers',false,'changeColors',false,'exportPDF',false)
yyaxis right yyaxis right
plot(RIG.ventValve(:,1),RIG.ventValve(:,2),'DisplayName','Venting Valve Position') stairs(RIG.ventValve(:,1),RIG.ventValve(:,2)*100,'DisplayName','Venting Valve Position','Color','#D3212D')
ylabel('Position [%]') 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]') xlabel('Time [s]')
legend legend
xlim([12900,13100]) set(gca,"YColor",'#D3212D')
title('Mass finite difference 1HZ vs venting valve') 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 % % % commento: non abbiamo lasciato che TARS finisse, ma abbiamo stoppato
% % % noi perché abbiamo visto fase liquida. Probabilmente si % % % noi perché abbiamo visto fase liquida. Probabilmente si
% % % sarebbe stoppato a vedere l'andamento della massa prima del venting % % % sarebbe stoppato a vedere l'andamento della massa prima del venting
...@@ -523,31 +538,58 @@ title('Apogee prediction') ...@@ -523,31 +538,58 @@ title('Apogee prediction')
xlabel('Time [s]') xlabel('Time [s]')
ylabel('Altitude [m]') 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 %% ABK wrt references
textDim = 0.6;
main.ABKServoData(:,5) = zeros(length(main.ABKServoData(:,1)),1); main.ABKServoData(:,5) = zeros(length(main.ABKServoData(:,1)),1);
for i = 1:length(main.ABKServoData(:,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); main.ABKServoData(i,5) = -main.NASData(find((main.NASData(:,1)-main.ABKServoData(i,1))>0,1,'first'),4);
end end
figure figure
yyaxis left 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; 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_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_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.closedTrajectory(:,1),ABK.closedTrajectory(:,2),'k--','DisplayName','Closed Trajectory')
plot(ABK.openTrajectory(:,1),ABK.openTrajectory(:,2),'ks-','DisplayName','Open Trajectory') plot(ABK.openTrajectory(:,1),ABK.openTrajectory(:,2),'ks-','DisplayName','Open Trajectory')
ylabel('Vertical Velocity [m/s]') ylabel('Vertical Velocity [m/s]')
h = gca; h = gca;
h.YColor = 'b'; h.YColor = '#4658A9';
exportStandardizedFigure(gcf, 'Expulsion far',textDim, 'addMarkers',false,'forcedMarkers',5,'changeColors',false,'exportPDF',false)
yyaxis right 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 = gca;
h.YColor = 'r'; h.YColor = '#D3212D';
ylabel('ABK position') ylabel('ABK position')
xlabel('Altitude [m]') xlabel('Altitude [m]')
legend legend
title('ABK vs References') 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 % % % commento: la shadowmode probabilmente si è mangiata il fatto che il primo
% % % comando dovrebbe essere senza filtro, per permettere agli aerofreni di % % % comando dovrebbe essere senza filtro, per permettere agli aerofreni di
...@@ -563,4 +605,4 @@ title('ABK vs References') ...@@ -563,4 +605,4 @@ title('ABK vs References')
for i = 1:length(main.NASData(:,1)) for i = 1:length(main.NASData(:,1))
dcm(:,:,i) = quat2dcm(sensorTot_NoPitot.nas.states(i,[10,7:9])); dcm(:,:,i) = quat2dcm(sensorTot_NoPitot.nas.states(i,[10,7:9]));
end end
animateOrientation(dcm, sensorTot_NoPitot.nas.time, 'prova1') % animateOrientation(dcm, sensorTot_NoPitot.nas.time, 'prova1')
\ No newline at end of file \ No newline at end of file
...@@ -160,11 +160,18 @@ if ~isempty(fieldnames(motor)) ...@@ -160,11 +160,18 @@ if ~isempty(fieldnames(motor))
end end
%% RIG %% RIG
if ~isempty(fieldnames(RIG)) if ~isempty(fieldnames(RIG))
RIG.t_offset_main = 14094.1-0.281972;
RIG.actuatorData(:,1) = RIG.actuatorData(:,1)/1e6; RIG.actuatorData(:,1) = RIG.actuatorData(:,1)/1e6;
RIG.LoadCellData(:,1) = RIG.LoadCellData(:,1)/1e6; RIG.LoadCellData(:,1) = RIG.LoadCellData(:,1)/1e6;
RIG.can_pressure(:,1) = RIG.can_pressure(:,1)/1e6; RIG.can_pressure(:,1) = RIG.can_pressure(:,1)/1e6;
RIG.TARSData(:,1) = RIG.TARSData(:,1)/1e6; RIG.TARSData(:,1) = RIG.TARSData(:,1)/1e6;
RIG.EVENTData(:,1) = RIG.EVENTData(:,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 % extract actuators from ADC
RIG.mainValve = RIG.actuatorData(RIG.actuatorData(:,2) == 5,[1,3]); RIG.mainValve = RIG.actuatorData(RIG.actuatorData(:,2) == 5,[1,3]);
RIG.ventValve = RIG.actuatorData(RIG.actuatorData(:,2) == 6,[1,3]); RIG.ventValve = RIG.actuatorData(RIG.actuatorData(:,2) == 6,[1,3]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment