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

feat(Result): add filter

parent 0140bc32
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ to [Semantic Versioning][sem_ver].
- Basic result summary table
- Basic result plotting function
- Result filtering function
### Changed
......
......@@ -98,6 +98,7 @@ classdef Result < handle
% Other methods
save(self, SaveOpts) % Save the results to file
summaryTable = summarize(self, propList) % Summarize results
[filtered, idx] = filter(self, alt, speed, rpm, coll) % Filter results
end
end
......
function [filtered, idx] = filter(self, alt, speed, rpm, coll)
% FILTER Filter results based on operating point.
% This method isolate the OperRotor instances for each solver that corresponds to the
% operating point.
%
% -----
%
% Syntax:
% [filtered, idx] = Result.filter(alt, rpm, coll, speed) Return the Results of the four
% solvers for the operating point defined by `alt`, `rpm`, `coll`, `speed`.
%
% Inputs:
% alt : Altitude, [m]
% rpm : Rotational speed, [rpm]
% coll : Collective pitch, [deg]
% speed : Axial velocity, [m/s]
%
% Outputs:
% filtered : Result instance with only one instance for leishman, indfact, indevl and stahlhut
% properties.
% idx : Index of the simulation corresponding to the operating point
%
% Example:
% ResRot.filter( 0, 0, 1250, 5)
%
% See also: rotare, Result, template.
%
% <a href="https://gitlab.uliege.be/rotare/documentation">Complete documentation (online)</a>
% ----------------------------------------------------------------------------------------------
% (c) Copyright 2022-2023 University of Liege
% Author: Thomas Lambert <t.lambert@uliege.be>
% ULiege - Aeroelasticity and Experimental Aerodynamics
% MIT License
% Repo: https://gitlab.uliege.be/rotare/rotare
% Docs: https://gitlab.uliege.be/rotare/documentation
% Issues: https://gitlab.uliege.be/rotare/rotare/-/issues
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Defaults and constants
DEF.ALLOWED_SOLVERS = {'leishman', 'indfact', 'indvel', 'stahlhut'};
% Input validation
validateattributes(alt, {'numeric'}, {'scalar'});
validateattributes(speed, {'numeric'}, {'scalar'});
validateattributes(rpm, {'numeric'}, {'scalar'});
validateattributes(coll, {'numeric'}, {'scalar'});
function idx = getidx(type, val)
idx = self.operPts.(type) == val | isnan(val);
end
iAlt = getidx('altitude', alt);
iSpeed = getidx('speed', speed);
iRpm = getidx('rpm', rpm);
iColl = getidx('collective', coll);
idx = iAlt & iColl & iRpm & iSpeed;
% Filter for the solvers only (rest is useless or redundant here)
for iSolv = 1:length(DEF.ALLOWED_SOLVERS)
thissolv = DEF.ALLOWED_SOLVERS{iSolv};
if ~isempty(self.(thissolv))
filtered.(thissolv) = self.(thissolv)(1, idx);
else
filtered.(thissolv) = self.(thissolv);
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