Rychlik counting method
[1]:
# Import auxiliary libraries for demonstration
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams[ "figure.figsize" ] = [ 5, 4 ]
plt.rcParams[ "figure.dpi" ] = 80
plt.rcParams[ "font.family" ] = "Times New Roman"
plt.rcParams[ "font.size" ] = '14'
Rychlik rainflow counting
Function rychlikRainflowCounting
implements the Rychlik rainflow counting method.
Reference:
Rychlik, I., 1987. A new definition of the rainflow cycle counting method. International journal of fatigue, 9(2), pp.119-121.
Function help
[2]:
from ffpack.lcc import rychlikRainflowCounting
help( rychlikRainflowCounting )
Help on function rychlikRainflowCounting in module ffpack.lcc.rychlikCounting:
rychlikRainflowCounting(data, aggregate=True)
Rychilk rainflow counting (toplevel-up cycle TUC)
Parameters
----------
data: 1d array
Load sequence data for counting.
aggragate: bool, optional
If aggregate is set to False, the original sequence for internal counting,
e.g., [ [ rangeStart1, rangeEnd1, count1 ], [ rangeStart2, rangeEnd2, count2 ], ... ],
will be returned.
Returns
-------
rst: 2d array
Sorted counting results.
Raises
------
ValueError
If the data dimension is not 1
If the data length is less than 2
Examples
--------
>>> from ffpack.lcc import rychlikRainflowCycleCounting
>>> data = [ -0.8, 1.3, 0.7, 3.4, 0.7, 2.5, -1.4, -0.5, -2.3,
>>> -2.2, -2.6, -2.4, -3.3, 1.5, 0.6, 3.4, -0.5 ]
>>> rst = rychlikRainflowCycleCounting( data )
Example with default values
[3]:
rychlikRfcSequenceData = [ -0.8, 1.3, 0.7, 3.4, 0.7, 2.5, -1.4, -0.5, -2.3,
-2.2, -2.6, -2.4, -3.3, 1.5, 0.6, 3.4, -0.5 ]
rychlikRfcCountingResults = rychlikRainflowCounting( rychlikRfcSequenceData )
[4]:
print( rychlikRfcCountingResults )
[[0.1, 1.0], [0.2, 1.0], [0.6, 1.0], [0.9, 2.0], [1.8, 1.0], [3.9, 1.0], [4.2, 1.0]]
[5]:
fig, ( ax1, ax2 ) = plt.subplots( 1, 2, figsize=( 10, 4 ) )
ax1.plot( rychlikRfcSequenceData, "o-" )
ax1.tick_params( axis='x', direction="in", length=5 )
ax1.tick_params( axis='y', direction="in", length=5 )
ax1.set_ylabel( "Load units" )
ax1.set_xlabel( "Data points" )
ax1.set_title( "Sequence data" )
ax2.barh( np.array( rychlikRfcCountingResults )[ :, 0 ],
np.array( rychlikRfcCountingResults )[ :, 1 ] )
ax2.tick_params( axis='x', direction="in", length=5 )
ax2.tick_params( axis='y', direction="in", length=5 )
ax2.set_ylabel( "Load range units" )
ax2.set_xlabel( "Counts" )
ax2.set_title( "Rychlik rainflow counting" )
plt.tight_layout()
plt.show()