From 76f8791de99310ed11c0a15f41b5029722ccbf3f Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Tue, 19 Sep 2023 16:21:33 +0200 Subject: [PATCH] chore(valid): add checks for spindir and hubpos --- src/configs/templatecoax.m | 9 +++++---- src/utils/preproc/validateconfig.m | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/configs/templatecoax.m b/src/configs/templatecoax.m index 764d984..0c64691 100644 --- a/src/configs/templatecoax.m +++ b/src/configs/templatecoax.m @@ -27,14 +27,15 @@ template; % Just load exisiting template % Adds a second element to the blade structure to represent the second rotor Blade(2) = Blade(1); % Make second rotor identical to first one +Blade(2).spinDir = -Blade(1).spinDir; % Spin in opposite direction from first rotor +% Shift second rotor w.r.t the application type if strcmp(Sim.Misc.appli, 'heli') - rotorShift = [0, 0, -1]; + rotorShift = [0, 0, -1] * Blade(1).radius(end); else - rotorShift = [-1, 0, 0]; + rotorShift = [-1, 0, 0] * Blade(1).radius(end); end -Blade(2).hubPos = Blade(1).hubPos + rotorShift; % Shift second rotor w.r.t the application type -Blade(2).spinDir = -Blade(1).spinDir; % Spin in opposite direction from first rotor +Blade(2).hubPos = Blade(1).hubPos + rotorShift; % ================================================================================================== % ===================================== Operating points =========================================== diff --git a/src/utils/preproc/validateconfig.m b/src/utils/preproc/validateconfig.m index 4869634..57fdc42 100644 --- a/src/utils/preproc/validateconfig.m +++ b/src/utils/preproc/validateconfig.m @@ -345,6 +345,16 @@ function Blade = checkblade(Blade, configFile, nAirfoils, DEF) '<=', nAirfoils}, ... configFile, 'Blade.iAirfoil'); + validateattributes(Blade(i).hubPos, ... + {'numeric'}, ... + {'vector', 'finite', 'nonnan', 'numel', 3}, ... + configFile, 'Blade.hubPos'); + validateattributes(Blade(i).spinDir, ... + {'numeric'}, ... + {'scalar', 'integer', 'nonzero', ... + '<=', 1, '>=', -1}, ... + configFile, 'Blade.spinDir'); + end % Discretization -- GitLab