Python interface for rainflow counting
Project description
Rainflow Python Package (rfcnt)
Summary
The rfcnt package provides a high-performance, standards-compliant implementation of the rainflow counting algorithm for fatigue analysis, with bindings for Python, C/C++, and MATLAB. It supports the 4-point method (DIN 45667), the ASTM E 1049 3-point method, HCM (Clormann/Seeger), and advanced residue handling. This README summarizes the package for users and developers. For full documentation, see the /docs folder.
Features
- Fast C core with Python and MATLAB wrappers
- 4-point, HCM, and ASTM counting methods
- Flexible residue processing (DIN, ASTM, repeated, ignore, HCM)
- Streaming and batch processing
- Dynamic class management (auto-resize, offset)
- Compile-time feature selection (minimal, delegates, damage history, etc.)
- Unit tests and real-world examples
Algorithm Overview
Rainflow counting extracts closed cycles from load histories in four main steps:
- Hysteresis Filtering: Removes small oscillations below a threshold
- Peak-Valley Filtering: Identifies turning points
- Discretization: Maps values to classes (bins)
- 4-Point Counting: Detects closed cycles using the 4-point pattern
A cycle B-C is closed if:
min(B, C) >= min(A, D) and max(B, C) <= max(A, D)
Closed cycles are counted and removed; residue is handled per user choice.
Installation
Prerequisites:
- Python 3.6+
- NumPy (>=2.0)
- CMake 3.16+
- C/C++ compiler (GCC, Clang, MSVC)
Build and Install:
cmake -S. -Bbuild -DRFC_EXPORT_PY=1
cmake --build build --target build_wheel_isolated --config Release
pip install dist/rfcnt-*.whl
Or install from source:
pip install . --no-build-isolation --no-deps
MATLAB: See docs/installation.rst for MATLAB integration.
Quick Start
import numpy as np
import rfcnt
data = np.array([0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0])
result = rfcnt.rfc(data, class_width=0.5, class_count=10)
print("Total damage:", result['damage'])
print("Range pairs:\n", result['rp'])
Advanced Usage
- Use Wöhler curve parameters for fatigue life prediction
- Select counting method:
use_HCM,use_ASTM - Control residue handling:
residual_method - Enable damage history:
spread_damage - Integrate with real-time or embedded systems (RFC_MINIMAL)
Example:
result = rfcnt.rfc(
data,
class_width=5.0,
use_HCM=True,
spread_damage=rfcnt.SDMethod.TRANSIENT_23c,
hysteresis=2.5
)
Documentation
- Algorithm details: docs/algorithm.rst
- Features: docs/features.rst
- Examples: docs/examples.rst
- Installation: docs/installation.rst
- References: docs/references.rst
References
[1] ASTM E 1049, "Standard Practices for Cycle Counting in Fatigue Analysis", ASTM International, 2011.
[2] U.H. Clormann, T. Seeger, "Rainflow - HCM / Ein Hysteresisschleifen-Zaehlalgorithmus...", TU Darmstadt, 1985.
[3] FVA-Richtlinie, 2010. https://fva-net.de/fileadmin/content/Richtlinien/FVA-Richtlinie_Zaehlverfahren_2010.pdf
[4] Siemens PLM, "Rainflow Counting", 2018. https://community.plm.automation.siemens.com/t5/Testing-Knowledge-Base/Rainflow-Counting/ta-p/383093
For a full bibliography, see docs/references.rst.
License
See LICENSE file.
Contact
For questions, bug reports, or contributions, see the project repository or contact the maintainer.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rfcnt-0.5.2.post2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: rfcnt-0.5.2.post2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 77.9 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e7fc2d11c9ebe0050404bca1a953e24e428a0ce3887fa59d4f8b4b6aaaebdcc
|
|
| MD5 |
07cfa6281e3f7d461875f400946c8acf
|
|
| BLAKE2b-256 |
8f756a8705786e17b312704182f43efb99d9996ef704a242c7363ce72feb5b68
|