diff --git a/@BearImp/BearImp.m b/@BearImp/BearImp.m index fe3913a52bf52fffabe2497cb4763a26b2762d31..d478834aebb9ba9b14a351feee7285c8afe82c80 100644 --- a/@BearImp/BearImp.m +++ b/@BearImp/BearImp.m @@ -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)); - end - end - - methods - function methodChangedFcn(obj,src,~) - for mc = src.optionsLastChanged - obj.up2date.(mc{:}) = false; - end - src.optionsLastChanged = {}; + obj.optionChangedListenerHandle = addlistener(obj.method,'optionChanged',@(src,event) obj.methodChangedFcn(src,event)); 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 diff --git a/@BearImp/calcFilm.m b/@BearImp/calcFilm.m index f9f7deb1d0b3cd5e5aa0377923012bbf0c1130d5..36c987c7eb10e84fde2434c4475b0cae474c270e 100644 --- a/@BearImp/calcFilm.m +++ b/@BearImp/calcFilm.m @@ -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 diff --git a/BearImpOptions.m b/BearImpOptions.m index 2201c9434bef63628eba97956a240c899667cdd8..6d04cdcfee8f3fd6d67a393896f448d710d93e9e 100644 --- a/BearImpOptions.m +++ b/BearImpOptions.m @@ -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 diff --git a/InputData.xlsx b/InputData.xlsx index b05ad322385e1b14a930a628e0de318cd9048e8f..7491cb4460984b4e0e7b0e3db642a0e459ee3229 100644 Binary files a/InputData.xlsx and b/InputData.xlsx differ