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

[msa-refactoring][classes] Working Rocket

Main difference:
- fixed loadConfig to be able to load multiple variables from single file.
- updated bay configs (unified under rocketConfig.m)
parent 5a00091c
No related branches found
No related tags found
1 merge request!2Final data structure
Showing
with 34 additions and 24 deletions
......@@ -7,10 +7,6 @@ classdef Component < Config
mission Mission
end
properties(Access = protected)
variableName string = '';
end
methods
function obj = Component(mission, varsIn)
arguments (Input)
......@@ -44,7 +40,8 @@ classdef Component < Config
% obj.loadConfig(vars) - To load from given variables
fileName = obj.configName;
obj.variableName = strtok(fileName, 'C');
varName = obj.variableName;
if isempty(varName), varName = strtok(fileName, 'C'); end
switch nargin
case 1
......@@ -56,9 +53,9 @@ classdef Component < Config
end
run(fileName);
configObj = eval(obj.variableName);
configObj = eval(varName);
case 2
configObj = varargin{1}.(obj.variableName);
configObj = varargin{1}.(varName);
otherwise
error('Too many input arguments.')
end
......
......@@ -5,6 +5,7 @@ classdef(Abstract) Config < handle
properties(Abstract, Access = protected)
configName {mustBeTextScalar}
variableName char
end
methods(Abstract, Access = protected)
......
......@@ -19,6 +19,7 @@ classdef Mission < Config
properties(Access = protected)
configName = 'missionConfig.m'
variableName = ''
end
methods
......
......@@ -17,11 +17,13 @@ classdef Rocket < Bay
length
diameter
mass
massNoMotor
inertia
end
properties(Access = protected)
configName = 'rocketConfig.m'
variableName = ''
mission Mission
end
......
......@@ -21,7 +21,8 @@ classdef Airbrakes < Bay
end
properties(Access = protected)
configName = 'airbrakesConfig.m'
mission
configName = 'rocketConfig.m'
variableName = 'airbrakes'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -9,7 +9,8 @@ classdef Boat < Bay
end
properties(Access = protected)
configName = 'boatConfig.m'
mission
configName = 'rocketConfig.m'
variableName = 'boat'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -10,7 +10,8 @@ classdef Electronics < Bay
end
properties(Access = protected)
configName = 'electronicsConfig.m'
mission
configName = 'rocketConfig.m'
variableName = 'electronics'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -29,7 +29,8 @@ classdef Motor < Bay
properties(Access = protected)
configName = 'motorConfig.m'
mission
variableName = ''
mission Mission = Mission()
end
methods
......
......@@ -14,7 +14,8 @@ classdef Nose < Bay
end
properties(Access = protected)
configName = 'noseConfig.m'
mission
configName = 'rocketConfig.m'
variableName = 'nose'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -9,7 +9,8 @@ classdef Payload < Bay
end
properties(Access = protected)
configName = 'payloadConfig.m'
mission
configName = 'rocketConfig.m'
variableName = 'payload'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -9,7 +9,8 @@ classdef Recovery < Bay
end
properties(Access = protected)
configName = 'recoveryConfig.m'
mission
configName = 'rocketConfig.m'
variableName = 'recovery'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -15,7 +15,8 @@ classdef Fins < Component
end
properties(Access = protected)
configName = 'finsConfig.m'
mission Mission
configName = 'rocketConfig.m'
variableName = 'fins'
mission Mission = Mission()
end
end
\ No newline at end of file
......@@ -12,7 +12,8 @@ classdef Pitot < Component
end
properties(Access = protected)
configName = 'pitotConfig.m'
mission Mission
configName = 'rocketConfig.m'
variableName = 'pitot'
mission Mission = Mission()
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment