From 41679f0c7ea2528499135a28e3a91d5ecab2d450 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Mon, 24 Mar 2025 23:10:40 +0100
Subject: [PATCH] [handle-value-conversion] Fixed motor retrocompatibility

---
 classes/bays/@Motor/Motor.m    | 26 +++++++++++++-------------
 classes/bays/@Motor/loadData.m |  4 +++-
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/classes/bays/@Motor/Motor.m b/classes/bays/@Motor/Motor.m
index e49fe4e..0d95681 100644
--- a/classes/bays/@Motor/Motor.m
+++ b/classes/bays/@Motor/Motor.m
@@ -27,23 +27,23 @@ classdef Motor < Bay
     %% Motor properties
     properties(SetAccess = private)
         type                (1, 1)  MotorType       % [-]  Motor type - Solid, Hybrid, Liquid
+    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
-    end
-
-    properties
-        time                double                  % [s]  Engine time vector
-        cutoffTime          double                  % [s]  Shutdown time
-        ignitionTransient   double                  % [s]  Ignition transient duration
-        cutoffTransient     double                  % [s]  Cutoff transient duration
-        tankLength          double                  % [m]  Tank length
-        fuelMass            double                  % [kg] Fuel grain initial mass
-        oxidizerMass        double                  % [kg] Oxidizer initial mass
-        structureMass       double                  % [kg] Engine Structural Mass
-        fuselageMass        double                  % [kg] Fuselage of the engine only
-        ae                  double                  % [Pa] Eflux Area
+        time                (1, :)  double          % [s]  Engine time vector
+        cutoffTime          (1, 1)  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
+        fuelMass            (1, 1)  double          % [kg] Fuel grain initial mass
+        oxidizerMass        (1, 1)  double          % [kg] Oxidizer initial mass
+        structureMass       (1, 1)  double          % [kg] Engine Structural Mass
+        fuselageMass        (1, 1)  double          % [kg] Fuselage of the engine only
+        ae                  (1, 1)  double          % [Pa] Eflux Area
     end
 
     properties(Constant, Access = protected)
diff --git a/classes/bays/@Motor/loadData.m b/classes/bays/@Motor/loadData.m
index 30a56a7..5bceb7f 100644
--- a/classes/bays/@Motor/loadData.m
+++ b/classes/bays/@Motor/loadData.m
@@ -39,7 +39,9 @@ if obj.type == "Hybrid"
     obj.pe              = chosenMotor.Pe(iUniqueTime);   
     obj.ae              = chosenMotor.Ae;   
     obj.fuselageMass    = chosenMotor.mFus; 
-    obj.chamberPressure = chosenMotor.Pc;
+    if isfield(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
-- 
GitLab