FatigueDS


NameFatigueDS JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryFatigue Damage Spectrum (FDS) and Extreme Response Spectrum (ERS)
upload_time2025-02-18 12:41:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords extreme response spectrum fatigue damage spectrum vibration fatigue
VCS
bugtrack_url
requirements numpy scipy matplotlib tqdm pyExSi rainflow
Travis-CI
coveralls test coverage No coveralls.
            FatigueDS
-----------------------

Calculating Extreme Response Spectrum (ERS) and Fatigue Damage Spectrum (FDS) of signals. 
Calculations are supported for sine, sine-sweep, and random signals (defined using PSD or time history).
The underlying theory is based on [1].

See the `documentation <https://fatigueds.readthedocs.io/en/latest/index.html>`_ for more information.


Installation
------------------

Use `pip` to install it by:

.. code-block:: console

    $ pip install FatigueDS

Usage
------------------
Some short examples of how to use the package are given below for different types of signals.

Random signals (PSD)
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is an example of determining the ERS and FDS of a random signal, defined in the frequency domain (PSD):

Generate sample signal PSD:

.. code-block:: python

    import numpy as np
    import pyExSi as es

    # generate random signal
    fs = 5000  # sampling frequency [Hz]
    time = 1  # time duration [s]
    freq_flat = np.arange(0, fs / 2, 1 / time)  # frequency vector
    freq_lower = 200  # PSD lower frequency limit  [Hz]
    freq_upper = 1000  # PSD upper frequency limit [Hz]
    PSD_flat = es.get_psd(freq_flat, freq_lower, freq_upper, variance=800)  # one-sided flat-shaped PSD

Use the package:

.. code-block:: python
    
    import FatigueDS

    # instantiate the SpecificationDevelopment class 
    # set the frequency range (start, stop, step) and damping ratio
    sd = FatigueDS.SpecificationDevelopment(freq_data=(100, 1100, 20), damp=0.05)

    # set the random load
    sd.set_random_load((PSD_flat, freq_flat), unit='ms2', T=3600)  # input is PSD array and frequency array

    # calculate the ERS and FDS
    sd.get_ers()
    sd.get_fds(b=10, C=1e80, K=6.3 * 1e10)
    
    # plot the results
    sd.plot_ers()
    sd.plot_fds()

    # or access the results directly
    ers = sd.ers
    fds = sd.fds
    f = sd.f0_range  # frequency vector
    

Random signals (time history)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is an example of determining the ERS and FDS of a random signal, defined in the time domain. For time domain, two methods are available:
    - Convolution (directly from time history, using rainflow counting)
    - PSD averaging (converting time history to PSD and then to ERS and FDS)

Import random time history data:

.. code-block:: python

    import numpy as np

    _time_data = np.load('test_data/test_time_history.npy', allow_pickle=True)
    time_history_data = _time_data[:,1]
    t = _time_data[:,0] 
    dt = t[2] - t[1]

Use the package:

.. code-block:: python

    import FatigueDS
    
    # instantiate the SpecificationDevelopment classes
    sd_1 = FatigueDS.SpecificationDevelopment(freq_data=(20, 200, 5))  # convolution
    sd_2 = FatigueDS.SpecificationDevelopment(freq_data=(20, 200, 5))  # psd averaging

    # set the random loads (input is time history array and time step)
    sd_1.set_random_load((time_history_data, dt), unit='g', method='convolution')
    sd_2.set_random_load((time_history_data, dt), unit='g', method='psd_averaging', bins=10)

    # calculate the ERS and FDS
    sd_1.get_ers()
    sd_1.get_fds(b=10, C=1e80, K=6.3 * 1e10)

    sd_2.get_ers()
    sd_2.get_fds(b=10, C=1e80, K=6.3 * 1e10)

    # plot the results

    sd_1.plot_ers(label='Time history (convolution)')
    sd_2.plot_ers(new_figure=False, label='Time history (PSD averaging)')
    
    sd_1.plot_fds(label='Time history (convolution)')
    sd_2.plot_fds(new_figure=False, label='Time history (PSD averaging)')

    # or access the results directly

    ers_1 = sd_1.ers
    fds_1 = sd_1.fds
    f_1 = sd_1.f0_range  # frequency vector

    ers_2 = sd_2.ers
    fds_2 = sd_2.fds
    f_2 = sd_2.f0_range  # frequency vector

Sine and sine-sweep signals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is an example of determining the ERS and FDS of a sine and sine-sweep signal:

.. code-block:: python

    import numpy as np
    import FatigueDS
    import matplotlib.pyplot as plt

    # instantiate classes
    sd_sine = FatigueDS.SpecificationDevelopment(freq_data=(0, 2000, 5), damp=0.1)  # sine
    sd_sine_sweep = FatigueDS.SpecificationDevelopment(freq_data=(0, 2000, 5), damp=0.1)  # sine sweep

    # set the sine and sine-sweep loads
    sd_sine.set_sine_load(sine_freq=500, amp=10, t_total=3600)  # t_total is is required only for FDS calculation.
    sd_sine_sweep.set_sine_sweep_load(const_amp=[5, 10, 20], const_f_range=[20, 100, 500, 1000], exc_type='acc', sweep_type='log', sweep_rate=1)

    # calculate the ERS and FDS
    sd_sine.get_ers()
    sd_sine_sweep.get_ers()

    sd_sine.get_fds(b=10, C=1e80, K=6.3 * 1e10)
    sd_sine_sweep.get_fds(b=10, C=1e80, K=6.3 * 1e10)

    # plot the results
    sd_sine.plot_ers(label='sine')
    sd_sine.plot_fds(label='sine')
    
    sd_sine_sweep.plot_ers(label='sine sweep')
    sd_sine_sweep.plot_fds(label='sine sweep')


References:
    1. C. Lalanne, Mechanical Vibration and Shock: Specification development,
    London, England: ISTE Ltd and John Wiley & Sons, 2009

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "FatigueDS",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "\"Ja\u0161a \u0160onc, Janko Slavi\u010d\" <jasasonc@gmail.com>",
    "keywords": "extreme response spectrum, fatigue damage spectrum, vibration fatigue",
    "author": null,
    "author_email": "\"Ja\u0161a \u0160onc, Martin \u010cesnik, Rok Pavlin, Janko Slavi\u010d\" <janko.slavic@fs.uni-lj.si>",
    "download_url": "https://files.pythonhosted.org/packages/96/79/7d004203e27fea00cd0bd710d2d81500f0dab81ec3b1d62fb989ed857c5a/fatigueds-0.1.0.tar.gz",
    "platform": null,
    "description": "FatigueDS\n-----------------------\n\nCalculating Extreme Response Spectrum (ERS) and Fatigue Damage Spectrum (FDS) of signals. \nCalculations are supported for sine, sine-sweep, and random signals (defined using PSD or time history).\nThe underlying theory is based on [1].\n\nSee the `documentation <https://fatigueds.readthedocs.io/en/latest/index.html>`_ for more information.\n\n\nInstallation\n------------------\n\nUse `pip` to install it by:\n\n.. code-block:: console\n\n    $ pip install FatigueDS\n\nUsage\n------------------\nSome short examples of how to use the package are given below for different types of signals.\n\nRandom signals (PSD)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nHere is an example of determining the ERS and FDS of a random signal, defined in the frequency domain (PSD):\n\nGenerate sample signal PSD:\n\n.. code-block:: python\n\n    import numpy as np\n    import pyExSi as es\n\n    # generate random signal\n    fs = 5000  # sampling frequency [Hz]\n    time = 1  # time duration [s]\n    freq_flat = np.arange(0, fs / 2, 1 / time)  # frequency vector\n    freq_lower = 200  # PSD lower frequency limit  [Hz]\n    freq_upper = 1000  # PSD upper frequency limit [Hz]\n    PSD_flat = es.get_psd(freq_flat, freq_lower, freq_upper, variance=800)  # one-sided flat-shaped PSD\n\nUse the package:\n\n.. code-block:: python\n    \n    import FatigueDS\n\n    # instantiate the SpecificationDevelopment class \n    # set the frequency range (start, stop, step) and damping ratio\n    sd = FatigueDS.SpecificationDevelopment(freq_data=(100, 1100, 20), damp=0.05)\n\n    # set the random load\n    sd.set_random_load((PSD_flat, freq_flat), unit='ms2', T=3600)  # input is PSD array and frequency array\n\n    # calculate the ERS and FDS\n    sd.get_ers()\n    sd.get_fds(b=10, C=1e80, K=6.3 * 1e10)\n    \n    # plot the results\n    sd.plot_ers()\n    sd.plot_fds()\n\n    # or access the results directly\n    ers = sd.ers\n    fds = sd.fds\n    f = sd.f0_range  # frequency vector\n    \n\nRandom signals (time history)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nHere is an example of determining the ERS and FDS of a random signal, defined in the time domain. For time domain, two methods are available:\n    - Convolution (directly from time history, using rainflow counting)\n    - PSD averaging (converting time history to PSD and then to ERS and FDS)\n\nImport random time history data:\n\n.. code-block:: python\n\n    import numpy as np\n\n    _time_data = np.load('test_data/test_time_history.npy', allow_pickle=True)\n    time_history_data = _time_data[:,1]\n    t = _time_data[:,0] \n    dt = t[2] - t[1]\n\nUse the package:\n\n.. code-block:: python\n\n    import FatigueDS\n    \n    # instantiate the SpecificationDevelopment classes\n    sd_1 = FatigueDS.SpecificationDevelopment(freq_data=(20, 200, 5))  # convolution\n    sd_2 = FatigueDS.SpecificationDevelopment(freq_data=(20, 200, 5))  # psd averaging\n\n    # set the random loads (input is time history array and time step)\n    sd_1.set_random_load((time_history_data, dt), unit='g', method='convolution')\n    sd_2.set_random_load((time_history_data, dt), unit='g', method='psd_averaging', bins=10)\n\n    # calculate the ERS and FDS\n    sd_1.get_ers()\n    sd_1.get_fds(b=10, C=1e80, K=6.3 * 1e10)\n\n    sd_2.get_ers()\n    sd_2.get_fds(b=10, C=1e80, K=6.3 * 1e10)\n\n    # plot the results\n\n    sd_1.plot_ers(label='Time history (convolution)')\n    sd_2.plot_ers(new_figure=False, label='Time history (PSD averaging)')\n    \n    sd_1.plot_fds(label='Time history (convolution)')\n    sd_2.plot_fds(new_figure=False, label='Time history (PSD averaging)')\n\n    # or access the results directly\n\n    ers_1 = sd_1.ers\n    fds_1 = sd_1.fds\n    f_1 = sd_1.f0_range  # frequency vector\n\n    ers_2 = sd_2.ers\n    fds_2 = sd_2.fds\n    f_2 = sd_2.f0_range  # frequency vector\n\nSine and sine-sweep signals\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nHere is an example of determining the ERS and FDS of a sine and sine-sweep signal:\n\n.. code-block:: python\n\n    import numpy as np\n    import FatigueDS\n    import matplotlib.pyplot as plt\n\n    # instantiate classes\n    sd_sine = FatigueDS.SpecificationDevelopment(freq_data=(0, 2000, 5), damp=0.1)  # sine\n    sd_sine_sweep = FatigueDS.SpecificationDevelopment(freq_data=(0, 2000, 5), damp=0.1)  # sine sweep\n\n    # set the sine and sine-sweep loads\n    sd_sine.set_sine_load(sine_freq=500, amp=10, t_total=3600)  # t_total is is required only for FDS calculation.\n    sd_sine_sweep.set_sine_sweep_load(const_amp=[5, 10, 20], const_f_range=[20, 100, 500, 1000], exc_type='acc', sweep_type='log', sweep_rate=1)\n\n    # calculate the ERS and FDS\n    sd_sine.get_ers()\n    sd_sine_sweep.get_ers()\n\n    sd_sine.get_fds(b=10, C=1e80, K=6.3 * 1e10)\n    sd_sine_sweep.get_fds(b=10, C=1e80, K=6.3 * 1e10)\n\n    # plot the results\n    sd_sine.plot_ers(label='sine')\n    sd_sine.plot_fds(label='sine')\n    \n    sd_sine_sweep.plot_ers(label='sine sweep')\n    sd_sine_sweep.plot_fds(label='sine sweep')\n\n\nReferences:\n    1. C. Lalanne, Mechanical Vibration and Shock: Specification development,\n    London, England: ISTE Ltd and John Wiley & Sons, 2009\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Fatigue Damage Spectrum (FDS) and Extreme Response Spectrum (ERS)",
    "version": "0.1.0",
    "project_urls": {
        "documentation": "https://fatigueds.readthedocs.io/en/latest/",
        "homepage": "https://github.com/ladisk/FatigueDS",
        "source": "https://github.com/ladisk/FatigueDS"
    },
    "split_keywords": [
        "extreme response spectrum",
        " fatigue damage spectrum",
        " vibration fatigue"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a2cad80eb2f4384f266082e2e435976e2af8c4353415b8dd4ae0e18c1732e0f6",
                "md5": "0e8cb9628d6821ea4ef40cfed7aa84b8",
                "sha256": "91fbf6c60b12a42e7532f7a2ab6ed8713e666293842f478ec5d91c1cd18c01a7"
            },
            "downloads": -1,
            "filename": "fatigueds-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e8cb9628d6821ea4ef40cfed7aa84b8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10541,
            "upload_time": "2025-02-18T12:41:17",
            "upload_time_iso_8601": "2025-02-18T12:41:17.207738Z",
            "url": "https://files.pythonhosted.org/packages/a2/ca/d80eb2f4384f266082e2e435976e2af8c4353415b8dd4ae0e18c1732e0f6/fatigueds-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "96797d004203e27fea00cd0bd710d2d81500f0dab81ec3b1d62fb989ed857c5a",
                "md5": "413f3ecd948a204085b4edfd3c6577e0",
                "sha256": "274a57381af7797d6badbb481a85f4251a8c0aad7cb5e500ab1dd98bc0bb2b7d"
            },
            "downloads": -1,
            "filename": "fatigueds-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "413f3ecd948a204085b4edfd3c6577e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 9553,
            "upload_time": "2025-02-18T12:41:19",
            "upload_time_iso_8601": "2025-02-18T12:41:19.317704Z",
            "url": "https://files.pythonhosted.org/packages/96/79/7d004203e27fea00cd0bd710d2d81500f0dab81ec3b1d62fb989ed857c5a/fatigueds-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-18 12:41:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ladisk",
    "github_project": "FatigueDS",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "tqdm",
            "specs": []
        },
        {
            "name": "pyExSi",
            "specs": []
        },
        {
            "name": "rainflow",
            "specs": []
        }
    ],
    "lcname": "fatigueds"
}
        
Elapsed time: 0.77879s