Fatigue Analysis#

The fatigue extra is a feature that allows the user to analyze cycle-count metrics.

Installation#

The extra is compatible with Python versions from 3.8 to 3.10, and installs the py-fatigue and swifter packages.

To install the extra, run the following command in your terminal:

pip install api-24sea[fatigue]
pip install 'api-24sea[fatigue]'

Usage#

Suppose you have already defined a pandas.DataFrame and authenticated with the API. For instructions on how to do this, refer to the getting started tutorial.

Importing the fatigue extra#

# %%
# - Local imports
from api_24sea.datasignals import fatigue

Checking the available metrics after authentication#

If your Metrics Overview table shows metrics whose name starts with CC_, then the fatigue extra will be available for use.

Getting data#

Similar to the data retrieval process described in the getting started tutorial, the data retrieval process for the fatigue extra follows the same steps. The only difference is that the selected metrics must include cycle-counts (CC).

# %%
# **Data Retrieval**
# Besides SCADA data, we will query cycle-count metrics, which are available
# by looking for "CC" (cycle-count) and ["Mtn", "Mtl"] (i.e. Normal and
# Lateral Bending moment).

sites = ["wf"]
locations = ["a01", "a02"]
metrics = ["mean WinDSpEed", "mean pitch", "mean-Yaw", "mean power",
           "cc mtn", "cc mtl"]

start_timestamp = "2020-03-01T00:00:00Z"
end_timestamp = "2020-06-01T00:00:00Z"

df.datasignals.get_data(sites, locations, metrics,
                        start_timestamp, end_timestamp, as_dict=False)

Analyzing cycle-count metrics#

Converting the cycle-count JSON objects to py_fatigue.CycleCount objects is the first step in the fatigue analysis. This is done by calling the api_24sea.datasignals.fatigue.Fatigue.cycle_counts_to_objects() method.

# %%
# **Fatigue Analysis**
# The fatigue analysis is done by calling the cycle_counts_to_objects() method
# from the fatigue accessor.
try:
    df.fatigue.cycle_counts_to_objects()
except ImportError as ie:
    print(f"\033[31;1mImportError\033[22m: {ie}")

At this point, you can treat your py_fatigue.CycleCount objects as you would normally do with py-fatigue.

For more information, check py-fatigue’s beginner’s guide.