Skip to content
Snippets Groups Projects
Verified Commit 40f07757 authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

fix: issue with CF-CM calculation

parent 05163edb
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,6 @@ function ResData = resultsanalysis(matFiles) ...@@ -49,7 +49,6 @@ function ResData = resultsanalysis(matFiles)
ResData = calcinertia(ResData); ResData = calcinertia(ResData);
ResData = calctrueforces(ResData); ResData = calctrueforces(ResData);
ResData = calccoeff(ResData); ResData = calccoeff(ResData);
%
plotcf(ResData); plotcf(ResData);
plotclcd(ResData); plotclcd(ResData);
...@@ -100,8 +99,8 @@ function ResData = calcinertia(ResData) ...@@ -100,8 +99,8 @@ function ResData = calcinertia(ResData)
woIdx = woBounds(1):woBounds(2); woIdx = woBounds(1):woBounds(2);
% Calculate mean force and moments due to inertia % Calculate mean force and moments due to inertia
meanForces = mean(ResDataWO.(pos).forces(woIdx)); meanForces = mean(ResDataWO.(pos).forces(woIdx, :));
meanMom = mean(ResDataWO.(pos).moments(woIdx)); meanMom = mean(ResDataWO.(pos).moments(woIdx, :));
ResData(i, j).AllPhases.(pos).inertiaF = meanForces; ResData(i, j).AllPhases.(pos).inertiaF = meanForces;
ResData(i, j).AllPhases.(pos).inertiaM = meanMom; ResData(i, j).AllPhases.(pos).inertiaM = meanMom;
......
...@@ -109,25 +109,3 @@ function setgca() ...@@ -109,25 +109,3 @@ function setgca()
xlim([-180, 180]); xlim([-180, 180]);
grid on; grid on;
end end
function bool = isinteresting(ResData, interestingPlots)
% ISINTERESTING Return true if a result is listed in the interestingPlots array
% No need to plot when cF = 0
if ResData.Testcase.airspeed == 0
bool = false;
return
end
% If no interestingPlots defined, always plot all
if isempty(interestingPlots)
bool = true;
return
end
ResParam = [ResData.Testcase.dx, ...
ResData.Testcase.freq, ...
ResData.Testcase.airspeed];
bool = any(ismember(interestingPlots, ResParam, 'rows'));
end
...@@ -15,9 +15,33 @@ function plotclcd(ResData) ...@@ -15,9 +15,33 @@ function plotclcd(ResData)
% Plot airspeeds in different colors % Plot airspeeds in different colors
% for i = 1: size(ResData,1) % for i = 1: size(ResData,1)
for i = 2 OFFSET_STEPS = 20;
INTERESTING_PLOTS = [
0.03, 2, 7.7
0.03, 3, 2.5
0.03, 3, 4.6
0.03, 3.5, 2.5
0.03, 3.5, 4.6
0.03, 3.5, 7.7
0.05, 1.25, 4.6
0.05, 2, 7.7
0.05, 3, 7.7
0.05, 3.5, 2.5
0.05, 3.5, 7.7
0.10, 2.5, 4.6
0.10, 2.5, 7.7
0.10, 3.5, 2.5
0.10, 3.5, 4.6
0.10, 3.5, 7.7
];
for i = 1:size(ResData, 1)
for j = 1:size(ResData, 2) for j = 1:size(ResData, 2)
if ResData(i, j).Testcase.airspeed ~= 0 % No need to plot when cF = 0
if isinteresting(ResData(i, j), INTERESTING_PLOTS)
expParam = sprintf('d = %0.2f, f = %0.2f, V = %0.1f', ... expParam = sprintf('d = %0.2f, f = %0.2f, V = %0.1f', ...
ResData(i, j).Testcase.dx, ... ResData(i, j).Testcase.dx, ...
ResData(i, j).Testcase.freq, ... ResData(i, j).Testcase.freq, ...
......
...@@ -15,11 +15,12 @@ function [ResData] = calccoeff(ResData) ...@@ -15,11 +15,12 @@ function [ResData] = calccoeff(ResData)
for i = 1:size(ResData, 1) for i = 1:size(ResData, 1)
for j = 1:size(ResData, 2) for j = 1:size(ResData, 2)
dens = airdensity(ResData(i, j).Testcase.temp + C_TO_K, ...
ResData(i, j).Testcase.press);
speed = ResData(i, j).Testcase.airspeed;
for iPos = {'Front', 'Aft'} for iPos = {'Front', 'Aft'}
pos = string(iPos); pos = string(iPos);
dens = airdensity(ResData(i, j).Testcase.temp + C_TO_K, ...
ResData(i, j).Testcase.press);
speed = ResData(i, j).Testcase.airspeed;
for iPart = 1:size(ResData(i, j).AllPhases(1).(pos).meanF, 1) for iPart = 1:size(ResData(i, j).AllPhases(1).(pos).meanF, 1)
...@@ -27,9 +28,8 @@ function [ResData] = calccoeff(ResData) ...@@ -27,9 +28,8 @@ function [ResData] = calccoeff(ResData)
dens, speed, CHORD, SPAN, 'force'); dens, speed, CHORD, SPAN, 'force');
coeffM = forcetocoeff(ResData(i, j).AllPhases(1).(pos).meanM(iPart, :), ... coeffM = forcetocoeff(ResData(i, j).AllPhases(1).(pos).meanM(iPart, :), ...
dens, speed, CHORD, SPAN, 'moment'); dens, speed, CHORD, SPAN, 'moment');
ResData(i, j).AllPhases(1).(pos).cF(iPart, :) = coeffF; ResData(i, j).AllPhases(1).(pos).cF(iPart, :) = coeffF;
ResData(i, j).AllPhases(1).(pos).cF(iPart, :) = coeffM; ResData(i, j).AllPhases(1).(pos).cM(iPart, :) = coeffM;
end end
end end
end end
......
...@@ -26,6 +26,7 @@ function [ResData] = calctrueforces(ResData) ...@@ -26,6 +26,7 @@ function [ResData] = calctrueforces(ResData)
inF = 0; inF = 0;
inM = 0; inM = 0;
end end
% Raw force % Raw force
meanFraw = mean(ResData(i, j).(pos).forces(indexes(iPart, :), :)); meanFraw = mean(ResData(i, j).(pos).forces(indexes(iPart, :), :));
meanMraw = mean(ResData(i, j).(pos).moments(indexes(iPart, :), :)); meanMraw = mean(ResData(i, j).(pos).moments(indexes(iPart, :), :));
......
function bool = isinteresting(ResData, interestingPlots)
% ISINTERESTING Return true if a result is listed in the interestingPlots array
% Todo
% ----------------------------------------------------------------------------------------------
% (c) Copyright 2022 University of Liege
% Author: Thomas Lambert <t.lambert@uliege.be>
% ULiege - Aeroelasticity and Experimental Aerodynamics
% MIT License
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% No need to plot when cF = 0
if ResData.Testcase.airspeed == 0
bool = false;
return
end
% If no interestingPlots defined, always plot all
if isempty(interestingPlots)
bool = true;
return
end
ResParam = [ResData.Testcase.dx, ...
ResData.Testcase.freq, ...
ResData.Testcase.airspeed];
bool = any(ismember(interestingPlots, ResParam, 'rows'));
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment