diff --git a/missions/2024_Lyra_Roccaraso_September/config/controlConfig.m b/missions/2024_Lyra_Roccaraso_September/config/controlConfig.m index 6811037a22449eab83a437a29e1d95ebaa7ee7f1..0fe845b95d89b806324d8407f15dd8875bdead0c 100644 --- a/missions/2024_Lyra_Roccaraso_September/config/controlConfig.m +++ b/missions/2024_Lyra_Roccaraso_September/config/controlConfig.m @@ -14,6 +14,7 @@ % - settings.dtControl: define the usage time of the i-th % configuration. Its length must be -1 the % length of settings.control +control = Control(); control.multipleAB = false; % If true, multiple and smooth airbrakes opening will be simulated control.opening = [1 3]; % aerobrakes, 1-2-3 for 0%, 50% or 100% opened diff --git a/missions/2024_Lyra_Roccaraso_September/config/conversionsConfig.m b/missions/2024_Lyra_Roccaraso_September/config/conversionsConfig.m new file mode 100644 index 0000000000000000000000000000000000000000..3d56f8776f812cf9c00403f7dc4d8aca48ab92a0 --- /dev/null +++ b/missions/2024_Lyra_Roccaraso_September/config/conversionsConfig.m @@ -0,0 +1,39 @@ +% CONFIG - This script sets up control parameters + +settings = loadConfig("settingsConfig.m"); +geometry = loadConfig("geometryConfig.m"); +engine = loadConfig("engineConfig.m"); + +if settings.addMfusMot + corrections.xcgNoMot = (geometry.mNoMot*geometry.xcgNoMot + ... + engine.fuselage.mFuselage*(engine.fuselage.xcgFuselage + geometry.center.length ))... + /(goemetry.mNoMot + engine.fuselage.mFuselage); + corrections.mNoMot = geometry.mNoMot + engine.fuselage.mFuselage; +else + corrections.mNoMot = geometry.mNoMot; + corrections.xcgNoMot = geometry.xcgNoMot; +end + +%% SYNTHESIS +corrections.Lcenter = geometry.center.length + engine.motor.L; % [m] Total centerbody length +corrections.noseconeMass = 0; % [kg] Nosecone Mass +corrections.totStrMass = corrections.mNoMot + engine.motor.strMass + ... +corrections.noseconeMass; % [kg] Total structural Mass +corrections.m0 = corrections.totStrMass + engine.motor.expM(1); % [kg] Total initial Mass +corrections.mTotalTime = corrections.mNoMot + engine.motor.strMass + ... +corrections.noseconeMass + engine.motor.expM; % Total mass (in time) + +% Total XCG of the rocket [m] !! FROM NOSECONE BASE !! +corrections.xcg = ( (engine.motor.expM + engine.motor.strMass).*(geometry.center.length + engine.motor.xcg) + ... + corrections.mNoMot*corrections.xcgNoMot)./(engine.motor.expM + engine.motor.strMass + corrections.mNoMot); + +corrections.Lcenter = corrections.Lcenter - geometry.boat.length; % correcting the rocket length in order to account the boat tail + +%% APPLY CORRECTIONS + +if exist("correction.mat","file") + correctionData = load("correction.mat"); + corrections.mTotalTime = corrections.mTotalTime + correctionData.deltaM; + corrections.xcg = corrections.xcg + reshapeVector(engine.motor.expTime, correctionData.time, correctionData.deltaXcg); + corrections.totStrMass = corrections.totStrMass + correctionData.deltaM; +end \ No newline at end of file diff --git a/missions/2024_Lyra_Roccaraso_September/config/environmentConfig.m b/missions/2024_Lyra_Roccaraso_September/config/environmentConfig.m index 1f90f25bdb1ff9f1093f834625cccd88d6c700d4..91165eb0c3e129404492fcd01d841fb05ba05565 100644 --- a/missions/2024_Lyra_Roccaraso_September/config/environmentConfig.m +++ b/missions/2024_Lyra_Roccaraso_September/config/environmentConfig.m @@ -2,10 +2,11 @@ % % Use this file to write launch data, independent from the rocket itself +environment = Environment(); + environment.lat0 = 41.8084579; % [deg] Launchpad latitude environment.lon0 = 14.0546408; % [deg] Launchpad longitude environment.z0 = 1414; % [m] Launchpad Altitude -environment.g0 = gravitywgs84(environment.z0, environment.lat0); % Gravity costant at launch latitude and altitude environment.pin1Length = 000; % [m] Distance from the upper pin to the upper tank cap environment.pin2Length = 000; % [m] Distance from the lower pin to the lower tank cap environment.rampLength = 000; % [m] Total launchpad length diff --git a/missions/classes/Control.m b/missions/classes/Control.m new file mode 100644 index 0000000000000000000000000000000000000000..1a550e55565360190d3a0ca7f123bb6c47b0946d --- /dev/null +++ b/missions/classes/Control.m @@ -0,0 +1,33 @@ +classdef Control < Config + % CONTROL Summary of this class goes here + % Detailed explanation goes here + + properties + multipleAB logical % 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! ) + end + + properties(Access = protected) + configName = 'controlConfig.m' + mission Mission + motor Motor + end + + methods + function obj = Control(mission, motor) + arguments + mission Mission = Mission() + motor Motor = Motor() + end + obj.mission = mission; + obj.motor = motor; + if nargin == 0, return; end + obj.loadConfig(); + end + end +end diff --git a/missions/classes/Environment.m b/missions/classes/Environment.m index cd0f2f2e180a71ee4ad85aea98abd770e88a2b4e..6c503a6bd82519a49c3538e989c402d546b6bfdf 100644 --- a/missions/classes/Environment.m +++ b/missions/classes/Environment.m @@ -30,7 +30,7 @@ classdef Environment < Config function obj = Environment(mission, motor) arguments mission Mission = Mission() - motor Motor = Mission() + motor Motor = Motor() end obj.mission = mission; obj.motor = motor;