Skip to content
Snippets Groups Projects
Commit 381c138c authored by Matteo Gotti's avatar Matteo Gotti
Browse files

[refactoring-ode][classes] fixed inertiaNoMot in Rocket.m, updated Motor.m

     - First attempt of retrocompatibility with solid motors
parent 760ea1eb
Branches
No related tags found
1 merge request!3Refactoring ODE functions
......@@ -131,7 +131,7 @@ classdef Rocket < Component
inertias = [bNoMotor.inertia];
temp = inertias(2:3, :) + ...
(obj.xCgNoMotor' - (aPosNoMotor + [bNoMotor.xCg])).^2 .* [bNoMotor.mass];
obj.inertiaNoMotor = [sum(inertias(1)); sum(temp, 2)];
obj.inertiaNoMotor = [sum(inertias(1, :)); sum(temp, 2)];
end
function updateInertia(obj)
......
......@@ -58,18 +58,13 @@ classdef Motor < Bay
end
function mass = get.mass(obj)
mass = obj.propellantMass + ...
obj.structureMass; %+ obj.fuselageMass;
mass = obj.propellantMass + obj.structureMass;
end
function fuselageXCg = get.fuselageXCg(obj)
fuselageXCg = (obj.length - ...
obj.tankLength)/2 + obj.tankLength;
end
function isHRE = get.isHRE(obj)
isHRE = contains(obj.name, 'HRE');
end
end
methods (Access = protected)
......@@ -88,6 +83,9 @@ classdef Motor < Bay
error(strcat('Unable to find engine: ', obj.name));
end
obj.isHRE = contains(obj.name, 'HRE');
if obj.isHRE
obj.length = chosenMotor.L;
obj.tankLength = chosenMotor.Ltank;
obj.time = chosenMotor.t;
......@@ -96,12 +94,18 @@ classdef Motor < Bay
obj.oxidizerMass = chosenMotor.mOx;
obj.structureMass = chosenMotor.mc;
obj.propellantMass = chosenMotor.m;
obj.xCg = chosenMotor.xcg;
obj.inertia = [chosenMotor.Ixx;chosenMotor.Iyy;chosenMotor.Izz];
obj.xCg = chosenMotor.xcg;
obj.pe = chosenMotor.Pe;
obj.ae = chosenMotor.Ae;
obj.fuselageMass = chosenMotor.mFus;
else
obj.length = chosenMotor.L;
obj.time = chosenMotor.t;
obj.thrust = chosenMotor.T;
obj.propellantMass = chosenMotor.m;
obj.structureMass = chosenMotor.mc;
end
if isempty(obj.cutoffTime) || obj.cutoffTime > obj.time(end)
obj.cutoffTime = obj.time(end);
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment