The ThreePointDetector class#
- class pylife.stress.rainflow.ThreePointDetector(recorder=None)[source]#
Count rainflow cycles with the classic three-point criterion.
Use this detector for general load collectives when the three-point method is the desired rainflow convention. The detector reports loop start and end loads to
pylife.stress.rainflow.LoopValueRecorderor, when sample indices are needed, topylife.stress.rainflow.FullRecorder. The recorder collective can then be transformed to load amplitude, load range, mean load, and number of cycles for fatigue assessment inpylife.strength.fatigue.- Parameters:
recorder (pylife.stress.rainflow.AbstractRecorder, optional) – Recorder receiving detected loop loads in MPa. If not given, a new
pylife.stress.rainflow.LoopValueRecorderis created. Usepylife.stress.rainflow.FullRecorderto store the sample indices of the two turning points in addition to the load values.
See also
pylife.stress.rainflow.FourPointDetectorCount cycles with the four-point criterion.
pylife.stress.rainflow.FKMDetectorCount cycles by the classic FKM procedure.
pylife.stress.rainflow.FullRecorderStore loop loads and sample indices.
Notes
The three-point detector evaluates a start point \(S\), the following front point \(F\), and the following back point \(B\). A closed loop is counted when the back point reaches beyond the start-front excursion,
\[|B - F| \ge |F - S|,\]and the front is not part of an already closed loop or an uncovered front residual. When a loop closes, the same back point may also close older open loops. The recorded loop values are reversal loads in MPa; their peak-to-peak load range is \(L_R = |L_F - L_S|\) and their load amplitude is \(L_a = L_R / 2\).
The detector supports chunked processing. Repeated calls to
process()continue the count across chunk boundaries; setflush=Trueonly for the final chunk if the last sample shall be considered a turning point.Examples
>>> from pylife.stress.rainflow import ThreePointDetector >>> detector = ThreePointDetector() >>> detector.process([0.0, 3.0, -1.0, 2.0, -2.0, 0.0], flush=True) is detector True >>> detector.recorder.collective from to 0 -1.0 2.0
Inject a
pylife.stress.rainflow.FullRecorderexplicitly when sample indices are needed in addition to the loop loads:>>> from pylife.stress.rainflow import FullRecorder >>> detector = ThreePointDetector(recorder=FullRecorder()) >>> detector.process([0.0, 3.0, -1.0, 2.0, -2.0, 0.0], flush=True) is detector True >>> detector.recorder.collective from to index_from index_to 0 -1.0 2.0 2 3
- __init__(recorder=None)[source]#
Instantiate a three-point detector.
- Parameters:
recorder (pylife.stress.rainflow.AbstractRecorder, optional) – Recorder receiving detected loop loads in MPa. The recorder must implement
record_values(); recorders that also implementrecord_index()receive sample indices. If not given, a newpylife.stress.rainflow.LoopValueRecorderis created.
- process(samples, flush=False)[source]#
Process a chunk of load samples.
- Parameters:
samples (array_like) – Load samples in MPa. The detector extracts turning points and combines them with residual turning points from previous chunks.
flush (bool, optional) – Force processing of the last value as a turning point. Default is
False. Seepylife.stress.rainflow.FourPointDetector.process()for the streaming consequences of flushing.
- Returns:
The detector itself, so that repeated
process()calls can be chained.- Return type: