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 2.443686 3.927448 1 3.284488 -10.290790 2 -2.262977 1.336638 3 -3.657237 -1.365633 4 -5.360220 2.735193 ... ... ... 997 -2.746358 -0.133583 998 -4.381293 0.345181 999 -1.607172 -1.902053 1000 7.902405 -7.793638 1001 -0.685121 5.986917 1002 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-20.285284031951928, -17.878069922305432] (-21.86891534766978, -19.15115596276683] 0.0 (-19.15115596276683, -16.433396577863878] 0.0 (-16.433396577863878, -13.715637192960926] 0.0 (-13.715637192960926, -10.997877808057975] 0.0 (-10.997877808057975, -8.280118423155024] 0.0 ... (15.822927612745513, 18.230141722392013] (8.026437886262684, 10.744197271165635] 0.0 (10.744197271165635, 13.461956656068583] 0.0 (13.461956656068583, 16.179716040971538] 0.0 (16.179716040971538, 18.897475425874493] 0.0 (18.897475425874493, 21.61523481077744] 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.