Sie sind auf Seite 1von 8

DynamAssist

RAINFLOW
COUNTING
ALGORITHM

version 6.2

Worksheet Information

This worksheet performs a rainflow count on a given time history. This produces a histogram of the number
of cycles of a given mean and range, counted into appropriate user-specified 'bins'. Note that the value
allocated to each bin is the value at the middle of the mean/range interval associate with the bin. The
rainflow function requires two inputs. The first is a vector which is the time history to be counted; the
second is the number of bins to be used in the rainflow histogram. The method used for the rainflow count
is taken from Amzallag et. al. (1994).
First read in the time history upon which the rainflow count is to be performed:

stress
-28.90204058
-29.21270246
-29.96892961
-30.59155933

i 1 length stress

100
50
stressi

0
50
100
150
0

1 10

2 10
i

R i fl

3 10

4 10

Rainflow counting function

The rainflow function defined below makes use of the 'trim' function (which trims
out the rows specified in the index vector from the original data vector). This
function is included as part of the Data Analysis Extension Pack but, in case this is not
available, it is included in the rainflow function.

rainflow v bins

trim data index

data data

trimcount 1
for i 1 cols data
on error match i index

newdata trimcount data i


trimcount trimcount 1
T

return newdata
N length v

"trim out any adjacent points that have identical values"


for i 1 N 1
diff v
i

i 1

v v on error trim v match 0 diff


N length v
"trim out any intermediate points"
for i 2 N 1

inter if v
i

i 1

v v v
i

i 1

vi1 vi vi vi1 1 0

v v on error trim v match 1 inter


N length v
Nmax N
"limits for the mean and range bins"
for j 1 bins 1
Rlim
j

max v min v
j 1
bins

bins

Mlim min v
j

max v min v
j 1
bins

"mid-values for the mean and range bins"


for j 1 bins
Rbinval
j

max v min v
1
j
bins
2

Mbinval min v
j

max v min v
bins

"set the initial rainflow count (initial and residual) for each bin to zero"
Rcount

bins bins

Rcountres

bins bins

"now pass through the time history, counting and removing any cycles that are found"
"repeat this until no more complete cycles can be counted and all that is left is a 'residual' '"
for count 1 10000

0
check 0

0
"loop to find the cycles to be counted"
for i 4 N

stack check1 i 2 i 1

vi 2 vi 1
check if v
v v
v v v v
v v
v v v
check

i 2
i 3
i 1
i 3
i
i 2
i 2
i 3
i 1
i 3
i
i 2
2

v v

i 2 i 1

"jump out of this loop as soon as a cycle has been found"


break if check

"jump out of this loop if no more cycles have been found"


break if check = 0
1

"count the cycle into the relevant bin"


for i 1 bins

for j 1 bins
Rcount

i j

Rcount

i j

check

2 1

Mlim check
i

2 1

Mlim

check Rlim check Rlim


2 2
j
2 2
j1

i 1

"remove the data points for the cycle that has been counte d"

check trim check 1


1

v trim v check

N length v
vres1 v
"the next step is to rainflow count the 'residual' "
"first add the residual to itself"
for i 1 N
v

i N

N length v
"trim out any adjacent points that have identical values"
for i 1 N 1
diffres v
i

i 1

v v on error trim v match 0 diffres


N length v
"trim out any intermediate points"
for i 2 N 1

interres if v
i

i 1

v v v
i

i 1

vi1 vi vi vi1 1 0

v v on error trim v match 1 interres


N length v
Nmax N

"now pass through the time history, counting and removing any cycles that are found"
"repeat this until no more complete cycles can be counted and all that is left is the 'residual' again '"
for countres 1 10000

check 0

0

"loop to find the cycles to be counted"


for i 4 N

stack check1 i 2 i 1

vi 2 vi 1
check if v
v v
v v v v
v v
v v v
check

i 2
i 3
i 1
i 3
i
i 2
i 2
i 3
i 1
i 3
i
i 2
2

v v

i 2 i 1

"jump out of this loop as soon as a cycle has been found"


break if check

"jump out of this loop if no more cycles have been found"


break if check = 0
1

"count the cycle into the relevant bin"


for i 1 bins
for j 1 bins
Rcountres

i j

Rcountres

i j

check

2 1

"remove the data points for the cycle that has been counted"

check trim check 1


1

v trim v check

N length v
vres2 v
"Overall rainflow matrix"
Rain Rcount Rcountres
"Range count"
for i 1 bins
Range
i

Rain i

"Description of values written out to the results vector:"


"rainflow count mean/range matrix"
"range count"
"central value for each range bin"

Mlim check
Mlim check
Rlim check
Rlim
i
2 1
i 1
2 2
j
2 2
j1


"central value for each mean bin"


"number of passes through the initial data - should be less than 10000"
"initial rainflow count"
"number of passes through the residual data - should be less than 10000"
"residual rainflow count"
"initial residual"
"final residual - should be same as initial residual"

Rain
Range

Rbinval
Mbinval

count
Rcount

countres
Rcountres
vres1

vres2

Rainflow counting function

Set the number of mean and range bins

bins 50

Perform the rainflow count with this number of bins

Result rainflow stress bins

Results

Mean / Range count

MeanRange Result

Range count

Rangecount Result

Range bin values

Rangeval Result

Mean bin values

Meanval Result

1
2

Range count results

300
200
Rangecount
100
0

50

100
Rangeval

Range / Mean count results


Reformat results for 3D plot

150

200

Other datasets used for checking/validation

range mean count

Das könnte Ihnen auch gefallen