diff --git a/classes/Bay.m b/classes/Bay.m index a364fa039a1d2e0b6f973afe495df7e12d087eb9..180b279dc12e0ba8893ec5292ddcfd79c5743121 100644 --- a/classes/Bay.m +++ b/classes/Bay.m @@ -1,7 +1,6 @@ classdef Bay < Component & matlab.mixin.Heterogeneous - % An abstraction class that enables a standardized management of data - % Properties and methods implemented in the Component class will - % impact every physical component of the rocket (e.g. motor, elc ...) +% Bay: Represents an abstraction layer for all bays +% Arrays of bay subclasses will be represented as [mxn Bay] arrays properties(Abstract) position % [m] Absolute position, relative to previous component diff --git a/classes/Component.m b/classes/Component.m index ea0b56b8b09563254e94f9eed4769998b602892f..6bb051022216469a0c2694bb7c81fa022cf87833 100644 --- a/classes/Component.m +++ b/classes/Component.m @@ -1,7 +1,7 @@ classdef Component < Config - %COMPONENT Summary of this class goes here - % Detailed explanation goes here - +% Component: Represents an abstraction layer for all components +% Components standardize object construction, config and data loading + properties(Abstract, Access = protected) % Insert dependencies here mission Mission diff --git a/classes/Config.m b/classes/Config.m index 0042af3dc0e9111361e7ad3b691a94062a824a69..7995125bce9b18b34df494e5632f85b25498acb6 100644 --- a/classes/Config.m +++ b/classes/Config.m @@ -1,7 +1,7 @@ classdef(Abstract) Config < handle - % An abstraction class that enables a standardized management of data - % Properties and methods implemented in the Config class will impact - % every data class in the framework (e.g. Component and its subclasses) +% Config: Represents an abstraction layer for all config-dependent Classes +% Config standardizes property management and declares fundemental +% properties (see doc for more info) properties(Abstract, Access = protected) configName {mustBeTextScalar} diff --git a/classes/Mission.m b/classes/Mission.m index c18fd9f8109a02db9e083921dae67977a25cb52a..d3b25085793431c12d3b85341275e127c818f321 100644 --- a/classes/Mission.m +++ b/classes/Mission.m @@ -1,11 +1,10 @@ classdef Mission < Config - % Class containing names and paths to access mission files - % This should be the first class to be created, - % when running a tool. - % - % To get an empty Mission, run "Mission()", or "Mission(false)" - % To get an initialized Mission, run "Mission(true)" - % Where the argument specifies whether to read config files or not +% Config: Contains names and paths needed to access mission-dependent config files +% +% To get an empty Mission, run "Mission()", or "Mission(false)" +% To get an initialized Mission, run "Mission(true)" +% Where the argument specifies whether to read config files or not + properties name % Mission name, used to access <mission> folder diff --git a/classes/Rocket.m b/classes/Rocket.m index 99affd78dd25488291ff9826706095af581b6c05..b56e56ee22edec5378da9cc95245061581d835cd 100644 --- a/classes/Rocket.m +++ b/classes/Rocket.m @@ -1,7 +1,15 @@ classdef Rocket < Component - %ROCKET Summary of this class goes here - % Detailed explanation goes here - +% Rocket: Contains and manages all bays +% +% Constructor: +% - Rocket: Creates an instance of the Rocket class. +% Loaded config: rocketConfig.m > rocket (for overrides) +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file + properties nose Nose = Nose() payload Payload = Payload() @@ -10,8 +18,6 @@ classdef Rocket < Component airbrakes Airbrakes = Airbrakes() motor Motor = Motor() rear Rear = Rear() - % fincan Fincan = Fincan() - % boat Boat = Boat() pitot Pitot = Pitot() diff --git a/classes/Settings.m b/classes/Settings.m index 7255fa5b849593134a85f7c8b88d865e2bf8e04e..e7a9e8d96f183838cec19f1badc9804ff4dc18fb 100644 --- a/classes/Settings.m +++ b/classes/Settings.m @@ -1,5 +1,16 @@ classdef Settings < Config & dynamicprops - +% Settings: Provides standardized way of loading config files +% Looks for files in missions > settings for global settings +% Looks for files in caller's folder otherwise +% +% Constructor: +% - Settings: Creates an instance of the Settings class. +% Loaded config: - +% Loaded data: - +% Arguments: +% - configNames: config file names. Accepts shortened version +% e.g: ode -> odeConfig.m + properties(Access = protected) configPath = '' configName = '' diff --git a/classes/bays/Airbrakes.m b/classes/bays/Airbrakes.m index c4d67b5ca8a8766a60976ef8d1572df3a2bdf803..34a5405e7276dcfb13021215c93fd1dab8c6347f 100644 --- a/classes/bays/Airbrakes.m +++ b/classes/bays/Airbrakes.m @@ -1,25 +1,33 @@ classdef Airbrakes < Bay - %AIRBRAKES Summary of this class goes here - % Detailed explanation goes here +% Airbrakes: Represents airbrakes configuration for a rocket. +% +% Constructor: +% - Airbrakes: Creates an instance of the Airbrakes class. +% Loaded config: rocketConfig.m > airbrakes +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file properties - n double % [-] number of brakes - thickness double % [m] brakes thickness - width double % [m] brakes width - xDistance double % [m] axial position from nosecone base - multipleAB {islogical} % If true, multiple and smooth airbrakes opening will be simulated - opening double % aerobrakes, 1-2-3 for 0%, 50% or 100% opened - deltaTime double % aerobrakes, configurations usage time - minTime double % [s] time after which the airbrakes can be used - maxMach double % [-] Maximum Mach at which airbrakes can be used - servoOmega double % [rad/s] Servo-motor angular velocity - height double % [m] Block airbrakes opening coordinate ( First entry must be 0! ) - position % [m] Offset with respect to other bays (negative -> shift forward) - length % [m] Total bay length - diameter % [m] Diameter of the bay - mass % [kg] Total bay mass - inertia % [kg*m^2] Total bay inertia (Body reference) - xCg % [m] Cg relative to bay upper side + n double % [-] number of brakes + thickness double % [m] brakes thickness + width double % [m] brakes width + xDistance double % [m] axial position from nosecone base + multipleAB {islogical} % If true, multiple and smooth airbrakes opening will be simulated + opening double % aerobrakes, 1-2-3 for 0%, 50% or 100% opened + deltaTime double % aerobrakes, configurations usage time + minTime double % [s] time after which the airbrakes can be used + maxMach double % [-] Maximum Mach at which airbrakes can be used + servoOmega double % [rad/s] Servo-motor angular velocity + height double % [m] Block airbrakes opening coordinate ( First entry must be 0! ) + position % [m] Offset with respect to other bays (negative -> shift forward) + length % [m] Total bay length + diameter % [m] Diameter of the bay + mass % [kg] Total bay mass + inertia % [kg*m^2] Total bay inertia (Body reference) + xCg % [m] Cg relative to bay upper side end properties(Access = protected) diff --git a/classes/bays/Boat.m b/classes/bays/Boat.m deleted file mode 100644 index 068eff1933677704dbbfd29321fb2f3512d09ca7..0000000000000000000000000000000000000000 --- a/classes/bays/Boat.m +++ /dev/null @@ -1,29 +0,0 @@ -classdef Boat < Bay - %GEOMETRY Summary of this class goes here - % Detailed explanation goes here - properties - type {mustBeMember(type, {'', 'CONE', 'OGIVE'})} = '' % [] Boat type - position % [m] Absolute position, relative to nose base - length % [m] Total bay length - diameter % [m] Final diameter of the bay - mass % [kg] Total bay mass - inertia % [kg*m^2] Total bay inertia (Body reference) - xCg % [m] Cg relative to bay upper side - end - - properties(Access = protected) - configName = 'rocketConfig.m' - variableName = 'boat' - mission Mission = Mission() - end - - methods - function obj = Boat(mission, varIn) - arguments(Input) - mission Mission = Mission() - varIn = [] - end - obj@Bay(mission, varIn); - end - end -end \ No newline at end of file diff --git a/classes/bays/Electronics.m b/classes/bays/Electronics.m index 3da511198d51ad5214082d982712d382c883fa9b..c7b419e29cb564fb49e7229cd8e1af6ea6d60c23 100644 --- a/classes/bays/Electronics.m +++ b/classes/bays/Electronics.m @@ -1,7 +1,14 @@ classdef Electronics < Bay - % An abstraction class that enables a standardized management of data - % Properties and methods implemented in the Component class will - % impact every physical component of the rocket (e.g. motor, elc ...) +% Electronics: Represents electronics configuration for a rocket. +% +% Constructor: +% - Electronics: Creates an instance of the Electronics class. +% Loaded config: rocketConfig.m > electronics +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file properties offset = 0 position % [m] Absolute position, relative to nose base diff --git a/classes/bays/Fincan.m b/classes/bays/Fincan.m deleted file mode 100644 index fba4ea2c371793b6fea071ec0636576ff0e621eb..0000000000000000000000000000000000000000 --- a/classes/bays/Fincan.m +++ /dev/null @@ -1,38 +0,0 @@ -classdef Fincan < Bay - %FINS Summary of this class goes here - % Detailed explanation goes here - - properties - mass % [kg] Fins mass - position % [m] Absolute position, relative to nose base - length - diameter - inertia - xCg % [m] Cg from fins root chord tip - rootChord double % [m] attached chord length - freeChord double % [m] free chord length - height double % [m] fin heigth - deltaXFreeChord double % [m] start of Chord 2 measured from start of Chord 1 - nPanel double % [m] number of fins - leadingEdgeRadius double % [deg] Leading edge radius at each span station - axialDistance double % [m] distance between end of root chord and end of center body - semiThickness double % [m] fin semi-thickness - maxThicknessPosition double % [m] Fraction of chord from leading edge to max thickness - end - - properties(Access = protected) - configName = 'rocketConfig.m' - variableName = 'fincan' - mission Mission = Mission() - end - - methods - function obj = Fincan(mission, varIn) - arguments(Input) - mission Mission = Mission() - varIn = [] - end - obj@Bay(mission, varIn); - end - end -end \ No newline at end of file diff --git a/classes/bays/Motor.m b/classes/bays/Motor.m index 41dfde0c3fcb586844f6503c8c83a16669adfd50..d58b4e135b0f90239dfd8eefb1e9d9a8623ff47b 100644 --- a/classes/bays/Motor.m +++ b/classes/bays/Motor.m @@ -1,7 +1,14 @@ classdef Motor < Bay - %MOTOR Summary of this class goes here - % Detailed explanation goes here - +% Motor: Represents the motor configuration for a rocket. +% +% Constructor: +% - Motor: Creates an instance of the Motor class. +% Loaded config: rocketConfig.m > motor +% Loaded data: motors.mat +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m file + properties name {mustBeTextScalar} = '' % [-] Motor name position % [m] Absolute position, relative to nose base @@ -51,7 +58,7 @@ classdef Motor < Bay function mass = get.mass(obj) mass = obj.propellantMass + ... - obj.structureMass; %+ obj.fuselageMass; + obj.structureMass + obj.fuselageMass; end function fuselageXCg = get.fuselageXCg(obj) diff --git a/classes/bays/Nose.m b/classes/bays/Nose.m index 8906d68f53beef1dc904aa47bcfe918e018268a6..1bdc032e84ecf968568a8a5f963d8c74e7ff7f50 100644 --- a/classes/bays/Nose.m +++ b/classes/bays/Nose.m @@ -1,6 +1,14 @@ classdef Nose < Bay - %NOSE Summary of this class goes here - % Detailed explanation goes here +% Nose: Represents nose configuration for a rocket. +% +% Constructor: +% - Nose: Creates an instance of the Nose class. +% Loaded config: rocketConfig.m > nose +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file properties ogiveType {mustBeMember(ogiveType, {'', 'CONE', 'OGIVE', ... diff --git a/classes/bays/Payload.m b/classes/bays/Payload.m index 3db6c22d3f7ea066a821ff49dde1e2553b644c2d..1c94ad74993995d77424fa70636ca75d5d58edfc 100644 --- a/classes/bays/Payload.m +++ b/classes/bays/Payload.m @@ -1,6 +1,15 @@ classdef Payload < Bay - %GEOMETRY Summary of this class goes here - % Detailed explanation goes here +% Payload: Represents payload configuration for a rocket. +% +% Constructor: +% - Payload: Creates an instance of the Payload class. +% Loaded config: rocketConfig.m > payload +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file + properties position % [m] Absolute position, relative to nose base length % [m] Total bay length diff --git a/classes/bays/Rear.m b/classes/bays/Rear.m index cd0b66d1ebab0a4a7fd00f28cc3469fad2446df2..33f1b9e10d9f7cb077ee6c437ece03de876788af 100644 --- a/classes/bays/Rear.m +++ b/classes/bays/Rear.m @@ -1,7 +1,15 @@ classdef Rear < Bay - %REAR Summary of this class goes here - % Detailed explanation goes here - +% Rear: Represents fincan + boat configuration for a rocket. +% +% Constructor: +% - Rear: Creates an instance of the Rear class. +% Loaded config: rocketConfig.m > rear +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file + properties position % [m] Absolute position, relative to nose base length % [m] Total bay length diff --git a/classes/bays/Recovery.m b/classes/bays/Recovery.m index 2c34c587a52d9c87df7713923c5c598acfa1a45a..1947b29244b270e1dc496960b9239c064d961e73 100644 --- a/classes/bays/Recovery.m +++ b/classes/bays/Recovery.m @@ -1,6 +1,15 @@ classdef Recovery < Bay - %GEOMETRY Summary of this class goes here - % Detailed explanation goes here +% Recovery: Represents recovery configuration for a rocket. +% +% Constructor: +% - Recovery: Creates an instance of the Recovery class. +% Loaded config: rocketConfig.m > recovery +% Loaded data: - +% Arguments: +% - mission: Mission, mission object +% - varIn: (optional) config source. Alternative to config.m +% file + properties position % [m] Absolute position, relative to nose base length % [m] Total bay length diff --git a/classes/old/Environment.asv b/classes/old/Environment.asv deleted file mode 100644 index 32e64319ce3e8e789f7d43ca44604a53fdacd777..0000000000000000000000000000000000000000 --- a/classes/old/Environment.asv +++ /dev/null @@ -1,54 +0,0 @@ -classdef Environment < Config - %ENVIRONMENT Summary of this class goes here - % Detailed explanation goes here - - properties - lat0 double % [deg] Launchpad latitude - lon0 double % [deg] Launchpad longitude - z0 double % [m] Launchpad Altitude - pin1Length double % [m] Distance from the upper pin to the upper tank cap - pin2Length double % [m] Distance from the lower pin to the lower tank cap - rampLength double % [m] Total launchpad length - temperature double % [deg] Ground temperature - pressure double % [Pa] Ground pressure - rho double % [Kg/m^3] Gorund air density - end - - properties(Dependent) - g0 double % [-] Gravity costant at launch latitude and altitude - pinDistance double % [m] Distance of the upper pin from the rail base (upper pin-boat + boat-rail base) - effectiveRampLength double % [m] Total launchpad length - end - - properties(Access = protected) - configName = 'environmentConfig.m' - mission Mission - motor Motor - end - - methods - function obj = Environment(mission, motor) - arguments - mission Mission = Mission() - motor Motor = Mission() - end - obj.mission = mission; - obj.motor = motor; - if nargin == 0, return; end - obj.loadConfig(); - end - - function g0 = get.g0(obj) - g0 = gravitywgs84(obj.z0, obj.lat0); - end - - function pinDistance = get.pinDistance(obj) - pinDistance = obj.pin1Length + obj.pin2Length ... - + obj.motor.tankLength; - end - - function effectiveRampLength = get.effectiveRampLength(obj) - effectiveRampLength = gravitywgs84(obj.z0, obj.lat0); - end - end -end \ No newline at end of file diff --git a/classes/old/Geometries.m b/classes/old/Geometries.m deleted file mode 100644 index 1f2706deb20b0e5be5a9faef709cfd48c0ef6174..0000000000000000000000000000000000000000 --- a/classes/old/Geometries.m +++ /dev/null @@ -1,57 +0,0 @@ -classdef(InferiorClasses = {?Boat, ?Center, ?Nose, ?Pitot, ?Fins, ?Protuberances}) ... - Geometries < Config - %GEOMETRY Summary of this class goes here - % Detailed explanation goes here - - properties - boat Boat = Boat() - center Center = Center() % Center (Excluding motor) - nose Nose = Nose() - pitot Pitot = Pitot() - fins Fins = Fins() - protuberances Protuberances = Protuberances() - nXCg {mustBePositive, mustBeInteger} - xCgNoMotor double - end - - properties(Dependent) % Center + motor length - length double - xCg (1,:) double - end - - properties(Access = protected) - configName = 'geometryConfig.m' - mission Mission - motor Motor - mass Masses - end - - methods - function obj = Geometries(mission, motor, mass) - %GEOMETRY Construct an instance of this class - % Detailed explanation goes here - %obj; - arguments (Input) - mission Mission = Mission() - motor Motor = Motor() - mass Masses = Masses() - end - obj.mission = mission; - obj.motor = motor; - obj.mass = mass; - if nargin == 0, return; end - if nargin ~= 3, error('Wrong input arguments count: only specify 2 arguments'); end - obj.loadConfig(); - end - - function xCg = get.xCg(obj) - xCg = (obj.motor.totalMass.*(obj.center.length + obj.motor.xCg) + ... - obj.mass.noMotor*obj.xCgNoMotor)./(obj.motor.totalMass + obj.mass.noMotor); - end - - function length = get.length(obj) - length = obj.center.length + ... - obj.motor.totalLength; - end - end -end \ No newline at end of file diff --git a/classes/old/Masses.m b/classes/old/Masses.m deleted file mode 100644 index 5114576a4c86d8e6c19bdd7390daf99d2dd55c2a..0000000000000000000000000000000000000000 --- a/classes/old/Masses.m +++ /dev/null @@ -1,52 +0,0 @@ -classdef Masses < Config - %MASS Summary of this class goes here - % Detailed explanation goes here - - properties - boat % [kg] BoatTail Mass - center % [kg] Center Mass (no motor) - nose % [kg] Nosecone Mass - fins % [kg] Finset Mass - end - - properties(Dependent) - noMotor % [kg] Total mass (no motor) - structure % [kg] Total structural Mass - total % [kg] Total mass (in time) - end - - properties(Access = protected) - configName = 'massConfig.m' - mission Mission - motor Motor - end - - methods - function obj = Masses(mission, motor) - arguments (Input) - mission Mission = Mission() - motor Motor = Motor() - end - obj.mission = mission; - obj.motor = motor; - if nargin == 0, return; end - if nargin ~= 2, error('Wrong input arguments count: only specify 2 arguments'); end - obj.loadConfig(); - end - - function noMotor = get.noMotor(obj) - noMotor = obj.boat + obj.center + ... - obj.nose + obj.fins; - end - - function structure = get.structure(obj) - structure = obj.noMotor + ... - obj.motor.structureMass; - end - - function total = get.total(obj) - total = obj.noMotor + ... - obj.motor.totalMass; - end - end -end \ No newline at end of file diff --git a/tests/argValidation.m b/tests/argValidation.m deleted file mode 100644 index 96633f8ad9a7f00d4c42f0fb1c77b8c65f3dece4..0000000000000000000000000000000000000000 --- a/tests/argValidation.m +++ /dev/null @@ -1,11 +0,0 @@ -function test(in) - arguments(Input) - in Config {mustBeConfig} - end - disp(in.a); -end - -function mustBeConfig(obj) - if ~isa(obj, 'Config'), error('suca'); - end -end \ No newline at end of file diff --git a/tests/speedBenchmark.asv b/tests/speedBenchmark.asv deleted file mode 100644 index 1388be0e6f1ef8be1f34f7e9237e143556ce35e9..0000000000000000000000000000000000000000 --- a/tests/speedBenchmark.asv +++ /dev/null @@ -1,22 +0,0 @@ -ms = Mission(true); - -cl = Motor(ms); -st = struct(cl); - -len = length(st.xCg); -a = zeros(1, len); -b = zeros(1, len); - -tic - for i = 1:len - a(i) = cl.xCg(i); - end -classTime = toc; - -tic - for i = 1:len - b(i) = st.xCg(i); - end -structTime = toc; - -disp(strcat('classTime: ', classTime)); \ No newline at end of file diff --git a/tests/speedBenchmark.m b/tests/speedBenchmark.m deleted file mode 100644 index 5c2c39edc619e9584e9787817643767534da0b94..0000000000000000000000000000000000000000 --- a/tests/speedBenchmark.m +++ /dev/null @@ -1,32 +0,0 @@ -clear; clc; close all; - -ms = Mission(true); - -cl = Motor(ms); -st = struct(cl); - -len = length(st.xCg); -a = zeros(1, len); -b = zeros(1, len); -c = zeros(1, len); -d = zeros(1, len); - -tic -a = cl.xCg; -fprintf('stdAssignment, class: %f s\n', toc); - -tic -c = st.xCg; -fprintf('stdAssignment, struct: %f s\n', toc); - -tic -for i = 1:len - b(i) = cl.xCg(i); -end -fprintf('elementWiseAssignment, class: %f s\n', toc); - -tic -for i = 1:len - d(i) = st.xCg(i); -end -fprintf('elementWiseAssignment, struct: %f s\n', toc); \ No newline at end of file