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.746781 1.648603 1 6.262732 8.320329 2 2.801580 -2.177818 3 2.804332 5.134315 4 3.065899 2.098992 ... ... ... 1030 6.854375 6.484520 1031 8.194538 -10.995772 1032 -2.833096 6.257419 1033 -3.230922 10.886451 1034 4.128377 5.654207 1035 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-16.29320270590753, -13.859738760511423] (-18.66415325029162, -16.011616919540018] 0.0 (-16.011616919540018, -13.359080588788416] 0.0 (-13.359080588788416, -10.706544258036814] 0.0 (-10.706544258036814, -8.054007927285213] 0.0 (-8.054007927285213, -5.401471596533611] 0.0 ... (20.208756475034047, 22.64222042043015] (10.513746387976, 13.1662827187276] 0.0 (13.1662827187276, 15.818819049479202] 0.0 (15.818819049479202, 18.471355380230804] 0.0 (18.471355380230804, 21.123891710982406] 0.0 (21.123891710982406, 23.77642804173401] 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.