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 -6.631055 3.641915 1 4.638039 5.643112 2 7.299681 -5.980538 3 1.994762 1.472573 4 3.731940 -0.127724 ... ... ... 1095 12.414769 -8.568888 1096 14.520373 -13.034524 1097 -1.440109 -7.664336 1098 -0.778939 4.204315 1099 1.461007 -0.220545 1100 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-19.18775856305451, -16.886403588714458] (-16.969067413570947, -14.770686463437272] 0.0 (-14.770686463437272, -12.572305513303595] 0.0 (-12.572305513303595, -10.373924563169918] 0.0 (-10.373924563169918, -8.175543613036243] 0.0 (-8.175543613036243, -5.977162662902568] 0.0 ... (15.33256605204624, 17.63392102638629] (7.213123037899489, 9.411503988033164] 0.0 (9.411503988033164, 11.60988493816684] 0.0 (11.60988493816684, 13.808265888300518] 0.0 (13.808265888300518, 16.006646838434193] 0.0 (16.006646838434193, 18.205027788567868] 0.0 Length: 256, dtype: float64We 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 ≥ Ythen a cycle existFROM = BandTO = Cwhere, 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.