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

feat(Result): introduce result class

parent e46a4279
No related branches found
No related tags found
No related merge requests found
classdef Result < handle
% RESULT Result obtained from a simulation with Rotare.
% This class defines the Result object that can be used to store the solution an entire Rotare
% simulation.
%
% Notes:
% - Almost all properties are private to prevent accidental overwriting.
%
% -----
%
% Result properties:
% leishman - Results obtained with the leishman solver
% indfact - Results obtained with the indFact solver
% indvel - Results obtained with the indVel solver
% stahlhut - Results obtained with the stalhlut solver
% operPts - Table with the operating points for each individual result
%
%
% Result methods:
%
% Result constructor:
% Result = Result() creates an empty object.
%
% Constructor inputs:
%
% See also: Rotor, rotare, template, af_tools.Airfoil.
%
% <a href="https:/gitlab.uliege.be/rotare/documentation">Complete documentation (online)</a>
% ----------------------------------------------------------------------------------------------
% FIXME: Make plot methods to compare two results easily
% ----------------------------------------------------------------------------------------------
% (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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Base properties of the elements
properties
leishman (1, :) OperRotor % Results obtained with the leishman solver
indfact (1, :) OperRotor % Results obtained with the indFact solver
indvel (1, :) OperRotor % Results obtained with the indVel solver
stahlhut (1, :) OperRotor % Results obtained with the stalhlut solver
operPts (:, 4) table % Table of operating points for each individual result
end
methods
function self = Result()
% Result Constructor.
% Creates the Result object.
%
% Currently empty on purpose. Results are to be assigned manually.
end
end
end
function [OpRot] = rotare(configFile) function [Results] = rotare(configFile)
% ROTARE A feature-rich and open source implementation of the BEMT. % ROTARE A feature-rich and open source implementation of the BEMT.
% This code is an implementation of the Blade Element Momentum Theory (BEMT) used for the % This code is an implementation of the Blade Element Momentum Theory (BEMT) used for the
% analysis of all all kinds of rotors. % analysis of all all kinds of rotors.
...@@ -58,6 +58,9 @@ function [OpRot] = rotare(configFile) ...@@ -58,6 +58,9 @@ function [OpRot] = rotare(configFile)
% Import packages % Import packages
import af_tools.* import af_tools.*
% Init the output object
Results = Result();
% ============================================================================================== % ==============================================================================================
% ==================================== Pre-processing ========================================== % ==================================== Pre-processing ==========================================
% ============================================================================================== % ==============================================================================================
...@@ -132,6 +135,10 @@ function [OpRot] = rotare(configFile) ...@@ -132,6 +135,10 @@ function [OpRot] = rotare(configFile)
% Keep track of CPU time for the solution % Keep track of CPU time for the solution
OpRot(iOperPoint, i).cpuTime = toc(tStart); OpRot(iOperPoint, i).cpuTime = toc(tStart);
% Table that identifies the operating point for future reuse
operPoints(iOperPoint, :) = [Uop.altitude(iAlt), Uop.speed(iSpeed), ...
Uop.rpm(i, iRpm), Uop.collective(i, iColl)];
iOperPoint = iOperPoint + 1; iOperPoint = iOperPoint + 1;
end end
...@@ -143,6 +150,11 @@ function [OpRot] = rotare(configFile) ...@@ -143,6 +150,11 @@ function [OpRot] = rotare(configFile)
disp(' '); disp(' ');
end end
% Output result in an easily accessible form
Results.(Mod.solver) = OpRot;
Results.operPts = array2table(operPoints, ...
'VariableNames', {'Alt', 'V_ax', 'RPM', 'Coll'});
% Save solution to MAT-file for future reusability % Save solution to MAT-file for future reusability
if Sim.Save.autosave if Sim.Save.autosave
TmpStruct.OpRot = OpRot; TmpStruct.OpRot = OpRot;
......
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