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

refact(result): improve result tables

parent 4b24a542
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ classdef Result < handle
%
% Notes:
% - Almost all properties are private to prevent accidental overwriting.
%
% - Most properties are structured as [nRotor, nOperPoint]
% -----
%
% Result properties:
......@@ -14,11 +14,16 @@ classdef Result < handle
% indvel - Results obtained with the indVel solver
% stahlhut - Results obtained with the stalhlut solver
% operPts - Table with the operating points for each individual result
% ModExt - Modelling enstension options (losses, etc)
%
% ModExt - Modelling extension options (losses, etc)
% cT - Table with all Thrust coefficients
% cP - Table with all Power coefficients
% cQ - Table with all Torque coefficients
%
% Result methods:
% save - Save the Result object to file
% save - Save the Result object to file
% summarize - Output a summary table with the operating points and the performance
% filter - Filter for a specific operating point
% plotperf - Plot and compare rotor performances
%
% Result constructor:
% Result = Result() creates an empty object.
......@@ -73,8 +78,8 @@ classdef Result < handle
% ---------------------------------------------
% Set methods
function set.operPts(self, val)
% Note: A bug in Matlab prevents the user of variable names when size checks are added
% in the property definition. https://stackoverflow.com/q/48423003
% Note: A bug in Matlab prevents the use of variable names when size checks are added
% in the property definition. See: https://stackoverflow.com/q/48423003
self.operPts = val;
self.operPts.Properties.VariableNames = {'altitude', 'speed', 'rpm', 'collective'};
......@@ -105,29 +110,21 @@ end
function resTable = maketable(self, prop)
% MAKETABLE Gather properties from all solvers and all operating points in a table
resTable = table('Size', [size(self.operPts, 1), 4], ...
'VariableTypes', {'double', 'double', 'double', 'double'});
propName = cell(1, 4);
for i = 1:length(self.SOLVERS)
propName{i} = [prop, '_', self.SOLVERS{i}];
end
resTable.Properties.VariableNames = propName;
for iRotor = 1:size(self.indvel, 2)
for iSolv = 1:length(self.SOLVERS)
for iOp = 1:size(self.operPts, 1)
resTable = table('Size', [size(self.operPts, 1), 0]);
solver = self.SOLVERS{iSolv};
for iSolv = 1:length(self.SOLVERS)
thissolver = self.SOLVERS{iSolv};
tmpTable = [];
if ~isempty(self.(solver))
resTable.(iSolv)(iOp, iRotor) = self.(solver)(iOp, iRotor).(prop);
else
resTable.(iSolv)(iOp, iRotor) = NaN;
end
for iRotor = size(self.(thissolver), 2):-1:1
for iOp = size(self.operPts, 1):-1:1
tmpTable(iOp, iRotor) = self.(thissolver)(iOp, iRotor).(prop);
end
end
if ~isempty(tmpTable)
resTable = addvars(resTable, tmpTable, 'NewVariableNames', [prop, '_', thissolver]);
end
end
end
......@@ -22,8 +22,9 @@
% Just load exisiting template
template;
Sim.Out.show3D = false; % Show the 3D view of the whole rotor
% Currently only indvel is supported fro coaxial
Mod.solvers = 'indvel'; % BEMT Solver ('leishman', 'indfact', 'indvel', 'stahlhut', 'all')
% Mod.solvers = 'indvel'; % BEMT Solver ('leishman', 'indfact', 'indvel', 'stahlhut', 'all')
% ==================================================================================================
% ================================= Blade and rotor geometry =======================================
......
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