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 -1.504503 1.789666 1 -5.378955 6.024227 2 7.689641 0.721345 3 -3.167308 -2.653538 4 -1.161159 1.114979 ... ... ... 1024 -8.101027 1.366819 1025 -9.989371 3.250017 1026 -13.705893 12.305978 1027 1.875057 -7.202823 1028 0.108368 -4.589748 1029 rows × 2 columns
Alternatively you can ask the recorder for a histogram matrix:
rfc.recorder.histogram(bins=16)
from to (-24.120703051666418, -21.445334039036137] (-21.756490952306315, -19.259009315002267] 0.0 (-19.259009315002267, -16.761527677698222] 0.0 (-16.761527677698222, -14.264046040394174] 0.0 (-14.264046040394174, -11.766564403090127] 0.0 (-11.766564403090127, -9.26908276578608] 0.0 ... (16.009832137787804, 18.68520115041809] (5.715807058038202, 8.21328869534225] 0.0 (8.21328869534225, 10.710770332646298] 0.0 (10.710770332646298, 13.20825196995034] 0.0 (13.20825196995034, 15.705733607254388] 0.0 (15.705733607254388, 18.203215244558436] 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.