The ThreePointDetector
class¶
- class pylife.stress.rainflow.ThreePointDetector(recorder)[source]¶
Classic three 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.ThreePointDetector(recorder=RF.LoopValueRecorder()) rfc.process(ts) rfc.recorder.collective
from to 0 3.188508 3.484890 1 -3.780078 3.444729 2 -4.677518 1.831337 3 -2.277233 -0.731859 4 3.406270 -5.472779 ... ... ... 1086 -0.682471 0.476438 1087 -12.315975 10.315186 1088 -13.129631 13.588141 1089 -13.579655 18.647978 1090 6.118420 -2.576016 1091 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-18.213395585606847, -15.766840290773057] (-18.226496442303667, -15.762645612945093] 0.0 (-15.762645612945093, -13.298794783586521] 0.0 (-13.298794783586521, -10.834943954227949] 0.0 (-10.834943954227949, -8.371093124869375] 0.0 (-8.371093124869375, -5.907242295510802] 0.0 ... (18.484933836899998, 20.931489131733784] (8.875862680640633, 11.339713509999207] 0.0 (11.339713509999207, 13.80356433935778] 0.0 (13.80356433935778, 16.26741516871635] 0.0 (16.26741516871635, 18.731265998074928] 0.0 (18.731265998074928, 21.1951168274335] 0.0 Length: 256, dtype: float64
We take three turning points into account to detect closed hysteresis loops.
start: the point where the loop is starting from
front: the turning point after the start
back: the turning point after the front
A loop is considered closed if following conditions are met:
the load difference between front and back is bigger than or equal the one between start and front. In other words: if the back goes beyond the starting point. For example (A-B-C) and (B-C-D) not closed, whereas (C-D-E) is.
the loop init has not been a loop front in a prior closed loop. For example F would close the loops (D-E-F) but D is already front of the closed loop (C-D-E).
the load level of the front has already been covered by a prior turning point. Otherwise it is considered part of the front residuum.
When a loop is closed it is possible that the loop back also closes unclosed loops of the past by acting as loop back for an unclosed start/front pair. For example E closes the loop (C-D-E) and then also (A-B-E).
Load ----------------------------- | x B F x --------/-\-----------------/----- | / \ x D / ------/-----\-/-\---------/------- | / C x \ / --\-/-------------\-----/--------- | x A \ / --------------------\-/----------- | x E ---------------------------------- | Time
- __init__(recorder)[source]¶
Instantiate a ThreePointDetector.
- Parameters
recorder (subclass of
AbstractRecorder
) – The recorder that the detector will report to.