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

chore: remove unused function

parent e1f53159
No related branches found
No related tags found
No related merge requests found
function res = process_wt(idFile, inputFiles)
% PROCESS_WT Processing of Wind Tunnel data.
% This code pareses processes and filters the raw wind tunnel data. If multiple files are
% loaded, it compares their mean measurements.
% -----
%
% Syntax:
% rotare() prompts the user to select a configuration file and then execute Rotare based on
% the loaded file.
%
% rotare(configFile) runs Rotare directly based on the parameters specified in the file
% `configFile`.
%
% Inputs:
% resDir: Base directory for results (typically <YYYY>-Series<X>).
% subDir: Subdirectory ('calibration', 'runs'). Can be left empty ([])
% filebase: Base filename to look for
%
% See also: readdata.
% ----------------------------------------------------------------------------------------------
% TODO:
% 1. Load identification table
% 2. Loop for all files specified in input
% 3. Look into table to associate the correct data
% 4. Analyze, plot, etc.
%
% ----------------------------------------------------------------------------------------------
% (c) Copyright 2022 University of Liege
% Author: Thomas Lambert <t.lambert@uliege.be>
% ULiege - Aeroelasticity and Experimental Aerodynamics
% MIT License
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clc;
% Defaults and constants
DT = 1 / 1000; % Acquisition step (acquisition @ 1kHz), [s]
SURFACE = 2 * 0.2 * 0.050; % Total wing surface (per module), [m^2]
WING_SEP = 0.03; % Wing separation distance (from TE1 to LE2), [m]
% ==============================================================================================
% ===================================== Input checks ===========================================
% ==============================================================================================
% Get filenames
if nargin < 2
[filenames, filepaths] = uigetfile({'*.txt; *.csv', 'Text Files (*.txt, *.csv)'}, ...
'Select all wind tunnel test-files to load', ...
'MultiSelect', 'on');
filepaths = repmat(string(filepaths), 1, length(filenames));
else
fullFiles = string(inputFiles);
% Look for files
allFiles = [];
for i = 1:numel(fullFiles)
dummy = dir(fullFiles(i)); % List files properly
if isempty(dummy)
warning('MATLAB:process_wt:FileNotFound', ...
'Could not find file %s.', fullFiles(i));
end
allFiles = [allFiles; dummy];
end
if isempty(allFiles)
error('MATLAB:parsefileinputs:noFilesFound', ...
'Impossible to find ANY file matching the input arguments.');
end
% Output the proper file names and path
filenames = cell(1, length(allFiles));
filepaths = cell(1, length(allFiles));
for i = 1:length(allFiles)
filenames{i} = allFiles(i).name;
filepaths{i} = allFiles(i).folder;
end
end
allFiles = fullfile(filepaths, filenames);
% clearvars -except allFiles idFile DT SURFACE;
% Load identification table
opts = detectImportOptions(idFile);
opts.VariableNamesLine = 3;
opts.VariableUnitsLine = 4;
opts.DataLines = [5 Inf];
idTable = readtable(idFile, opts);
% Read and parse all files,
res(length(allFiles)) = struct;
for iFile = 1:length(allFiles)
[res(iFile).forces, res(iFile).moments] = readdata(allFiles(iFile), idTable);
res(iFile).meanFor = mean(res(iFile).forces);
res(iFile).meanMom = mean(res(iFile).moments);
res(iFile).cFor = mean(res(iFile).forces);
res(iFile).cMom = mean(res(iFile).moments);
end
% Plot
for iFile = 1:length(allFiles)
nts = size(res(iFile).forces, 1);
time = linspace(0, DT * nts, nts);
size(res(iFile).forces(:, 1, 1));
figure;
subplot(211);
hold on;
plot(time, res(iFile).forces(:, 1, 1));
plot(time, res(iFile).forces(:, 2, 1));
plot(time, res(iFile).forces(:, 3, 1));
hold off;
legend('Fx1', 'Fy1', 'Fz1');
Vinf = 0; % FIXME
title(['Vitesse = ', Vinf, ' m/s']);
% ylim([-5 50])
subplot(212);
hold on;
plot(time, res(iFile).forces(:, 1, 2));
plot(time, res(iFile).forces(:, 2, 2));
plot(time, res(iFile).forces(:, 3, 2));
hold off;
legend('Fx2', 'Fy2', 'Fz2');
end
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