The FourPointDetector
class
- class pylife.stress.rainflow.FourPointDetector(recorder)[source]
Implements four point rainflow counting algorithm.
from pylife.stress.timesignal import TimeSignalGenerator import pylife.stress.rainflow as RF ts = TimeSignalGenerator(10, { 'number': 50, 'amplitude_median': 1.0, 'amplitude_std_dev': 0.5, 'frequency_median': 4, 'frequency_std_dev': 3, 'offset_median': 0, 'offset_std_dev': 0.4}, None, None).query(10000) rfc = RF.FourPointDetector(recorder=RF.LoopValueRecorder()) rfc.process(ts) rfc.recorder.collective
from to 0 1.779876 2.723641 1 -1.359676 -0.778804 2 -2.125195 6.859020 3 -3.348581 4.376982 4 -3.897363 7.454785 ... ... ... 1151 -2.651181 -10.562509 1152 5.215703 -11.053213 1153 4.178518 4.147719 1154 7.240966 -11.056957 1155 10.316823 -13.913987 1156 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-18.419472620225868, -16.351550689938875] (-19.090203631591, -16.99318139628545] 0.0 (-16.99318139628545, -14.8961591609799] 0.0 (-14.8961591609799, -12.79913692567435] 0.0 (-12.79913692567435, -10.702114690368802] 0.0 (-10.702114690368802, -8.605092455063254] 0.0 ... (12.599356334079033, 14.667278264366024] (3.9770409567700433, 6.074063192075592] 0.0 (6.074063192075592, 8.17108542738114] 0.0 (8.17108542738114, 10.268107662686692] 0.0 (10.268107662686692, 12.36512989799224] 0.0 (12.36512989799224, 14.462152133297785] 0.0 Length: 256, dtype: float64
We take four turning points into account to detect closed hysteresis loops.
Consider four consecutive peak/valley points say, A, B, C, and D If B and C are contained within A and B, then a cycle is counted from B to C; otherwise no cycle is counted.
i.e, If
X ≥ Y AND Z ≥ Y
then a cycle existFROM = B
andTO = C
where, rangesX = |D–C|
,Y = |C–B|
, andZ = |B–A|
Load ----------------------------- | x B F x --------/-\-----------------/----- | / \ x D / ------/-----\-/-\---------/------- | / C x \ / --\-/-------------\-----/--------- | x A \ / --------------------\-/----------- | x E ---------------------------------- | Time
So, if a cycle exsist from B to C then delete these peaks from the turns array and perform next iteration by joining A&D else if no cylce exsists, then B would be the next strarting point.
- __init__(recorder)[source]
Instantiate a FourPointDetector.
- Parameters:
recorder (subclass of
AbstractRecorder
) – The recorder that the detector will report to.