Skip to content
Snippets Groups Projects
Commit f641ab59 authored by giuliaghirardini's avatar giuliaghirardini
Browse files

[refactoring-ode][functions] Updated descentParachute

parent aa10286a
Branches
No related tags found
1 merge request!3Refactoring ODE functions
function [dY, parout] = descentParachute(t, Y, rocket, environment, wind, parachute, newSettings, descent_data)
function [dY, parout] = descentParachute(t, Y, rocket, environment, wind, parachute, settings, descentData)
arguments
t
Y
......@@ -6,8 +6,8 @@ arguments
environment Environment
wind WindCustom {mustBeA(wind, {'WindCustom', 'WindMatlab'})}
parachute Parachute
newSettings Settings
descent_data struct
settings Settings
descentData struct
end
%{
descentParachute - ode function of the descent with parachute
......@@ -40,23 +40,23 @@ SPDX-License-Identifier: GPL-3.0-or-later
%% recalling the state
% x = Y(1);
% y = Y(2);
z = Y(3);
altitude = -Y(3);
u = Y(4);
v = Y(5);
w = Y(6);
%% CONSTANTS
if newSettings.simulator.stochNumber > 1
if isfield(settings.simulator.stochNumber)
% para = settings.stoch.para;
else
para = descent_data.para; % defined in stdRun {para = i; settings.paraNumber = para;}
para = descentData.para; % defined in stdRun {para = i; settings.paraNumber = para;}
end
stage = descent_data.stage;
stage = descentData.stage;
S = parachute(para, stage).S; % [m^2] Surface
CD = parachute(para, stage).CD; % [/] Parachute Drag Coefficient
CL = parachute(para, stage).CL; % [/] Parachute Lift Coefficient
S = parachute(para, stage).surface; % [m^2] Surface
CD = parachute(para, stage).cd; % [/] Parachute Drag Coefficient
CL = parachute(para, stage).cl; % [/] Parachute Lift Coefficient
if stage == 1
m = rocket.motor.structureMass - sum(rocket.stagesMass) - sum([parachute(:, stage+1:end).mass]);
......@@ -64,13 +64,13 @@ else
m = rocket.stagesMass(stage-1) + sum([parachute(:, stage).mass]);
end
g = environment.g0/(1 + (-z*1e-3/6371))^2; % [N/kg] module of gravitational field
g = environment.g0/(1 + (altitude*1e-3/6371))^2; % [N/kg] module of gravitational field
%% ADDING WIND (supposed to be added in NED axes);
if isa(wind, 'WindMatlab')
[uw, vw, ww] = wind.getVels(z, t);
[uw, vw, ww] = wind.getVels(altitude, t);
else
[uw, vw, ww] = wind.getVels(-z);
[uw, vw, ww] = wind.getVels(altitude);
end
windVels = [uw vw ww];
......@@ -83,8 +83,8 @@ wr = w - windVels(3);
V_norm = norm([ur vr wr]);
%% ATMOSPHERE DATA
absoluteAltitude = -z + environment.z0;
[~, a, P, rho] = atmosphereData(absoluteAltitude, g, local);
absoluteAltitude = altitude + environment.z0;
[~, ~, P, rho] = atmosphereData(absoluteAltitude, g, local);
%% REFERENCE FRAME
% The parachutes are approximated as rectangular surfaces with the normal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment