Skip to content
Snippets Groups Projects
Commit e8796ac4 authored by Marco Luigi Gaibotti's avatar Marco Luigi Gaibotti
Browse files

[handle-value-conversion][Motor] Added input sanitisation for tank length and chamber pressure

parent 671da2f4
No related branches found
No related tags found
1 merge request!17Convertion from handle to value type classes
......@@ -35,7 +35,7 @@ classdef Motor < Bay
chamberPressure (1, :) double % [Pa] Pressure inside combustion chamber
pe (1, :) double % [Pa] Eflux pressure
time (1, :) double % [s] Engine time vector
cutoffTime (1, 1) double % [s] Shutdown time
cutoffTime double % [s] Shutdown time
ignitionTransient (1, 1) double % [s] Ignition transient duration
cutoffTransient (1, 1) double % [s] Cutoff transient duration
tankLength (1, 1) double % [m] Tank length
......@@ -73,8 +73,7 @@ classdef Motor < Bay
end
%% Bay implementation
% Getters
methods
methods % Getters
function value = get.name(obj)
value = obj.NAME;
end
......@@ -92,8 +91,7 @@ classdef Motor < Bay
end
end
% Setters
methods
methods % Setters
function obj = set.name(obj, name)
obj.NAME = name;
obj = obj.loadData();
......
......@@ -27,9 +27,10 @@ end
if obj.type == "Hybrid"
obj.length = chosenMotor.L;
obj.tankLength = chosenMotor.Ltank;
if isempty(obj.tankLength)
if isempty(chosenMotor.Ltank)
obj.tankLength = chosenMotor.LtankPr + chosenMotor.LtankOx;
else
obj.tankLength = chosenMotor.Ltank;
end
obj.fuelMass = chosenMotor.mFu;
obj.oxidizerMass = chosenMotor.mOx;
......@@ -39,7 +40,7 @@ if obj.type == "Hybrid"
obj.pe = chosenMotor.Pe(iUniqueTime);
obj.ae = chosenMotor.Ae;
obj.fuselageMass = chosenMotor.mFus;
if isfield(chosenMotor, 'Pc')
if ~isempty(chosenMotor.Pc)
obj.chamberPressure = chosenMotor.Pc;
end
obj.MASS = obj.propellantMass + obj.structureMass;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment