Skip to content
Snippets Groups Projects
Commit 2c5214f0 authored by sp89hili's avatar sp89hili
Browse files

Pu_add H.roughnessCorrection, bugfixing for saving and loading objects,

parent 31d510d8
No related branches found
No related tags found
No related merge requests found
......@@ -28,12 +28,13 @@ classdef BearImp < handle & matlab.mixin.Copyable
end
properties (Access = private)
properties (Access = protected)
% Eingangsparameter Speicher
privateInputParameters = struct('F_r',nan,'F_a',nan,'omega',nan,'T_Oil',nan,'psi',nan,'psi_calc',nan,'psi_all',nan,'ind_psi_all',nan,'f',nan,'L',struct,'S',struct,'resolutionPerRotation',nan)
privateResults = struct('T',struct,'R',struct,'G',struct,'B',struct,'H',struct,'C',struct,'Z',struct)
privateAddOn = struct('Parallel_Computing_Toolbox', 'auto', 'Optimization_Toolbox', 'auto')
privateMethod = BearImpOptions
optionChangedListenerHandle
end
properties (Access = public)
......@@ -77,20 +78,11 @@ classdef BearImp < handle & matlab.mixin.Copyable
end
end
obj.method = BearImpOptions;
addlistener(obj.method,'optionChanged',@(src,event) obj.methodChangedFcn(src,event));
obj.optionChangedListenerHandle = addlistener(obj.method,'optionChanged',@(src,event) obj.methodChangedFcn(src,event));
end
end
methods
function methodChangedFcn(obj,src,~)
for mc = src.optionsLastChanged
obj.up2date.(mc{:}) = false;
end
src.optionsLastChanged = {};
end
end
methods (Access = public) % Später protected? #######################
methods (Access = public)
% Berechnungsmethoden in einzelnen Dateien
calcLub (obj)
calcClear(obj)
......@@ -99,8 +91,6 @@ classdef BearImp < handle & matlab.mixin.Copyable
varargout = calcFilm(obj, options)
calcCap (obj)
calcImp (obj)
end
methods (Access = public)
setBearing(obj,name)
setFitting(obj,shaft,housing)
setLube (obj,name)
......@@ -158,8 +148,6 @@ classdef BearImp < handle & matlab.mixin.Copyable
obj.privateInputParameters.resolutionPerRotation = nan;
end
function set.ind_psi_all(obj,ind_psi_all)
% obj.up2date.R = false;
% obj.up2date.B = false;
obj.privateInputParameters.ind_psi_all = ind_psi_all;
end
function set.AddOn(obj,AddOn)
......@@ -400,6 +388,12 @@ classdef BearImp < handle & matlab.mixin.Copyable
end
methods (Access = protected)
function methodChangedFcn(obj,src,~)
for mc = src.optionsLastChanged
obj.up2date.(mc{:}) = false;
end
src.optionsLastChanged = {};
end
function executeAllObj(obj,functionHandle)
% Führt eine Funktion für alle Einträge von obj aus
% Funktioniert aktuell nur für Funktionen ohne Übergabeparameter
......@@ -410,6 +404,18 @@ classdef BearImp < handle & matlab.mixin.Copyable
function cp = copyElement(obj)
cp = copyElement@matlab.mixin.Copyable(obj);
cp.method = obj.method.copy; % creat a deep copy of the method
cp.optionChangedListenerHandle = addlistener(cp.method,'optionChanged',@(src,event) cp.methodChangedFcn(src,event));
end
function s = saveobj(obj)
obj.optionChangedListenerHandle = [];
s = obj;
end
end
methods (Static, Hidden)
function obj = loadobj(s)
s.optionChangedListenerHandle = addlistener(s.method,'optionChanged',@(src,event) s.methodChangedFcn(src,event));
s.method.addSetMethods
obj = s;
end
end
end
\ No newline at end of file
......@@ -118,6 +118,14 @@ if H.method.starvationCorrection == 'on' % according to SKF according to Schneid
end
end
if H.method.roughnessCorrection == 'on' % according to Kreil 2009 (S. 79)
H.t_r = -0.0992; % -0.0992 for longitudinal grinding, −1.0600 for transversal grinding
H.m_r = 0.3 * log(H.u+55) + H.t_r;
H.Rz = sqrt(L.Rz_RE^2 + [L.Rz_IR;L.Rz_OR].^2);
H.Delta_h_r = H.m_r .* H.Rz;
H.h_0 = H.h_0 - H.Delta_h_r;
end
if isPreCalc
h_0 = H.h_0;
return
......
......@@ -33,6 +33,7 @@ classdef BearImpOptions < handle & dynamicprops & matlab.mixin.CustomDisplay & m
possibleOption.H.filmThicknessFormula = {'Hamrock/Dowson','Moes'};
possibleOption.H.thermalCorrection = {'on','off'};
possibleOption.H.starvationCorrection = {'on','off'};
possibleOption.H.roughnessCorrection = {'on','off'};
possibleOption.C.unloadedRE = { 'neglect','stateOfTheArt', 'Leander_Parallel','Leander_Radial','LeanderSteffen','TobiasSteffen_Kugelfläche','TobiasSteffen_Laufbahnfläche','semianalytisch3D'};
possibleOption.C.outsideArea = {'k-factor','neglect','stateOfTheArt','Schneider_k_c','Schneider_k_vh','Leander_Parallel','Leander_Radial','LeanderSteffen','TobiasSteffen_Kugelfläche','TobiasSteffen_Laufbahnfläche','semianalytisch3D'};
end
......@@ -44,6 +45,7 @@ classdef BearImpOptions < handle & dynamicprops & matlab.mixin.CustomDisplay & m
defaultOption.H.filmThicknessFormula = 'Hamrock/Dowson';
defaultOption.H.thermalCorrection = 'on';
defaultOption.H.starvationCorrection = 'off';
defaultOption.H.roughnessCorrection = 'off';
defaultOption.C.unloadedRE = 'semianalytisch3D';
defaultOption.C.outsideArea = 'semianalytisch3D';
end
......@@ -141,7 +143,7 @@ classdef BearImpOptions < handle & dynamicprops & matlab.mixin.CustomDisplay & m
for sub = obj.possibleSubOptions
if obj.(sub{:}).hasSubSubOptions
for subsub = obj.(sub{:}).possibleSubOptions
if ~strcmp(obj.(sub{:}).(subsub{:}).optionChosen,otherObj.(sub{:}).(subsub{:}).optionChosen);
if ~strcmp(obj.(sub{:}).(subsub{:}).optionChosen,otherObj.(sub{:}).(subsub{:}).optionChosen)
logicalOut = false;
if obj.optionLevel == 1
diffs = [diffs {obj.(sub{:}).optionName}]; %#ok<AGROW>
......@@ -151,7 +153,7 @@ classdef BearImpOptions < handle & dynamicprops & matlab.mixin.CustomDisplay & m
end
end
else
if ~strcmp(obj.(sub{:}).optionChosen,otherObj.(sub{:}).optionChosen);
if ~strcmp(obj.(sub{:}).optionChosen,otherObj.(sub{:}).optionChosen)
logicalOut = false;
if obj.optionLevel == 1
diffs = [diffs {obj.(sub{:}).optionName}]; %#ok<AGROW>
......@@ -290,13 +292,32 @@ classdef BearImpOptions < handle & dynamicprops & matlab.mixin.CustomDisplay & m
if obj.hasSubSubOptions
for sub = obj.possibleSubOptions
prop = findprop(cp,sub{:});
setMethod = prop.SetMethod; % Wired workaround so that the set function is not called as it calls copy resulting in a recursion
prop.SetMethod = [];
prop.SetMethod = []; % Wired workaround so that the set function is not called as it calls copy resulting in a recursion
cp.(sub{:}) = obj.(sub{:}).copy;
prop.SetMethod = setMethod;
prop.SetMethod = @(cp,optionChoice) cp.set_optionChosen(sub{:},optionChoice);
cp.(sub{:}).parent = cp;
end
end
end
end
methods (Hidden)
function addSetMethods(obj)
% Needs to be called after loading a BearImpOptions object as
% the set methods of dynamic properties are not loaded
% alongside
if obj.hasSubSubOptions
for sub = obj.possibleSubOptions
prop = findprop(obj,sub{:});
prop.SetMethod = @(obj,optionChoice) obj.set_optionChosen(sub{:},optionChoice);
prop.NonCopyable = false;
obj.(sub{:}).addSetMethods
end
end
end
end
methods (Access = protected)
function mainObj = getMainObj(obj)
switch obj.optionLevel
case 1
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment