Rain Flow for MATLAB

September 12, 2017 | Author: gu1000 | Category: Fatigue (Material), Matlab, Algorithms, Microsoft Windows, Computer File
Share Embed Donate

Short Description



Rain flow for MATLAB

RAINFLOW FOR MATLAB Version date: 2010-04-03

INTRODUCTION The rainflow cycle counting algorithm is widely used while fatigue life assessment of machine components or structures under non-constant amplitude loading. Usually, the algorithm extract cycles from load, stress or strain history obtained from measurement or simulation. As a results of the counting several cycles and half-cycles with different amplitude and mean value are obtained. With the advantage of fatigue damage accumulation hypothesis, like Miners rule, the algorithm gives possibility to compute the expected fatigue life under random loading conditions. Theoretically, of course ;-) The small toolbox RAINFLOW includes rainflow cycle counting algorithm prepared for using in the MATLAB ® environment. The main function has been translated from Turbo Pascal into C language and compiled to the MEX function. The algorithm code has been written according to the ASTM standard [1] and optimized considering the calculation speed. Some other details about the usability of the function with practical application can be found in [2]. The toolbox was tested on PCs under MS Windows® XP32 and Vista64 operating systems, however I guess that they will also works properly on other OS. In order to improve the RAINFLOW toolbox please sends all your remarks, suggestions and questions to me through the MATLAB Central contact data. All functions in the RAINFLOW toolbox where elaborated by myself. At present I am working as assistant professor on the Opole University of Technology, Department of Mechanics and Machine Design (Technical University of Opole, Department of Mechanics and Machine Design) and I am open for cooperation in the field of fatigue live assessment of machine components under multiaxial random loading.

TERMS OF USE The toolbox is copyrighted according to the MATLAB Central File Exchange terms. Additionally, I have a following, not mandatory, request to the users of my toolbox - if any scientific publication they have been made using my software, please refer to the publication [2] of my authorship, where the RAINFLOW toolbox have been first officially presented and described.

INSTALLATION The RAINFLOW toolbox is a typical “one directory” MATLAB toolbox. Following files there: Description

File rainflow.m


short description of the rainflow function, used by MATLAB for build-in help engine, this is not the “working” rainflow function!



C MEX code of the rainflow function



compiled "rainflow.c" file (MATLAB R2007a, Windows XP Prof. 32Bit)



compiled "rainflow.c" file (MATLAB R2007a, Windows Vista 64Bit)

file:///C|/Matlab/index.html[17-07-2012 09:52:17]

Rain flow for MATLAB



histograms of rainflow data



rainflow matrix calculation and visualization



demo for cycle counting, recommended for short signals



demo for rainflow matrix and histograms, recommended for long signals



auxiliary function for rfdemo, it searches turning points from signals

In order to install the rainflow function, you must realise standard tasks, necessary during addition of new toolboxes to the MATLAB environment, i.e.: 1. Download the archive file rainflow.zip from File Exchange web side. 2. Create a new local directory for files of the RAINFLOW toolbox. 3. Unpack all files from the archive to that directory. 4. Add a path to that directory in MATLAB, using the command "Edit Path" from main menu. Additionally, if the compiled rainflow MEX file (rainflow.mexw32 for 32Bit MS Windows and rainflow.mexw64 for 64Bit MS Windows) is out of date, or you are user of OS unlike MS Windows, you need to recompile it. Use the rainflow.c file with source code for this task. Please, look into the MATLAB help and search the topic “mex” for more details.


LESSON 1 – USING THE DEMO FILES There are two demo files: 1.        rfdemo1 – show how the algorithm are working plotting the extracted cycles and half-cycles on the time history, recommended for short time signals, 2.        rfdemo2 – make rainflow histograms and rainflow matrix, recommended for long time signals. To run this demos type on the MATLAB command window following commands: rfdemo1 or rfdemo2 LESSON 2 – RAINFLOW COUNTING ON USER DATA This example show how to perform rainflow counting on self generated signal (or self loaded to the MATLAB Command Window): clear all lengths=10000; s=10*randn(lengths,1)+rand(lengths,1); % or load the signal from file --> s=my_signal;

file:///C|/Matlab/index.html[17-07-2012 09:52:17]

Rain flow for MATLAB

tp=sig2ext(s); % use the sig2ext function ever before you run rainflow, % because the counting procedure works properly only on % turning points rf=rainflow(tp); rfm=rfmatrix(rf,20,20); surf(rfm) LESSON 3 – FATIGUE LIFE CALCULATION The script presented bellow realize fatigue calculation in the case of uniaxial random loading without any additional influence of notch, stress gradient, environment etc. In this example linear hypothesis of damage accumulation is used (full range Miner rule without omission of the cycles with amplitudes lover then endurance limit) combined with typical S-N curve (Wöhler curve). clear all % S-N curve sigaf=250;  m=8;        Nk=2e6;    

parameters:  % endurance limit  % slope of the curve  % number of cycle for knee point

% random stress time history generated from random generator % can be replaced by another signal: sigt=my_stress; sigt=100*randn(1000,1); % length in second of the time history To=500; tp=sig2ext(sigt);   rf=rainflow(tp);    CycleRate=rf(3,:);  siga=rf(1,:);      

 %  %  %  %

turning points rainflow number of cycles cycle amplitudes

% calculation of the damage damage=sum((CycleRate/Nk).*((siga/sigaf).^m)); % expected time to failure in seconds T=To/damage; % expected time to failure in days disp(['Calculated fatigue life in days: ' num2str(T/3600/24)]) Hint: copy and paste the text in blue into the Script Editor and press the “run button” ;-)

REFERENCES file:///C|/Matlab/index.html[17-07-2012 09:52:17]

Rain flow for MATLAB

[1] ASTM E 1049-85 (Reapproved 1997), Standard practices for cycle counting in fatigue analysis, in: Annual Book of ASTM Standards, Vol. 03.01, Philadelphia 1999, pp. 710-718 [2] NIESŁONY A., Determination of fragments of multiaxial service loading strongly influencing the fatigue of machine components, Mechanical Systems and Signal Processing, Vol. 23(8), 2009, pp. 2712-2721 End of page © by Adam Niesłony

file:///C|/Matlab/index.html[17-07-2012 09:52:17]

View more...


Copyright ©2017 KUPDF Inc.