Python reference: FatigueAnalysis

The class FatigueAnalysis is the Python interface to the OrcaFlex fatigue analysis post-processor. It encapsulates the following functions from the C API:

To perform a fatigue analysis through the Python interface a FatigueAnalysis object must first be created by calling the constructor. An existing OrcaFlex fatigue file can be loaded (either during construction or by calling the FatigueAnalysis.Load() method), and the fatigue data items set before calling FatigueAnalysis.Calculate() to perform the fatigue calculation.

The fatigue data items are set in the same way as data items are set for model objects, this is described under Python interface: Object data. The data item names are obtained from the Fatigue Analysis data form by selecting the data item of interest and pressing F7 or opening the popup menu and clicking data names. Some indexed data items themselves contain indexed data, for example S-N Curve and T-N Curve. In these situations, the parent curve must first be selected (either by name or by index) before its associated data can be set, for example to select an S-N curve named "SNCurve2":

fatigue.SelectedSNCurve = "SNCurve2"

Calls to set S-N curve data items will be applied to "SNCurve2" until the selected curve is changed. More information can also be found in the C API documentation for C_CreateFatigue.

Construction

FatigueAnalysis(filename=None, threadCount=None)

The constructor creates a new OrcaFlex fatigue analysis object by calling the C API function C_CreateFatigue.

If the optional filename parameter is specified then the constructor will open this file after creating the fatigue analysis object.

The optional threadCount parameter specifies the number of processing threads used for calculations, if omitted then the default is the number of processing cores of the computer.

Attributes and methods

latestFileName

The name of file that was most recently loaded or saved.

This property can also be assigned to. This is sometimes necessary when loading memory files in order to provide a root for relative paths.

threadCount

The threadCount property gets and sets the number of processing threads the used for calculation. See C_GetModelThreadCount and C_SetModelThreadCount.

progressHandler

A progress function can be assigned to this property to receive progress callbacks during the fatigue calculation. The progress handler function must match the following function signature:

def FatigueProgress(fatigue, progress)

Where the fatigue parameter is a Python FatigueAnalysis object, the progress parameter is a string indicating the current state of progress. The progress handler function should return False to continue processing or True to cancel the operation.

Calculate

Calculate(resultsFileName=None)

This function performs the fatigue calculation. If the optional resultsFileName parameter is specified then the results will be saved to this file. The file type saved can be either a text file (.txt), an Excel file (.xlsx or .xls) or a comma separated text file (.csv). The decision is taken based on the file extension you specify. This function calls the C API function C_CalculateFatigue.

Load

Load(filename)

This function loads an existing OrcaFlex fatigue file filename.

LoadMem

LoadMem(buffer, dataFileType=DataFileType.Binary)

Load a fatigue analysis from buffer which should be a bytes or bytearray instance. The dataFileType parameter can be either DataFileType.Binary or DataFileType.Text to specify the data format.

Save

Save(filename)

This function saves the fatigue analysis data to an OrcaFlex fatigue file filename. If the results of fatigue analysis are available, they will be saved within the fatigue file.

SaveMem

SaveMem(dataFileType=DataFileType.Binary)

Saves the fatigue analysis returning it as a bytearray object. The dataFileType parameter can be either DataFileType.Binary or DataFileType.Text to specify the data format.

outputPointDetails
theta
loadCaseDamage
overallDamage
bins
loadCaseCycleRate
combinedCycleRate

These properties return the fatigue analysis output as numpy arrays. For more details on the structure and dimensions of these arrays, refer to the C API function C_GetFatigueOutput.