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.251855 3.176047 1 -1.291603 0.840173 2 2.399841 6.967480 3 -5.535270 7.737142 4 4.206911 1.819273 ... ... ... 944 1.742229 14.452057 945 1.688455 -2.227643 946 -2.720787 1.716658 947 15.242698 -4.620461 948 -7.451687 15.268679 949 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-15.72879772899442, -13.214558559501745] (-15.082010850616276, -12.597163847382646] 0.0 (-12.597163847382646, -10.112316844149017] 0.0 (-10.112316844149017, -7.627469840915388] 0.0 (-7.627469840915388, -5.142622837681758] 0.0 (-5.142622837681758, -2.6577758344481293] 0.0 ... (21.984789813395707, 24.499028982888383] (12.25130618495365, 14.736153188187279] 0.0 (14.736153188187279, 17.221000191420906] 0.0 (17.221000191420906, 19.705847194654538] 0.0 (19.705847194654538, 22.190694197888163] 0.0 (22.190694197888163, 24.6755412011218] 0.0 Length: 256, dtype: float64We 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.