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

feat(Result): add support all perf in plot

parent 0494a9bf
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ function plotperf(self, varargin) ...@@ -44,7 +44,7 @@ function plotperf(self, varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Defaults and constants % Defaults and constants
DEF.ALLOWED_PROPERTIES = {'cT', 'cQ', 'cP'}; DEF.ALLOWED_PROPERTIES = {'thrust', 'torque', 'power', 'eff', 'cT', 'cQ', 'cP'};
DEF.allowed_oper = self.operPts.Properties.VariableNames; DEF.allowed_oper = self.operPts.Properties.VariableNames;
DEF.ALLOWED_SOLVERS = {'leishman', 'indfact', 'indvel', 'stahlhut'}; DEF.ALLOWED_SOLVERS = {'leishman', 'indfact', 'indvel', 'stahlhut'};
...@@ -56,14 +56,15 @@ function plotperf(self, varargin) ...@@ -56,14 +56,15 @@ function plotperf(self, varargin)
figure('Name', 'Rotor performance'); figure('Name', 'Rotor performance');
end end
filtered = filtertable(self.summarize, ... [filtered, idx] = self.filter(operPt.altitude, operPt.speed, operPt.rpm, operPt.collective);
operPt.altitude, operPt.speed, ...
operPt.rpm, operPt.collective);
for iSolv = 1:length(solvers) for iSolv = 1:length(solvers)
perfSolv = sprintf('%s_%s', perf, solvers{iSolv}); thissolv = solvers{iSolv};
plot(filtered.(oper), filtered.(perfSolv), 'DisplayName', solvers{iSolv});
if iSolv == 1 if ~isempty(self.(thissolv))
dataVect = vectorize(filtered.(thissolv), perf);
plot(self.operPts(idx, :).(oper), dataVect, 'DisplayName', solvers{iSolv});
hold on; hold on;
end end
end end
...@@ -84,7 +85,7 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin) ...@@ -84,7 +85,7 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin)
addRequired(p, 'speed', valData); addRequired(p, 'speed', valData);
addRequired(p, 'rpm', valData); addRequired(p, 'rpm', valData);
addRequired(p, 'collective', valData); addRequired(p, 'collective', valData);
addParameter(p, 'solvers', {'leishman', 'indfact', 'indvel', 'stahlhut'}); addParameter(p, 'solvers', DEF.ALLOWED_SOLVERS);
addParameter(p, 'newFig', false, valLogi); addParameter(p, 'newFig', false, valLogi);
parse(p, varargin{:}); parse(p, varargin{:});
...@@ -100,18 +101,13 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin) ...@@ -100,18 +101,13 @@ function [perf, oper, solvers, operPt, newFig] = parseinputs(DEF, varargin)
newFig = p.Results.newFig; newFig = p.Results.newFig;
end end
function filtered = filtertable(inputTable, alt, speed, rpm, coll) function vect = vectorize(struct, prop)
% FILTERTABLE Filter the data with corresponding alt, coll, rpm and speed from the summary table % VECTORIZE Transform struct array into a vector
iAlt = getidx('altitude', alt);
iSpeed = getidx('speed', speed);
iRpm = getidx('rpm', rpm);
iColl = getidx('collective', coll);
filtered = inputTable(iAlt & iColl & iRpm & iSpeed, :); vect = zeros(1, length(struct));
function idx = getidx(type, val) for i = 1:length(struct)
idx = inputTable.(type) == val | isnan(val); vect(i) = struct(i).(prop);
end end
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