You are on page 1of 10

Simple rainflow

counting algorithms
S. D. Downing and D. F. Socie

Two simple algorithms for performing rainflow counting are presented in this paper. The second
algorithm is suitable for microcomputer devices that are placed in vehicles to record field data.
Key words: fatigue tests; rainflow counting; algorithms; load monitoring; ground vehicles

In the land-vehicle industry, cumulative damage fatigue Several algorithms are available to perform the counting,
analysis procedures are usually employed to estimate endur- however, they all require that the entire load history be
ance.1-3 They allow the engineer to relate the endurance known before the counting process starts. 5-7 As a result,
of actual components to simple laboratory specimens. they are not suitable for 'on-board' data processing since
Fatigue lives of specimens are determined from constant the entire load history isn't known until the end of the test.
amplitude tests. Real structures seldom, if ever, experience The first algorithm described in this paper has this same
constant amplitude loading. Therefore, some type of cycle limitation;that is, the load history must be rearranged to
counting scheme must be employed to reduce a complex begin and end with the maximum peak (or minimum
irregular loading history into a series of constant amplitude valley). It is presented because of its simplicity and because
events. The most accurate fatigue life estimates are obtained it is useful as a control program for determining stress/
using an analysis based on the strain at the most highly strain response under variable amplitude loading. The 'one-
stressed/strained location. Rainflow counting 4 is an essential pass' rainflow counting algorithm described later overcomes
part of these procedures. This method defines cycles as this hmitation and identifies the same cycles as the first
closed stress/strain hysteresis loops as illustrated in Fig. 1. algorithm. Thus, it can operate in 'real-time' and has been
Four cycles (bc, ed, fg, ad) are identified by the method. successfully implemented in a histogram recorder. 8

Strain

,o
.ts

,o"

B D

i B D

C
Time
07-

E
A

Fig. 1 Stress/strain response and rainflow counting

0142-1123/82/010031-10 $03.00 © 1982 Butterworth & Co (Publishers) Ltd INT. J. FATIGUE January 1982 31
PREVIOUS WORK b. If X = Y and Y contains S, go to Step 1
c. If X > Y a n d Y containsS, go to Step 4
Most practical rainflow counting algorithms are based on d. If X ~> Y and Y does not contain S, go to Step 5
either the 'availability matrix' or the 'vector' mathematical 4 - Move S to the next point in the vector
concepts. The 'availability matrix' algorithm developed by Go to Step 1
Wetzel 9 requires that the input signal be divided into a 5 - Count range Y
finite number of bands which are used to define the Discard the peak and valley of Y
numerical value of the range and mean of each reversal. Go to Step 2
Corresponding to each band is an element in the availability 6 Read the next peak or valley from the beginning
matrix. Simply speaking, this matrix is used to determine of the vector E(n)
when a rainflow counted cycle is formed. (if the starting point, S, has already been
'Vector' based rainflow counting algorithms use a
reread, STOP)
one dimensional array to keep track of those peaks and
7 -- Form ranges X and Y
valleys which have not formed a closed loop. In other
(if the vector contains less than 2 points past
words, once a closed loop has been determined, the peak
the starting point, go to Step 6)
and valley associated with it can be eliminated from the
8 - Compare ranges X and Y
vector. This technique was first demonstrated by Downing
a. I f X < Y , g o t o S t e p 6
et al 2 and was modified by Okamura et al IO to account
b. I f X l > Y , g o t o S t e p 9
for half cycles. Both algorithms described in this paper use
9 - Count range Y
the 'vector' concept.
Discard the peak and valley of Y
Go to Step 7
RULES FOR BOTH ALGORITHMS
Let the range of each peak and valley be identified as EXAMPLES
follows:
Both algorithms will be illustrated by rainflow counting the
X = range under consideration strain/time history shown in Fig. 2. Fig. S shows the same
Y ; previous range adjacent to X history after it has been rearranged to begin and end with
the maximum peak, point C. Also given is the resulting
As each peak or valley is encountered, it is put in a vector stress/strain response which shows a number of closed
E(n). In addition, the starting peak or valley is designated S. hysteresis loops. Rainflow counting should identify the
ranges of strain which correspond to these closed hysteresis
loops.
RAINFLOW ALGORITHM I
Rainflow Algorithm I is illustrated in conjunction
This algorithm rainflow counts a history of peaks and valleys with Figs 4 - 1 6 . In each figure, the strain/time history shown
in sequence which has been rearranged to begin and end corresponds to the contents of the vector E(n). Also shown
with the maximum peak (or minimum valley). Rainflow is the stress/strain plot, the values of ranges X and Y, and
counting then proceeds according to the following steps: the decisions which correspond to Step 3 of the rules for
this algorithm. The history to be rainflow counted is
I -- Read the next peak or valley
given in Fig. S. In Fig 4, the first peak has been read into
(if out of data, STOP)
the vector. This establishes the origin of the stress/strain
2 - Form ranges X and Y
plot since either the maximum peak or the minimum valley
(if the vector contains less than
lies on the cyclic stress/strain curve. Since there are less
S points, go to Step i )
than 3 points in the vector, ranges X and Y are undeter-
3 - Compare ranges X and Y
mined and the next peak or valley must be read. In Fig. 5,
a. I f X < Y , g o t o S t e p l
b. I f X > / Y , g o t o S t e p 4
4 - Count range Y
Discard the peak and valley of Y
Go to Step 2 m

8 C
RAINFLOW A L G O R I T H M II (ONE-PASS)
D E
This algorithm rainflow counts a history of peaks and
valleys in sequence as they occur. It calculates the same T -
ranges and means as Rainflow Algorithm I which required :]: -
that the history be rearranged to begin and end with the
maximum peak (or minimum valley). Rainflow counting N - H
then proceeds according to the foUowing steps: E -
I - Read the next peak or valley
(if out of data, go to Step 6)
2 - F o r m ranges X and Y
m

(if the vector contains less than 2 points


past the starting point, go to Step I )
S - Compare ranges X and Y L I I I I ! I I I I
a. If X ' ( Y , go to Step I Fig. 2 Variable amplitude history

32 INT. J. F A T I G U E January 1982


i

the same cycles (DC, GF, BA, HE) have been identified
I i C as in the previous algorithm. Again, the reader should care-
I fully follow Figs 17-31 to fully understand this algorithm.

T m
FORTRAN PROGRAM LISTINGS
I A Fortran listing for Rainflow Algorithm I is contained in
B I
Appendix I. The reader needs to write his own version of
£ Subroutine Data (P, K) compatible with his data files. The
variable, P, is the value of the data point. The variable, K,
m should be defined as follows:
[ 1 i I I I I I I I K = 0 when the data is valid;
K = 1 when the history is finished.
The data returned from this subroutine must be peaks
and valleys in sequence and must begin and end with the
maximum peak (or minimum valley). The maximum size
of the vector, E(n), is equal to the number of counting
ranges.
Appendix II gives the Fortran listing for Rainflow
Algorithm II (One-Pass). This program checks for data
sequence so that the variable, P, in Subroutine Data (P, K )
may be timed data samples. The meaning of variable, K,
remains the same as above. For this algorithm the maximum
size of the vector E(n) is equal to twice the number of
counting ranges.

Rainflow Algorithm I is illustrated in conjunction with Figs 4 - 1 6

"C
smJu]
Fig. 3 Stress/strain response

point D has been read into the vector and the stress is
unloaded from C to D along the outer loop curve. Range Y
is still undetermined so the next peak or valley must be I

read. In Fig. 6, point E has been read and the stress increases m

from D to E along the outer loop curve. A closed hysteresis


loop has been formed and, according to the counting rules,
range Y should be counted and its points discarded since
[ I I I I I I I I I
they have no bearing on future events. The counting
algorithm identified the same cycle, DC, as was determined
from the stress/strain response. In Fig. 7, points D and C 00QQ000IB0000010
have been eliminated from the contents of the vector.
It is left to the reader to follow Figs 7 - 1 6 along with the S
counting rules to see that the algorithm identifies the same T
cycles (DC, GF, BA, HE) as were determined from the
stress/strain response. R
Rainflow Algorithm II (One-Pass) will be used to E
count the strain/time history given in Fig. 2. It should S
identify the same cycles as the previous algorithm without
the restriction that history be rearranged to begin and end S
with the maximum peak. Figs 17-31 show the contents of
the vector E(n) and the counting decisions for each step
in the counting process. It should be noted that the start- I I I I I I I I
ing point, S, is always the first occurrence of either the
maximum peak or the minimum valley at that point in the
history. When all the peaks and valleys of the history have
been read, we begin reading points from the beginning of
the vector as seen in Fig. 17. The counting procedure con- X = tleET
tinues until all the points up to and including the starting Y = LICET
point have been reread. When we try to read a point
beyond the starting point, the counting procedure stops REAl) NEXT PEAKOR VALLEY
and all the cycles have been determined. Fig. 31 shows that FIB. 4

INT. J. FATIGUE January 1982 33


D J C "E

C i i i i I I 1 1 1 E i i i i I I I I I [ i n i i I I I I I

......... .....
o .'°""/

J i l l I l J l I I I I I I I I I l l / Ill!
STP.A.~ STRAIN STRAIN
CYCLES = DC
X = ABS@--C) X = ABS(E--D) X = UNDETE~
Y : LN)E'TER~I}I~ Y -- AB~(1)--O Y = UN)EI'ERItINED
REAP NEXT PEAKOR VALLEY X=Y,COUNTY AND DISCLRI)IT'S POINTS REAl) NEXTPEAKOR VALLEY
FIG. 5 FIG. 6 FIG. 7

J E I E
Fj FG ~~ E

T - H~
I -
M 2
E -

I- L I I I I l l l [ t i i i l i l l l [ I l I L l i l l

....y :y
/
J
J i l l l l l l I I I I l l i l I I I I 1 I 1 I
STRAIN STRAIN STI~L~
CYCLES = DC CYCLES = PC CYCLES = DC
X : ABS(F-D X = AB~(G--F) X =/~(l+-G)
Y = UNDE-IE~ Y = ABS(F-E) Y =/85(64-)
READNEXTPEAKOR VALLEY X<Y,READNEXTPEAKOR VALLEY # f , CSl~ Y AND DISO~ .FI"S R)]]~I'S
FIG. 8 FIG. 9 FIG. 18

34 INT. J. F A T I G U E January 1982


/ I E ~ E / I E

- II/

~ A ~ A

C i i i i I I I I I r i I 1 I I I I I I [ n I I I I I I I I

J
J
I I I I l I I I I I I I I I I I I I I I I I I l

STRAIN STI~ STR~


CYCLES = I~,GF CYCLES= DC,GF CYCLES = DC,GF
X = ~OFE) X =/~CA~) X =/~S(I}-A)
Y = ~(1~) Y = ABSCA-H)
ND(T PEAKOR WLLEY X<Y,RF_~ NEXT~ ~ V~J/-Y Xq,RE~) IIEXT ~ OR VALLEY
FIG. II FIG. 12 FIG. 13

. . ~ E ~ E

H
E - E

[ I I I I I I I I I i" I I I I I I I I I [ I I I I I I I I I

.......°"
. ,.."

Y
I 1 I I I I I I I I I I I I I I 1 I I I I 1 I l

S/RAIN STP,/~I STRAZH


CYCLES = DC,GF CYCLES = ~,~,E~ CYCLES = DC,GF,~,IE
X =/8S(C-8) X =/~(C-tt) lie ARE FIKISlEI)
Y = AI~(B-A) Y = Jl~(lt-£)
X>Y,COLNT Y ~ DISCJLRI)I"r'S POINTS X=Y,COLIfT Y All) DIrNdl) IT'S POINTS
FIG. 14 FIG. 15 FI6 16

INT. J FATIGUE January 1982 35


Rainflow Algorithm II is illustrated in conjunction with Figs 17--31

ACT~FIy TA~(.INGDATA AC'TIYE1YTAIC]]4GDATA ACTIVELY TAKING DATA

"A~ B~k--'S
~ C

L I I I I I I I I L I I I I I I 1 L I I 1 I I I 1 I

X -- I.II)~'T~ X = AB~CI}.-A) X = ASS(C.-B)


Y = LII)ETE]~It]]E]) Y = Lal)ETEIWd)O Y = ABS(B--A)
bY AND Y CONTAINSS
HOVEUP ST~RIIHGPOINT
REAP NEXT PEAl(OR VAU.EY READNI3C[ PEAKOR VALLEY REAPNEXTPE.q(ORVALLE'Y

F][G. 17 FIG. 18 FIG. 19

A~I]/F'IY TAJC]]IGDATA ACTIVELY TAY,.INGDATA ACT]]/E].YTAI(]]4GDATA

D2 c ~~-~C

I I I I I I I I I I I I I I I I I 1 I

CYCLES= DC

X = ABS(D-C) X = ABSCE--P) X = AliCE--B)


Y =/~CC.-6) Y = ABS(P-C) Y = BNDETE1~
X(Y X:Y AND Y BeES NOT CONTAINS
COUNT Y ~ DISrJ~ IT'S PO]]iTS
I E ~ llg(T PEAl( OR V/CJ.L~ READNE](TPEAKOR V~LL~

FIG. 29 ~6. 21 FIG. 22

3G INT. J. FATIGUE January T982


ACl'lIIFl
Y TAKINGDATA ACTIVELYTAE,]]WGDATA A~IVEI.YTAI(.I)¢O
DATA

B_-s A
F.~IG ~E
T
H
I
M
E

L I I I I I I I I L I I 1 I I I I I L I 1 I i I 1 I I I

CYCLES = DC CYCLES= DC CYCLES = PC


X = ABS(F-E) X = ABS(G--F) X = ADS(H-G)
Y = ABS(E-B) Y = ABS(F-E) Y = ABe(G-F)
X=Y AND Y CONTAINSS XCY X>Y AND Y DOESNOT CONTAINS
COUNTY AND DISCARDIT'S POINTS
REAl) NEXTPEAKOR VALLEY READNEXTPEAKOR VALLEY

FIG. FIG. 24 FIG. 25

ACTr/E].YTAI(])CGDATA OUl" OF DATA OUI'OFDATA

B "A B A

~ E "~~E=S
J

~ A ~ A

I I i I I I | L I I I I I I I I I L I 1 I I I I 1 I I

CYCLES = DC,GF CYCLES= DC,GF CYCLES = DC, GF

X = ABS(H--E) X = AB~(A.-H) X -- ABS(B--A)


Y = ABe(E--B) Y = ABS(II-E) Y = ABS(A--H)
X>Y AND Y CONTAINSS XCY X<Y
HOVEUP STARTINGPO11q
READNEXTPEAKOR VALLEY REAl)NEXT PEAK OR VALLEY READNEXTPEAKOR VALLEY

FIG. 26 FIG. 21 FIG. 28

I N T . J. F A T I G U E January 1982 37
~DATA ACTI"I/FIYT ~ DATA

m
B A
m
m

m m

m E
m

L I I I I i I I 1 I

CYCLES= DC,GF L I I I I I I I I I

X = ABSCE-B)
Y = ABS(B--A) X = kBS(E--D)
bY AND Y DOES NOT CONTAIN S
COUNT Y AND DISCARD IT'S POINTS Y = ABS(D-C)
X=Y AND Y DOESNOT CONTAIN S
FIG. 29 COLITT Y AND DISCARDIT'S POINTS
FIG. 31

OF DATA
SUMMA R Y
Two simple rainflow counting algorithms for processing
field data have been presented. The first is useful as a
control program for following stress/response under irregular
B A loading. The second algorithm gives identical results as the
first and has the advantage that the counting can begin
before the entire history is known.

REFERENCES
T
1. Dabell, B. J., Hill, S. J., Eaton, D. E. and Watson, P. 'Fatigue
I life predictions for notched components' J Soc Environmental
Engrs (December 1977)
M ~ E
2. Downing, S., Galliart, D. and Bereyni, T. 'A Neubers rule
E fatigue analysis procedure for use with a mobile computer'
SAE Paper 760317 presented at: SAE Automotove Engineer-
ing Congress (Detroit, Michigan, 1976)
3. Fatigue Under Complex Loading: Analysis and Experiment
Edited by: R. M. Wetzel (SAE Inc, Warrendale, Pennsylvania,
1977)

L I I i I I 1 i I i 4. iatsuishi, i . a n d E n d o , T. 'Fatigue of metals subjected to


varying stress' paper presented to Japan Soc Mech Engrs
(Jukvoka, Japan, 1968)
CYCLES = DC, GF,BA 5. Richards, F., LaPointe, N. and Wetzel, R. 'A cycle counting
algorithm for fatigue damage analysis' Paper No 74(3278
presented at: SAE Automotive Engineering Congress (Detroit,
X = ABS(E--H) Michigan, 1974)
Y = ABS(I-F-E) 6. Nelson, D. V. a n d F u c h s , H. O. 'Predictions of cumulative
damage using condensed load histories' Paper 750045 presented
X-"f AND Y CONTAINS S at : SA E Automotive Engineering Congress (Detroi t, Mich igan,
F[G. 38 Y AND DISCARDl"l"S PO.T.NTS 1975)

38 I N T . J. F A T I G U E January 1982
7. Socie, D. F. 'Fatigue-life prediction using local stress/strain A UTHORS
concept' Experimental Mech 17 No 2 (1977) pp 5 0 - 5 6
6. Socie, D. F., Shifflet, G. and Berns, H. 'A field recording Stephen Downing is with Deere and Company's Engineer-
system with applications to fatigue analysis' Int d Fatigue 1 ing Mechanics Group in Moline and Darrell Socie is with the
No 2 (April 1979) pp 103-111 Department of Mechanical and Industrial Engineering in the
9. Wetzel, R. M. 'A method of fatigue damage analysis' PhD University of Illinois at Urbana-Champaign. In the first
Thesis (Department of Civil Engineering, University of instance inquiries should be addressed to: Mr S. D. Downing,
Waterloo, Ontario, Canada, 1971 ) Engineering Mechanics, Deere and Company, 3300 River
10. Okamura, H., Sakai, S. and Susuki, I. 'Cumulative fatigue Drive, Moline, Illinois 61265, USA.
damage under random loads' Fatigue Engng Mater and Struct
1 (1979) pp 4 0 9 - 4 1 9

Appendix 1

RFI ) NI-LOH lql_(l(~ I 1 ~ I

THIS P R t K ~ f~INI-'LDW COtlNI.~ Fl HI%IOI,~Y uF I-'ERKS


RNI) VALLEYS IN .SEQUENCE WHICH Hf-IS I~FEN RF_HI,~kHNGED
10 BEG]N fIND ENI> WllH ]HI-_ MRXIMUM PI~HK (OR MINIM~IM
VRLI.FV>. SIRIEMF_NI I_R~I-_I.S CI~,tRI-__~-~ONI> 1 u 1H~ SIE.P5 IN
IHF_ RRINFL.OW C O I ~ N l l N G RULES.

D I M~ N . ~ I O N E ( 5 @ )
N=O
N=-:N+~.
CRI.L I ~ R I H ( E ( N ) , K )
I F ( K E-Q. : ! ) .t-,lOP
2 IF(N l.l..'¢) ((I 1(: l
X=RfYS ( E ( N ) - - E ( N - l . ) )
V---HBS(E ( N - ~ ) - - ~ ( N - 2 ) )
3 ] F ( X L I . Y) GI) I u 'I
4 RHNGE= V
XM~_FIN= ( E ( N - 1 ) + E ( N - z ) ) / 2
N=,N-;,
E(N)=F.(N+2)
G~) T{) 2
END

Appendix 2

llf-ll~L{~l,l f-ILGOf~ITI-~M ]I (,C~NF-PH~ '~,)

1 H I S PROGRftM RflIN~L.(~N [ : O U N I ~ A H ] S I [ ~ t Y R~ 11 OCCLN,Ch RN[,


] D E N ] I F ] E _(', ]FIE..~-~MF ['YC;L.E-~ H~ ~Ia]NFI..UW RLO[HK,]]HM I I~H}I-H
K~-QUIkE.-% I H F l l ] H F H I . ~ I I ~ Y NE I,t[rFI~tHNGFI) .~.THIFMr.NI I Fl~PI
~--9 CLW~kESPOND 1 0 lHfr 51b.PS ] N 1HE R f l I N P I O W C(JUNIING ktllIIFS

|)1M~NS] ON E(~.OB ~
N:='./
J =e~

CRI_L. D R I R ( F ( . ~ ) , K )
CRI_L. D ~ I R ( E ( ; : ) , K )
IF(E(1). E&I. E ( 2 ' > ) GO 1 0 ~ e ~
SLOPE= "1.
] F ( E ( ~ > . G1 E ( 2 ) ) SI.C~k=-I.
{;ALl_ [ J ~ l l R ( f ~, K )
} F ( K F.(~ 1 ) GU ILI 6
N=:N*~.
.St O P F . = S I _ O P E * ( - J )
E (N).'=P

I N T . J. F A T I G U E January 1982 39
Appendix ?, (ctd)
~' I F ( N . L.1. I S I R R I + ~ > [~0 1 0 :I
X=SI OPI-:~,(I-_(N)-E ( N - I ) )
] F ( X LE.. i}. ) {iO TO ~'_~
} F ( N 1.1. ]Slf-ff, C l ÷ 2 ) GO 1 0 :I
Y: SI.(IPEW,(E(N-2)-E (.N-~) )
:~ ] F ( X . I_l. Y ) G(I l(i
I F ( X . [-.(,L Y. FINi) l . % . l R W l . ~-.(~ N-P) {wU l O .1
I F ( X . (;1. Y. FW~[). I.~TF4W1 F~. N-2) (jo~ l 0 4
I F ( X . GE. Y. FIN[) } S I H W 1 Ni- N-~) fj(1 Ttl
4 } S l Mr,c1 := ] S l f-~Rl +d
0 0 1 0 :t
5 RRNKiE=Y
XMEFIN= ( E ( N - i ) ~_ ( N - ~ - ) ) / ; t
N=N-2
E (N):--~ ( N + 2 ~
GO I 0 2
6 J:=J+l
I F ( J . [~I. ) S I F I R I ) STOP
N='-N+3
.SL O~F=~I. C ~ ' . * ( - : I . )
F_(N)=:E(J )
7 ] F ( N LT. I S I R I ~ I + . 1 ) OtJ I t ) 6
X=.~LOPE,~ (I: ( N ) - h ~N-~.) )
I F ( X . LE. e. ) Or; l~J 3e~4
] F ( . N I.T I S T F W I ÷ ~ ) (iO l(J e~
Y=:SL.( IPE,k ( E ( N.-~. ) - f f ~N - ~ ) )
B I F ( X . L1. Y) OO I O (-
I F ( X . GE. Y> (30 l O .~
.9 f<f-INGh=:Y
XMERN= ( E ( N - - ~ ) + ~ ( N - 2 ) ) 7;::.
N=-.N-;.~
E ( N ) =-'IE( N + 2 )
GO l O Y
2e(,, N=N-:I
E (N)==E ( N + : I )
SL.( IPE'--.Si.LIPE, r,-.1.. )
00 l O 2
:(ele N=I4-1
E(N)=E(N+I)
SI. C'PE =:SL( IPE'=' ( -.1.. )
GO 1 0 ~
EN[)

40 I N T . J. F A T I G U E January 1982

You might also like