From e6e250f2d3ce4f2b258181e00d8681966bac3973 Mon Sep 17 00:00:00 2001 From: Lorenzo Bettonte <lorenzo.bettonte@skywarder.edu> Date: Sun, 18 May 2025 22:41:23 +0200 Subject: [PATCH] [alpha-phi] fixed a bug where n would in the wrong range (in Coefficient's class) and Handle AoA matrix usage in alphaTotPhi cases (in ballistic) --- classes/misc/Coefficient.m | 2 +- functions/odeFunctions/ballistic.m | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/classes/misc/Coefficient.m b/classes/misc/Coefficient.m index 35aed65..219bca8 100644 --- a/classes/misc/Coefficient.m +++ b/classes/misc/Coefficient.m @@ -131,7 +131,7 @@ classdef Coefficient coefficients(1:6) = obj.staticInterpolant(alphaTot, mach, psi, altitude, airbakes); % Get coeffs in limited range - if n > 1 % If necessary, perform rotation on different frame + if n > 0 % If necessary, perform rotation on different frame R = [cos(deltaPhi), -sin(deltaPhi); sin(deltaPhi), cos(deltaPhi)]; diff --git a/functions/odeFunctions/ballistic.m b/functions/odeFunctions/ballistic.m index d08b306..fed5600 100644 --- a/functions/odeFunctions/ballistic.m +++ b/functions/odeFunctions/ballistic.m @@ -134,7 +134,7 @@ end if not(abs(ur) < 1e-9 || velsNorm < 1e-9) alpha = atan(wr/ur); beta = atan(vr/ur); % beta = asin(vr/V_norm) is the classical notation, Datcom uses this one though. - % alpha_tot = atan(sqrt(wr^2 + vr^2)/ur); % datcom 97' definition + alphaTot = atan(sqrt(wr^2 + vr^2)/ur); % datcom 97' definition else alpha = 0; beta = 0; @@ -144,14 +144,17 @@ alphaOut = alpha; betaOut = beta; %% INTERPOLATE AERODYNAMIC COEFFICIENTS: - -if abs(alpha) > rocket.coefficients.state.alphas(end)*pi/180 || ... - abs(beta) > rocket.coefficients.state.betas(end)*pi/180 - coeffsValues = rocket.coefficientsHighAOA.get(alpha, mach, beta, absoluteAltitude, extension, xcg); +if rocket.coefficients.type == CoeffType.AlphaBeta + if abs(alpha) > rocket.coefficients.state.alphas(end)*pi/180 || abs(beta) > rocket.coefficients.state.betas(end)*pi/180 + coeffsValues = rocket.coefficientsHighAOA.get(alpha, mach, beta, absoluteAltitude, extension, xcg); + end +elseif abs(alphaTot) > rocket.coefficients.state.alphas(end)*pi/180 + coeffsValues = rocket.coefficientsHighAOA.get(alpha, mach, beta, absoluteAltitude, extension, xcg); else coeffsValues = rocket.coefficients.get(alpha, mach, beta, absoluteAltitude, extension, xcg); end + % Retrieve Coefficients CA = coeffsValues(1); CY = coeffsValues(2); CN = coeffsValues(3); Cl = coeffsValues(4); Cm = coeffsValues(5); Cn = coeffsValues(6); -- GitLab