diff --git a/classes/Component.m b/classes/Component.m index f7c6b37a8a6316f2f794d76fc7bcd07c19587d74..554d155a7472aa558f8d523c1b48a79b859e2bed 100644 --- a/classes/Component.m +++ b/classes/Component.m @@ -64,7 +64,10 @@ classdef Component < Config else, configObj = obj.getConfig(); end fields = obj.getProperties('writable'); - for j = 1:size(fields, 2), obj.(fields{j}) = configObj.(fields{j}); end + for j = 1:size(fields, 2) + if isempty(configObj.(fields{j})), continue; end + obj.(fields{j}) = configObj.(fields{j}); + end end function outputVariables = getConfig(obj) diff --git a/classes/Rocket.m b/classes/Rocket.m index 7c0ae00d872baea70223f7a9dca2aab5cd35aa81..85593264572dbba5a471f5b6234c101d8a445f06 100644 --- a/classes/Rocket.m +++ b/classes/Rocket.m @@ -19,7 +19,7 @@ classdef Rocket < Component rear Rear % [-] Rear bay pitot Pitot % [-] Pitot component - parachutes Parachute % [-] Parachutes onboard + parachutes Parachute % [-] (nParachutes, nStages) Parachutes onboard length double % [m] Total length lengthCenterNoMot double % [m] Center length - no nose, no motor diff --git a/classes/components/Environment.m b/classes/components/Environment.m index 4e36921d3d17e41c67159ef215fe205ae8db044e..bacae3c281b2ebaef29cf4b8291d0ff10887f725 100644 --- a/classes/components/Environment.m +++ b/classes/components/Environment.m @@ -12,23 +12,25 @@ classdef Environment < Component % file properties - lat0 double % [deg] Launchpad latitude - lon0 double % [deg] Launchpad longitude - z0 double % [m] Launchpad Altitude - omega double % [deg] Launchpad Elevation - phi double % [deg] Launchpad Azimuth - pin1Length double % [m] Distance from the upper pin to the upper tank cap - pin2Length double % [m] Distance from the lower pin to the lower tank cap - rampLength double % [m] Total launchpad length - temperature double % [deg] Ground temperature - pressure double % [Pa] Ground pressure - rho double % [Kg/m^3] Gorund air density + lat0 double % [deg] Launchpad latitude + lon0 double % [deg] Launchpad longitude + z0 double % [m] Launchpad Altitude + omega double % [deg] Launchpad Elevation + phi double % [deg] Launchpad Azimuth + pin1Length double % [m] Distance from the upper pin to the upper tank cap + pin2Length double % [m] Distance from the lower pin to the lower tank cap + rampLength double % [m] Total launchpad length + + temperature double = 288.15 % [K] Ground temperature + pressure double % [Pa] Ground pressure + rho double % [Kg/m^3] Ground air density + gamma double = 1.4 % [-] Gas constant end properties(SetAccess = private) - g0 double % [-] Gravity costant at launch latitude and altitude - pinDistance double % [m] Distance of the upper pin from the rail base (upper pin-boat + boat-rail base) - effectiveRampLength double % [m] Total launchpad length + g0 double % [-] Gravity costant at launch latitude and altitude + pinDistance double % [m] Distance of the upper pin from the rail base (upper pin-boat + boat-rail base) + effectiveRampLength double % [m] Total launchpad length end properties(Access = protected) @@ -57,8 +59,9 @@ classdef Environment < Component obj.updateEffectiveRampLength; end end - - methods % Updaters + + % Updaters + methods function obj = updateG0(obj) obj.g0 = gravitywgs84(obj.z0, obj.lat0); end diff --git a/functions/eventFunctions/eventParaCut.m b/functions/eventFunctions/eventParaCut.m index c2dcc1ce4cd502b918e97f79524aae4033ef2cca..63f9b4fb883852af0a2f8db331b86fa570a3b7a2 100644 --- a/functions/eventFunctions/eventParaCut.m +++ b/functions/eventFunctions/eventParaCut.m @@ -1,4 +1,4 @@ -function [value, isterminal, direction] = eventParaCut(~, Y, ~, ~, ~, parachute, newSettings, descentData) +function [value, isterminal, direction] = eventParaCut(~, Y, rocket, ~, ~, settings, descentData) %{ stdDescent(ascent, rocket, environment, wind, parachute, newSettings) eventParaCut - Event function to stop simulation at the chosen altitude to cut the @@ -37,14 +37,14 @@ SPDX-License-Identifier: GPL-3.0-or-later % y = Y(2); altitude = -Y(3); -if ~isfield(newSettings.simulator,'stochNumber') +if ~isfield(settings.simulator,'stochNumber') para = descentData.para; else - para = newSettings.stoch.para; + para = settings.stoch.para; end stage = descentData.stage; -value = altitude - parachute(para, stage).finalAltitude; +value = altitude - rocket.parachutes(para, stage).finalAltitude; isterminal = 1; direction = 0; diff --git a/functions/odeFunctions/ballistic.m b/functions/odeFunctions/ballistic.m index 955e4a176210eab1bcc83f360b716d1d4f089291..c8e56f14618858419eb488d6f9e861ad9a5ce565 100644 --- a/functions/odeFunctions/ballistic.m +++ b/functions/odeFunctions/ballistic.m @@ -320,7 +320,7 @@ dY = dY'; %% SAVING THE QUANTITIES FOR THE PLOTS if nargout == 2 - parout.integration.time = theta; + %parout.integration.time = theta; parout.interp.mach = mach; parout.interp.alpha = alphaOut; @@ -329,8 +329,8 @@ if nargout == 2 parout.interp.mass = m; parout.interp.inertias = [Ixx, Iyy, Izz]; - parout.wind.NEDWind = [uw, vw, ww]; - parout.wind.bodyWind = windVels; + parout.wind.NED = [uw, vw, ww]; + parout.wind.body = windVels; parout.rotations.dcm = dcm; @@ -360,8 +360,4 @@ if nargout == 2 parout.coeff.XCPlon = XCPlon; parout.coeff.XCPlat = XCPlat; parout.coeff.XCPtot = XCPtot; - - if eventLanding(theta, Y) < 0 - clear highAOA; - end end \ No newline at end of file diff --git a/functions/odeFunctions/descentParachute.m b/functions/odeFunctions/descentParachute.m index 9f48cbedebce58a5509353ac7e354c8e21d5c610..c3ba7346ce14f3e3748fbe42cdbe0624fbe64bc0 100644 --- a/functions/odeFunctions/descentParachute.m +++ b/functions/odeFunctions/descentParachute.m @@ -1,12 +1,11 @@ -function [dY, parout] = descentParachute(t, Y, rocket, environment, wind, parachute, newSettings, descentData) +function [dY, parout] = descentParachute(t, Y, rocket, environment, wind, settings, descentData) arguments t Y rocket Rocket environment Environment wind WindCustom {mustBeA(wind, {'WindCustom', 'WindMatlab'})} - parachute Parachute - newSettings Settings + settings Settings descentData struct end %{ @@ -47,16 +46,16 @@ w = Y(6); %% CONSTANTS -if isfield(newSettings.simulator, 'stochNumber') - para = newSettings.stoch.para; %!!!!!!!!!! +if isfield(settings.simulator, 'stochNumber') + para = settings.stoch.para; %!!!!!!!!!! else para = descentData.para; % defined in stdRun {para = i; settings.paraNumber = para;} end stage = descentData.stage; -S = parachute(para, stage).surface; % [m^2] Surface -CD = parachute(para, stage).cd; % [/] Parachute Drag Coefficient -CL = parachute(para, stage).cl; % [/] Parachute Lift Coefficient +S = rocket.parachutes(para, stage).surface; % [m^2] Surface +CD = rocket.parachutes(para, stage).cd; % [/] Parachute Drag Coefficient +CL = rocket.parachutes(para, stage).cl; % [/] Parachute Lift Coefficient m = rocket.stagesMass(stage); diff --git a/missions/2024_Lyra_Portugal_October/config/environmentConfig.m b/missions/2024_Lyra_Portugal_October/config/environmentConfig.m index 44865c27c91f14758f50da7cb947fa15192be549..3340023439aa5691acc062ec9d4d3fbf2328df6f 100644 --- a/missions/2024_Lyra_Portugal_October/config/environmentConfig.m +++ b/missions/2024_Lyra_Portugal_October/config/environmentConfig.m @@ -13,6 +13,7 @@ environment.pin1Length = 0.5603; % [m] Distance from the upper pin to the environment.pin2Length = 0.2055; % [m] Distance from the lower pin to the lower tank cap environment.rampLength = 12; % [m] Total launchpad length -environment.temperature = []; % [deg] Ground temperature correction +environment.temperature = []; % [K] Ground temperature correction environment.pressure = []; % [Pa] Ground pressure correction -environment.rho = []; % [Kg/m^3] Gorund air density correction \ No newline at end of file +environment.rho = []; % [Kg/m^3] Gorund air density correction +environment.gamma = 1.4; % [-] Gas constant \ No newline at end of file diff --git a/missions/2024_Lyra_Portugal_October/config/parachuteConfig.m b/missions/2024_Lyra_Portugal_October/config/parachuteConfig.m index 87569fc4996f82ae48ace5e86f112e9f618ff1c8..43d696636cb617618ac4061565c2a513d277d99d 100644 --- a/missions/2024_Lyra_Portugal_October/config/parachuteConfig.m +++ b/missions/2024_Lyra_Portugal_October/config/parachuteConfig.m @@ -34,8 +34,8 @@ parachute(2, 1).chordK = 3000; % [N/m^2] Shock Chord Elastic Con parachute(2, 1).chordC = 0; % [Ns/m] Shock Chord Dynamic Coefficient parachute(2, 1).m = 1; % [m^2/s] Coefficient of the surface vs. time opening model parachute(2, 1).nf = 8.7; % [/] Adimensional Opening Time -parachute(2,1).forceCoefficient = 2.2; % [-] Empirical coefficient to obtain correct peak force at deployment -parachute(2,1).deployDuration= 0.9; % [s] Time to get the parachute to full aperture +parachute(2, 1).forceCoefficient = 2.2; % [-] Empirical coefficient to obtain correct peak force at deployment +parachute(2, 1).deployDuration= 0.9; % [s] Time to get the parachute to full aperture %% PAYLOAD CHUTES % parachute 1 @@ -61,4 +61,15 @@ parachute(2, 2) = Parachute(); parachute(2, 2).name = "Payload AIRFOIL"; parachute(2, 2).mass = 0.50; % [kg] Parachute Mass -parachute(2, 2).finalAltitude = 0; % [m] Final altitude of the parachute +parachute(2, 2).surface = 0.11; % [m^2] Surface +parachute(2, 2).cd = 0; % [/] Parachute Drag Coefficient +parachute(2, 2).cl = 0; % [/] Parachute Lift Coefficient +parachute(2, 2).openingDelay = 1; % [s] drogue opening delay +parachute(2, 2).finalAltitude = 0; % [m] Final altitude of the parachute +parachute(2, 2).cx = 1.4; % [/] Parachute Longitudinal Drag Coefficient +parachute(2, 2).chordLength = 1.5; % [m] Shock Chord Length +parachute(2, 2).chordK = 7200; % [N/m^2] Shock Chord Elastic Constant +parachute(2, 2).chordC = 0; % [Ns/m] Shock Chord Dynamic Coefficient +parachute(2, 2).m = 1; % [m^2/s] Coefficient of the surface vs. time opening model +parachute(2, 2).nf = 12; % [/] Adimensional Opening Time +parachute(2, 2).expulsionSpeed = 10; % [m/s] Expulsion Speed