diff --git a/classes/@Rocket/Rocket.m b/classes/@Rocket/Rocket.m index 825e8360ef8caa2d09ce9628731c6f6616e89d73..eeb1e1f5ebce4afd156f8cdf876738041e258c57 100644 --- a/classes/@Rocket/Rocket.m +++ b/classes/@Rocket/Rocket.m @@ -16,7 +16,7 @@ classdef Rocket < Config cutoffTime (1, 1) double % [s] Shutdown time cutoffMass (1, 1) double % [m] Total mass at motor cutoff cutoffInertia (3, 1) double % [kg*m^2] Total inertia at motor cutoff - inertiaDot (3, :) double % [kg*m^2/s]Total inertia time derivative + inertiaDot (:, 3) double % [kg*m^2/s]Total inertia time derivative stagesMass (1, :) double % [kg] Mass of stage 2, 3, .. without chutes stagesInertia (3, :) double % [kg*m^2] Inertia of stage 2, 3, .. without chutes @@ -39,11 +39,11 @@ classdef Rocket < Config diameter (1, 1) double % [m] Diameter %% MASS PROPERTIES - mass (1, :) double % [kg] Total mass + mass (:, 1) double % [kg] Total mass massNoMotor (1, 1) double % [kg] Mass without motor - inertia (3, :) double % [kg*m^2] Total inertia - Axibody reference + inertia (:, 3) double % [kg*m^2] Total inertia - Axibody reference inertiaNoMotor (3, 1) double % [kg*m^2] Inertia without motor - xcg (1, :) double % [m] Total xCg + xcg (:, 1) double % [m] Total xCg xcgNoMotor (1, 1) double % [m] xCg without motor end diff --git a/classes/@Rocket/update.m b/classes/@Rocket/update.m index ab547d23b3200f924b28863ea9be7ed83ae74c73..1ea221d80e18070be22dfe3aa69a15cb041b3927 100644 --- a/classes/@Rocket/update.m +++ b/classes/@Rocket/update.m @@ -24,24 +24,24 @@ if ~override('XCG') end if ~override('INERTIA') - % [3xN] Ix, Iy, Iz + % [Nx3] Ix, Iy, Iz % Assumption: xCgs are close to rocket axis - motorInertia = obj.motor.inertia(2:3, :) + ... + motorInertia = obj.motor.inertia(:, 2:3) + ... (obj.xcg - (obj.motor.position + obj.motor.xcg)).^2 .* obj.motor.mass; - baysInertia = obj.inertiaNoMotor(2:3, :) + ... + baysInertia = obj.inertiaNoMotor(2:3, :)' + ... (obj.xcg - obj.xcgNoMotor).^2 .* obj.massNoMotor; - obj.INERTIA = [obj.motor.inertia(1, :) + obj.inertiaNoMotor(1, :); + obj.INERTIA = [obj.motor.inertia(:, 1) + obj.inertiaNoMotor(1, :),... motorInertia + baysInertia]; - obj.inertiaDot = diff(obj.INERTIA, 1, 2)./diff(obj.motor.time); - obj.inertiaDot(:, end + 1) = obj.inertiaDot(:, end); + obj.inertiaDot = diff(obj.INERTIA, 1, 1)./diff(obj.motor.time); + obj.inertiaDot(end + 1, :) = obj.inertiaDot(end, :); end %% Cutoff cutoffXcg = interp1(obj.time, obj.xcg, obj.cutoffTime, "linear", 'extrap'); obj.cutoffMass = interp1(obj.time, obj.mass, obj.cutoffTime, "linear", 'extrap'); -obj.cutoffInertia = interp1(obj.time, obj.INERTIA', obj.cutoffTime, "linear", 'extrap')'; +obj.cutoffInertia = interp1(obj.time, obj.INERTIA, obj.cutoffTime, "linear", 'extrap')'; %% Stages % TODO! generalize for n stages, variable input diff --git a/classes/bays/@Motor/Motor.m b/classes/bays/@Motor/Motor.m index 4ba795b8ba7e05a721052117793fcb420ef4903e..e7e07a9a0b81749eb52cec15a33d2984f2c1d6bb 100644 --- a/classes/bays/@Motor/Motor.m +++ b/classes/bays/@Motor/Motor.m @@ -30,11 +30,11 @@ classdef Motor < Bay end properties - thrust (1, :) double % [N] Engine thrust vector - propellantMass (1, :) double % [Kg] Propellant Mass in time - chamberPressure (1, :) double % [Pa] Pressure inside combustion chamber - pe (1, :) double % [Pa] Eflux pressure - time (1, :) double % [s] Engine time vector + thrust (:, 1) double % [N] Engine thrust vector + propellantMass (:, 1) double % [Kg] Propellant Mass in time + chamberPressure (:, 1) double % [Pa] Pressure inside combustion chamber + pe (:, 1) double % [Pa] Eflux pressure + time (:, 1) double % [s] Engine time vector cutoffTime double % [s] Shutdown time ignitionTransient (1, 1) double % [s] Ignition transient duration cutoffTransient (1, 1) double % [s] Cutoff transient duration diff --git a/classes/bays/@Motor/loadData.m b/classes/bays/@Motor/loadData.m index 5365122ad45304f2a76cf444e2d575034c8f0496..15326552c0719bc05d5a984641b0514253674c62 100644 --- a/classes/bays/@Motor/loadData.m +++ b/classes/bays/@Motor/loadData.m @@ -14,9 +14,10 @@ if isempty(chosenMotor) error(strcat('Unable to find engine: ', obj.name)); end -[obj.time, iUniqueTime] = unique(chosenMotor.t); -obj.thrust = chosenMotor.T(iUniqueTime); -obj.propellantMass = chosenMotor.m(iUniqueTime); +[obj.time, iUniqueTime] = unique(chosenMotor.t); +obj.time = obj.time'; +obj.thrust = chosenMotor.T(iUniqueTime)'; +obj.propellantMass = chosenMotor.m(iUniqueTime)'; obj.structureMass = chosenMotor.mc; if contains(obj.name, 'HRE') @@ -33,20 +34,20 @@ if obj.type == "Hybrid" obj.tankLength = chosenMotor.Ltank; end obj.fuelMass = chosenMotor.mFu; - obj.oxidizerMass = chosenMotor.mOx; - inertiaRaw = [chosenMotor.Ixx;chosenMotor.Iyy;chosenMotor.Izz]; - obj.INERTIA = inertiaRaw(:, iUniqueTime); - obj.XCG = chosenMotor.xcg(iUniqueTime); - obj.pe = chosenMotor.Pe(iUniqueTime); + obj.oxidizerMass = chosenMotor.mOx; + inertiaRaw = [chosenMotor.Ixx',chosenMotor.Iyy',chosenMotor.Izz']; + obj.INERTIA = inertiaRaw(iUniqueTime, :); + obj.XCG = chosenMotor.xcg(iUniqueTime)'; + obj.pe = chosenMotor.Pe(iUniqueTime)'; obj.ae = chosenMotor.Ae; obj.fuselageMass = chosenMotor.mFus; if ~isempty(chosenMotor.Pc) - obj.chamberPressure = chosenMotor.Pc; + obj.chamberPressure = chosenMotor.Pc'; end obj.MASS = obj.propellantMass + obj.structureMass; else obj.length = chosenMotor.L/1000; % lengths are saved in mm for solid motors - obj.xcg = obj.length/2 * ones(1, size(obj.time, 2)); + obj.xcg = obj.length/2 * ones(size(obj.time, 1), 1); end if isempty(obj.cutoffTime) || obj.cutoffTime > obj.time(end) diff --git a/classes/bays/@Motor/validateTimeDependent.m b/classes/bays/@Motor/validateTimeDependent.m index 458350973afe3cdf66fbb27d8f146029cdbaa86c..6c2eec29a537afacabb3adf34dd9a90b9425a1f3 100644 --- a/classes/bays/@Motor/validateTimeDependent.m +++ b/classes/bays/@Motor/validateTimeDependent.m @@ -2,7 +2,7 @@ function out = validateTimeDependent(obj, value) len = length(obj.time); if isempty(obj.time), out = value; return; end -if size(value, 2) == 1, out = repmat(value, 1, len); return; end +if size(value, 1) == 1, out = repmat(value, len, 1); return; end if length(value) ~= length(obj.time) error = MException( ... 'MSA:badInput', ... diff --git a/functions/miscellaneous/interpLinear.m b/functions/miscellaneous/interpLinear.m index 27667a551485e87a054038d20c623b2f21062842..e4b517c592f57dbe43248e53743f2bcf0238847e 100644 --- a/functions/miscellaneous/interpLinear.m +++ b/functions/miscellaneous/interpLinear.m @@ -31,9 +31,9 @@ SPDX-License-Identifier: GPL-3.0-or-later %} -Lx = size(X, 2); +Lx = size(X, 1); -if Lx ~= size(V, 2), error ('Length of X and V should be the same'); end +if Lx ~= size(V, 1), error ('Length of X and V should be the same'); end if ~allowExtrapolation if Xq > X(end) || Xq < X(1) @@ -49,10 +49,10 @@ else end end -if Xq == X(1), Vq = V(:, 1); return; end +if Xq == X(1), Vq = V(1, :); return; end Xu = Xq>X; i = sum(Xu); if ~all(Xu(1:i)), error("X vector not suitable for interpolation, check for duplicates"); end -Vq = (V(:,i+1)-V(:,i))/(X(i+1)-X(i))*(Xq-X(i)) + V(:,i); +Vq = (V(i+1, :)-V(i, :))/(X(i+1)-X(i))*(Xq-X(i)) + V(i, :); end \ No newline at end of file diff --git a/missions/2025_Orion_Portugal_October/data/aeroCoefficients.mat b/missions/2025_Orion_Portugal_October/data/aeroCoefficients.mat index b3c1b232046a3a87cdee3944653945372648719d..f805295c3c2284b72a20319eab06faa0e7e0c799 100644 --- a/missions/2025_Orion_Portugal_October/data/aeroCoefficients.mat +++ b/missions/2025_Orion_Portugal_October/data/aeroCoefficients.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75ad0a581c512de8f345a79f16d8e3d2bf681547eb386ce000434c66d6b292e0 -size 288267248 +oid sha256:804ee530753cc6412a11880a4acc9e06fe59cc47a5e6e52f1434ea885c9ad739 +size 303053681 diff --git a/missions/2025_Orion_Portugal_October/data/aeroCoefficientsHighAOA.mat b/missions/2025_Orion_Portugal_October/data/aeroCoefficientsHighAOA.mat index 9bd98f086dcafb9f9cdb22dcf40d83a9c8ea127d..fc3268780fcf12067c15e1524534cd490e602985 100644 --- a/missions/2025_Orion_Portugal_October/data/aeroCoefficientsHighAOA.mat +++ b/missions/2025_Orion_Portugal_October/data/aeroCoefficientsHighAOA.mat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da4a2977b055341314ba88e9698ffbac9702c2e57e9b876c67ea2da01631b783 -size 40438794 +oid sha256:152d9bac8c5298d3cabeeaa9547cd7a120adb450bf1f8be494f6fc00ea23ee1f +size 46224244