diff --git a/functions/miscellaneous/interpCoeffs.m b/functions/miscellaneous/interpCoeffs.m index bbfebf5ce1e4ba8a814dc290a3a2cd29b5d4aef8..d6d867a0640826b4bf384ee98beefab46d7db968 100644 --- a/functions/miscellaneous/interpCoeffs.m +++ b/functions/miscellaneous/interpCoeffs.m @@ -1,4 +1,4 @@ -function [coeffsValues, angle0] = interpCoeffs(t, alpha, M, beta, alt, c, settings) +function [coeffsValues, angle0] = interpCoeffs(t, alpha, M, beta, alt, c, aerodynamics, settings) %{ interpCoeffs - interpolation of aerodynamic coefficients. diff --git a/missions/2024_Lyra_Roccaraso_September/data/aerodynamics.mat b/missions/2024_Lyra_Roccaraso_September/data/aerodynamics.mat new file mode 100644 index 0000000000000000000000000000000000000000..b4fe7f40100a274ac7ef733e753e24917d61d0b8 --- /dev/null +++ b/missions/2024_Lyra_Roccaraso_September/data/aerodynamics.mat @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6aef0549361528025e4525ad22a9938063135c5467b5a93e6e8e1661789868ba +size 61487003 diff --git a/missions/classes/Aerodynamics.m b/missions/classes/Aerodynamics.m new file mode 100644 index 0000000000000000000000000000000000000000..ea36f029a69a8c28be4001ca5c3c6be764a59af2 --- /dev/null +++ b/missions/classes/Aerodynamics.m @@ -0,0 +1,53 @@ +classdef Aerodynamics < Config + %AERODYNAMICS Summary of this class goes here + % Detailed explanation goes here + + properties + + end + + properties(Access = protected) + configName = ''; + mission Mission + end + + methods + function obj = Aerodynamics(inputArg1,inputArg2) + %AERODYNAMICS Construct an instance of this class + % Detailed explanation goes here + obj.Property1 = inputArg1 + inputArg2; + end + + function outputArg = method1(obj,inputArg) + %METHOD1 Summary of this method goes here + % Detailed explanation goes here + outputArg = obj.Property1 + inputArg; + end + end + + methods(Access = private) + function obj = loadData(obj) + if isempty(obj.mission.name) || isempty(obj.name), return; end + load(fullfile(obj.mission.dataPath, 'aeroCoefficients.mat'), 'CoeffsTot', 'Geometry', 'State'); + chosenMotor = motors(strcmp({motors.MotorName}, obj.name)); + if isempty(chosenMotor), error(strcat('Unable to find engine: ', obj.name)); end + + obj.motorLength = chosenMotor.L; + obj.tankLength = chosenMotor.Ltank; + obj.time = chosenMotor.t; + obj.thrust = chosenMotor.T; + obj.fuelMass = chosenMotor.mFu; + obj.oxidizerMass = chosenMotor.mOx; + obj.propellantMass = chosenMotor.m; + obj.structureMass = chosenMotor.mc; + obj.xCg = chosenMotor.xcg; + obj.pe = chosenMotor.Pe; + obj.ae = chosenMotor.Ae; + obj.fuselageMass = chosenMotor.mFus; + obj.Ixx = chosenMotor.Ixx; + obj.Iyy = chosenMotor.Iyy; + obj.Izz = chosenMotor.Izz; + end + end +end + diff --git a/tests/ascent.m b/tests/ascent.m index 68c48c4645183f108918da7dd05339a03d8e226b..521606d020d7402eabae5195b6648723526d4d80 100644 --- a/tests/ascent.m +++ b/tests/ascent.m @@ -118,19 +118,20 @@ Q = [q0 q1 q2 q3]; Q = Q/norm(Q); %% ADDING WIND (supposed to be added in NED axes); -if settings.wind.model - +% if settings.wind.model % if settings.stoch.N > 1 % [uw, vw, ww] = windMatlabGenerator(settings, z, t, Hour, Day); % else - [uw, vw, ww] = windMatlabGenerator(settings, z, t); % prende wind, env + % [uw, vw, ww] = windMatlabGenerator(settings, z, t); % prende wind, env % end +% elseif settings.wind.input +% [uw, vw, ww] = windInputGenerator(settings, z, uncert); +% elseif settings.wind.variable +% [uw, vw, ww] = windVariableGenerator(z, settings.stoch); +% end -elseif settings.wind.input - [uw, vw, ww] = windInputGenerator(settings, z, uncert); -elseif settings.wind.variable - [uw, vw, ww] = windVariableGenerator(z, settings.stoch); -end +[uw,vw] = atmoshwm(environment.lat0,environment.lon0,environment.z0); % NED reference +ww = 0; dcm = quatToDcm(Q); wind = dcm*[uw; vw; ww]; @@ -157,7 +158,6 @@ M_value = M; %% TIME-DEPENDENTS VARIABLES if t < tb - if t < settings.timeEngineCut m = interpLinear(motor.time, motor.totalMass, t); T = interpLinear(motor.time, motor.thrust, t); @@ -339,52 +339,52 @@ dY(10:13) = dQQ; dY = dY'; %% SAVING THE QUANTITIES FOR THE PLOTS - -if nargout == 2 - parout.integration.t = t; - - parout.interp.M = M_value; - parout.interp.alpha = alpha_value; - parout.interp.beta = beta_value; - parout.interp.alt = -z; - parout.interp.mass = m; - parout.interp.inertias = [Ixx, Iyy, Izz]; - - parout.wind.NED_wind = [uw, vw, ww]; - parout.wind.body_wind = wind; - - parout.rotations.dcm = dcm; - - parout.velocities = Vels; - - parout.forces.AeroDyn_Forces = [X, Y, Z]; - parout.forces.T = T; - - parout.air.rho = rho; - parout.air.P = P; - - parout.accelerations.body_acc = [du, dv, dw]; - parout.accelerations.ang_acc = [dp, dq, dr]; - - parout.coeff.CA = CA; - parout.coeff.CYB = CYB; - parout.coeff.CNA = CNA; - parout.coeff.Cl = Cl; - parout.coeff.Clp = Clp; - %-------------------------------------------- - %parout.coeff.Clb = Clb; - %-------------------------------------------- - parout.coeff.Cma = Cma; - parout.coeff.Cmad = Cmad; - parout.coeff.Cmq = Cmq; - parout.coeff.Cnb = Cnb; - parout.coeff.Cnr = Cnr; - parout.coeff.Cnp = Cnp; - parout.coeff.XCPlon = XCPlon; - parout.coeff.XCPlat = XCPlat; - - - parout.coeff.XCPtot = XCPtot; - - -end \ No newline at end of file +% +% if nargout == 2 +% parout.integration.t = t; +% +% parout.interp.M = M_value; +% parout.interp.alpha = alpha_value; +% parout.interp.beta = beta_value; +% parout.interp.alt = -z; +% parout.interp.mass = m; +% parout.interp.inertias = [Ixx, Iyy, Izz]; +% +% parout.wind.NED_wind = [uw, vw, ww]; +% parout.wind.body_wind = wind; +% +% parout.rotations.dcm = dcm; +% +% parout.velocities = Vels; +% +% parout.forces.AeroDyn_Forces = [X, Y, Z]; +% parout.forces.T = T; +% +% parout.air.rho = rho; +% parout.air.P = P; +% +% parout.accelerations.body_acc = [du, dv, dw]; +% parout.accelerations.ang_acc = [dp, dq, dr]; +% +% parout.coeff.CA = CA; +% parout.coeff.CYB = CYB; +% parout.coeff.CNA = CNA; +% parout.coeff.Cl = Cl; +% parout.coeff.Clp = Clp; +% %-------------------------------------------- +% %parout.coeff.Clb = Clb; +% %-------------------------------------------- +% parout.coeff.Cma = Cma; +% parout.coeff.Cmad = Cmad; +% parout.coeff.Cmq = Cmq; +% parout.coeff.Cnb = Cnb; +% parout.coeff.Cnr = Cnr; +% parout.coeff.Cnp = Cnp; +% parout.coeff.XCPlon = XCPlon; +% parout.coeff.XCPlat = XCPlat; +% +% +% parout.coeff.XCPtot = XCPtot; +% +% +% end \ No newline at end of file