Giter Site home page Giter Site logo

a-ma72 / rainflow Goto Github PK

View Code? Open in Web Editor NEW
37.0 2.0 8.0 17.1 MB

Fast rainflow counting written in C (C99). Including wrappers for MATLAB and Python

License: BSD 2-Clause "Simplified" License

CMake 3.42% C 64.14% C++ 10.99% Python 3.14% Batchfile 0.03% Shell 0.01% Jupyter Notebook 18.29%
rainflow-counting point-counting cycle-counting hysteresis fatigue hcm hysteresis-filtering rfm turning-points fatigue-analysis rainflow python python-3 matlab

rainflow's Introduction

tests

Rainflow Counting Algorithm (4-point-methods), C99 compliant

"Rainflow Counting" consists of four main steps:

  1. Hysteresis Filtering

  2. Peak-Valley Filtering

  3. Discretization

  4. Four Point Counting Method:

                * D
               / \       Closed, if min(B,C) >= min(A,D) && max(B,C) <= max(A,D)
        B *<--/          Slope B-C is counted and removed from residue
         / \ /
        /   * C
     \ /
      * A
    

These steps are fully documented in standards such as ASTM E 1049 "Standard Practices for Cycle Counting in Fatigue Analysis" [1] This implementation uses the 4-point algorithm mentioned in [3,4] and the 3-point HCM method proposed in [2] as well as the ASTM E 1049 (2011) standard in [1]. To take the residue into account, you may implement a custom method or use some predefined functions.

Features of this package

  1. Modular architecture in two layers:
    • Module rainflow.c (with rainflow.h) holds all necessary functions for rainflow counting and histogram extraction. You may select multiple optional features at compile time:
      RFC_MINIMAL: To use core functions for rainflow counting only (for porting to µControllers for example).
      RFC_TP_SUPPORT: Turning point storage.
      RFC_HCM_SUPPORT: HCM algorithm (Clormann/Seeger).
      RFC_ASTM_SUPPORT: ASTM E 1049 (2011) algorithm.
      RFC_AT_SUPPORT: User defined amplitude transformation (Haigh diagram).
      RFC_DH_SUPPORT: Damage history storage.
      RFC_USE_DELEGATES: Delegates for various core functions to implement user defined behavior.
      RFC_GLOBAL_EXTREMA: Store global data extrema.
      RFC_DAMAGE_FAST: Using lookup tables for damage and amplitude transformation.
      RFC_EXPORT_MEX: Export a mexFunction() to use the rainflow counting in MATLAB (R).
      RFC_EXPORT_PY: Export a Python extension to use the rainflow counting in Python.
      RFC_UNIT_TEST: Build an executable for unit testing.
      Using COAN [[http://coan2.sourceforge.net/]] for example, you can tidy up the code from unwanted features.
      (The minimal version of this package is created using COAN with option RFC_MINMALset.)
    • C++ wrapper rainflow.hpp encapsulates functions from rainflow.h in a namespace and offers a template class Rainflow for object oriented access and inheritance.
      This class also offers container class based turning point storage.
  2. Streamable: You're able to count your data at once, as data packages or sample-wise.
  3. Class width fit to your needs. Dynamically increase class width, when needed. (Needs turning point storage.)
  4. Four point counting method, optionally HCM counting method (Clormann/Seeger).
  5. Woehler curve with up to two slopes, fatigue limit and omission.
  6. Miners rule for damage accumulation (elementary, original, modified and consequent).
  7. In-time damage indicator (Miners' consequent rule).
  8. In-time histograms: rainflow matrix, level crossing and range pair counting.
  9. Turning points with hysteresis filtering. Turning points involved in a closed hysteresis are marked as pairs, with its partial assigned damage. (Compact history)
  10. Look-up tables for damage calculation and amplitude transformation.
  11. Amplitude transformation (Haigh diagram) according to FKM (symmetrical, non-symmetrical or user defined).
  12. Damage history (uncompressed)
  13. Various methods on residual data:
    • According to DIN 45667
    • ASTM method (halfcycle, fullcycle)
    • Second run
    • HCM
  14. Various function pointers to implement user defined behavior.
  15. Conversions supporting RFM->LC, RFM->RP, RFM->Damage and RP->Damage (original, elementar, modifiziert, konsequent).

Build from sources

Building makefiles from sources root folder in a shell:

cmake -S. -Bbuild -G "Visual Studio 16 2019"
cmake --build build --config Release

If you intend to use a special MATLAB(R) installation to build the project just set an environment variable Matlab_ROOT_DIR such as

export Matlab_ROOT_DIR=/usr/local/MATLAB/R2019b

or use the option to configure the build tree:

cmake -S. -Bbuild -DMatlab_ROOT_DIR=/usr/local/MATLAB/R2017b -G "Visual Studio 16 2019"
cmake --build build --config Release

MATLAB (only)

cmake -S. -Bbuild -DRFC_EXPORT_PY=0 -DRFC_UNIT_TEST=0 -G "Visual Studio 16 2019"
cmake --build build --target rfc_mex --config Release

Python (only)

cmake -S. -Bbuild -DRFC_EXPORT_MEX=0 -DRFC_UNIT_TEST=0 -G "Visual Studio 16 2019"
cmake --build build --target rfcnt --config Release

To build a Python package (wheel) you don't need cmake. Use packages setuptools, wheel and build instead:

cd src/python
pip install setuptools build wheel oldest-supported-numpy
python -mbuild -nw

Run examples

python -m rfcnt.run_examples

Using rfcnt in Google Colaboratory https://colab.research.google.com

!pip install --no-build-isolation --no-deps https://github.com/a-ma72/rainflow/releases/download/rfcnt-0.4.7rc0/rfcnt-0.4.7rc0.tar.gz

import rfcnt
rfcnt.tests.examples.example_1()

Unit test (only)

Currently, two options are offered to perform a unit test:

  1. Build rfc_test and execute in a shell:

     cmake -S. -Bbuild -DRFC_EXPORT_PY=0 -DRFC_EXPORT_MEX=0 -G "Visual Studio 16 2019"
     cmake --build build --target rfc_test --config Release
    

    Then invoke the unit test:

     build/test/Release/rfc_test      # Linux
     build\test\Release\rfc_test.exe  # Windows
    

    or

     ctest -C Release
    
  2. Run Python code (shell):

    python -m rfcnt.run_tests


References:

[1] "Standard Practices for Cycle Counting in Fatigue Analysis."
ASTM Standard E 1049, 1985 (2011).
West Conshohocken, PA: ASTM International, 2011.
[2] "Rainflow - HCM / Ein Hysteresisschleifen-Zaehlalgorithmus auf werkstoffmechanischer Grundlage"
U.H. Clormann, T. Seeger
1985 TU Darmstadt, Fachgebiet Werkstoffmechanik
[3] "Zaehlverfahren zur Bildung von Kollektiven und Matrizen aus Zeitfunktionen"
FVA-Richtlinie, 2010.
[https://fva-net.de/fileadmin/content/Richtlinien/FVA-Richtlinie_Zaehlverfahren_2010.pdf]
[4] Siemens Product Lifecycle Management Software Inc., 2018.
[https://community.plm.automation.siemens.com/t5/Testing-Knowledge-Base/Rainflow-Counting/ta-p/383093]
[5] "Review and application of Rainflow residue processing techniques for accurate fatigue damage estimation"
G.Marsh;
International Journal of Fatigue 82 (2016) 757-765,
[https://doi.org/10.1016/j.ijfatigue.2015.10.007]
[6] "Betriebsfestigkeit - Verfahren und Daten zur Bauteilberechnung"
Haibach, Erwin; Springer Verlag
[] "Schaedigungsbasierte Hysteresefilter"; Hack, M, D386 (Diss Univ. Kaiserslautern), Shaker Verlag Aachen, 1998, ISBN 3-8265-3936-2
[] "Hysteresis and Phase Transition"
Brokate, M.; Sprekels, J.; Applied Mathematical Sciences 121; Springer, New York, 1996
[] "Rainflow counting and energy dissipation in elastoplasticity"; Eur. J. Mech. A/Solids 15, pp. 705-737, 1996
Brokate, M.; Dressler, K.; Krejci, P.
[] "Multivariate Density Estimation: Theory, Practice and Visualization". New York, Chichester, Wiley & Sons, 1992
Scott, D.
[] "Werkstoffmechanik - Bauteile sicher beurteilen undWerkstoffe richtig einsetzen";
Ralf Buergel, Hans Albert Richard, Andre Riemer; Springer FachmedienWiesbaden 2005, 2014
[] "Zaehlverfahren und Lastannahme in der Betriebsfestigkeit";
Michael Koehler, Sven Jenne / Kurt Poetter, Harald Zenner; Springer-Verlag Berlin Heidelberg 2012

rainflow's People

Contributors

a-ma72 avatar till-m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rainflow's Issues

Documentation

Hi,
is there any documentation on how to use the different counting options? Like HCM, ASTM, ...
And in the example you published, theres the res variable we get back with a lot of arrays, is there a dosumentation about that as well? What array means what?

Regards,
Alex

Documentation damage calculation

Hi,

Do you have any documentation explaining how damage is calculated using the different methods (FULL_P2,FULL_P3,HALF_23, TRANSIENT_23...)

Best regards,

Vitor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.