Skip to content
Snippets Groups Projects
Commit b75ce382 authored by Riccardo Cadamuro's avatar Riccardo Cadamuro
Browse files

Simulations [Thrust measured, NAS updated]

parent db64cbfb
No related branches found
No related tags found
No related merge requests found
File added
...@@ -23,11 +23,12 @@ function results = estimationCA(main, alt0) ...@@ -23,11 +23,12 @@ function results = estimationCA(main, alt0)
altNasFlight = -main.NASData(1:main.NASApogeeIndex, 4); altNasFlight = -main.NASData(1:main.NASApogeeIndex, 4);
velNasFlight = vecnorm(main.NASData(1:main.NASApogeeIndex, 5:7), 2, 2); velNasFlight = vecnorm(main.NASData(1:main.NASApogeeIndex, 5:7), 2, 2);
load nasSim.mat load NASData_recalib.mat
indNasSim = sensorTot_NoPitot.nas.time < main.tApogee; sensorTot = sensorTot_WithPitot;
tNasSim = sensorTot_NoPitot.nas.time(indNasSim); indNasSim = sensorTot.nas.time < main.tApogee;
velNasSim = vecnorm(sensorTot_NoPitot.nas.states(indNasSim, 4:6), 2,2); tNasSim = sensorTot.nas.time(indNasSim);
altNasSim = -sensorTot_NoPitot.nas.states(indNasSim, 3); velNasSim = vecnorm(sensorTot.nas.states(indNasSim, 4:6), 2,2);
altNasSim = -sensorTot.nas.states(indNasSim, 3);
% Normalize data % Normalize data
...@@ -46,7 +47,7 @@ function results = estimationCA(main, alt0) ...@@ -46,7 +47,7 @@ function results = estimationCA(main, alt0)
velNasSimNorm = interp1(tNasSim, velNasSim, timeRef); velNasSimNorm = interp1(tNasSim, velNasSim, timeRef);
velVertNasFlightNorm = interp1(tNasFlight, movmean(-main.NASData(1:main.NASApogeeIndex, 7), 10), 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); altFlightNorm = interp1(tNasFlight, altNasFlight, timeRef);
altSimNorm = interp1(tNasSim, altNasSim, timeRef); altSimNorm = interp1(tNasSim, altNasSim, timeRef);
......
...@@ -3,7 +3,7 @@ clc; ...@@ -3,7 +3,7 @@ clc;
close all; close all;
%% Select options %% Select options
opt.flagTraj = true; opt.flagTraj = false;
opt.flagCA = true; opt.flagCA = true;
alt0 = 1414; alt0 = 1414;
...@@ -33,7 +33,7 @@ end ...@@ -33,7 +33,7 @@ end
if opt.flagCA if opt.flagCA
configSimPostp; configSimPostp;
settings.Local = [1414, 25 + 273, 88369]; settings.Local = [1414, 22 + 273, 88369];
% CONTINUE % CONTINUE
Thrust = res.Thrust(1:indexCO); Thrust = res.Thrust(1:indexCO);
...@@ -41,7 +41,7 @@ if opt.flagCA ...@@ -41,7 +41,7 @@ if opt.flagCA
timeThrust = res.time(2:indexCO); timeThrust = res.time(2:indexCO);
timeThrust = [0, timeThrust]; 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.motor.Pe = reshapeVector(timeThrust, settings.motor.expTime, settings.motor.Pe);
settings.mTotalTime = res.mass.rocketMass(1:indexCO); settings.mTotalTime = res.mass.rocketMass(1:indexCO);
settings.ms = res.mass.rocketMass(end); settings.ms = res.mass.rocketMass(end);
...@@ -62,8 +62,14 @@ if opt.flagCA ...@@ -62,8 +62,14 @@ if opt.flagCA
settings.tb = settings.motor.expTime(end); settings.tb = settings.motor.expTime(end);
settings.tControl = settings.tb; 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); [Tf, Yf, Ta, Ya, bound_value] = stdRun(settings);
load ascent_plot.mat; load ascent_plot.mat;
...@@ -75,33 +81,36 @@ if opt.flagCA ...@@ -75,33 +81,36 @@ if opt.flagCA
hold on hold on
plot(res.time, res.altitude.alt_NasSim); plot(res.time, res.altitude.alt_NasSim);
plot(Ta, -Ya(:, 3)) plot(Ta, -Ya(:, 3))
plot(TaMDOT, -YaMDOT(:, 3))
xlabel('Time [s]'); xlabel('Time [s]');
ylabel('Altitude [m]'); ylabel('Altitude [m]');
title('Altitude'); title('Altitude');
grid on 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 figure
plot(res.time, res.velocity.vel_NasFlight); plot(res.time, res.velocity.vel_NasFlight);
hold on hold on
plot(res.time, res.velocity.vel_NasSim); plot(res.time, res.velocity.vel_NasSim);
plot(Ta, vecnorm(Ya(:, 4:6), 2, 2)); plot(Ta, vecnorm(Ya(:, 4:6), 2, 2));
plot(TaMDOT, vecnorm(YaMDOT(:, 4:6), 2, 2));
xlabel('Time [s]'); xlabel('Time [s]');
ylabel('Velocity [m/s]'); ylabel('Velocity [m/s]');
title('Total Velocity'); title('Total Velocity');
grid on 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 figure
plot(res.time, res.velocity.velVert_NasFlight); plot(res.time, res.velocity.velVert_NasFlight);
hold on hold on
plot(res.time, res.velocity.velVert_NasSim); plot(res.time, res.velocity.velVert_NasSim);
plot(Ta, -data_ascent.velocities(3, :)); plot(Ta, -data_ascent.velocities(3, :));
plot(TaMDOT, -data_ascentMDOT.velocities(3, :));
xlabel('Time [s]'); xlabel('Time [s]');
ylabel('Velocity [m/s]'); ylabel('Velocity [m/s]');
title('Vertical Velocity'); title('Vertical Velocity');
grid on 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 figure
...@@ -110,11 +119,12 @@ if opt.flagCA ...@@ -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.CA_NasSim(indexCO:end));
plot(res.time(indexCO:end), [res.CA.CA0(indexCO:indexOpeningARB) res.CA.CA100(indexOpeningARB+1: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_ascent.integration.t, data_ascent.coeff.CA);
plot(data_ascentMDOT.integration.t, data_ascentMDOT.coeff.CA);
xlabel('Time [s]'); xlabel('Time [s]');
ylabel('CA [-]'); ylabel('CA [-]');
title('CA from telemetry'); title('CA from telemetry');
grid on 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 end
......
...@@ -23,4 +23,4 @@ altNasInterp = interp1(tNas, altNas, tGps); ...@@ -23,4 +23,4 @@ altNasInterp = interp1(tNas, altNas, tGps);
uif = uifigure; uif = uifigure;
g = geoglobe(uif); g = geoglobe(uif);
geoplot3(g,lat,lon,altNasInterp + alt0,'b','Linewidth',2.5); geoplot3(g,lat,lon,altNasInterp + alt0,'b','Linewidth',2.5, 'Color','#D3212D');
\ No newline at end of file \ No newline at end of file
...@@ -34,7 +34,7 @@ if ~isempty(fieldnames(main)) ...@@ -34,7 +34,7 @@ if ~isempty(fieldnames(main))
main.IMU_CORRECTED(:,9) = main.MAGNETOMETER(1:2:end,1); main.IMU_CORRECTED(:,9) = main.MAGNETOMETER(1:2:end,1);
%%% flight timestamps %%% 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) main.tLanding = main.tLiftoff+tLanding; % landing (circa)
%%% trim matrices %%% trim matrices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment