2. Rainflow and residuals¶
Rainflow counting converts an ordered stress record into a spectrum that can be used in a fatigue analysis. The residual turning points keep track of excursions that may continue in the next window.
Rainflow¶
Rainflow counting extracts stress ranges, means and cycle counts from a
stress history. The v3 ASTM three-point implementation runs in Rust.
CycleCount.from_timeseries also accepts rainflow_method="fourpoint".
Residual half-cycles carry unresolved excursions at the ends of the record.
Keep those residuals when combining windows. For measured input,
CycleCount.from_sep005 converts supported stress units to MPa. For a
pyExSi signal, supply the sampling frequency and stress unit explicitly.
See cycle counting and signal input.
Initially, rainflow turns the load history into a sequence of time (t) ordered reversals. Reversals are the local minima and maxima where the load first derivative changes sign. The function counts cycles by considering a moving reference point of the sequence, Z, and a moving ordered three-point subset - t(subset) ≥ t(Z) - with these characteristics:
-
The first and second points are collectively called Y.
-
The second and third points are collectively called X.
-
| In both X and Y, the points are sorted from earlier to later in | time, but are not necessarily consecutive in the reversal sequence.
The range of X, denoted by r(X), is the absolute value of the difference between the amplitude of the first point and the amplitude of the second point. The definition of r(Y) is analogous. The rainflow algorithm is as follows (the rainflow chart).
---
config:
fontFamily: IBM Plex Sans
themeVariables:
fontSize: 0.75rem
flowchart:
useMaxWidth: false
wrappingWidth: 175
nodeSpacing: 25
rankSpacing: 38
---
flowchart TD
accTitle: ASTM three-point rainflow counting
accDescr: Add reversals to a pending stack, compare the two latest ranges and count closed or residual cycles.
A["Extract reversals from the stress history"] --> B{"More reversals?"}
B -->|Yes| C["Add the next reversal"]
C --> D{"At least three pending reversals?"}
D -->|No| B
D -->|Yes| E{"Is the latest range X at least as large as Y?"}
E -->|No| B
E -->|Yes| F{"Does Y start at the oldest pending reversal?"}
F -->|Yes| H["Count Y as a half-cycle and remove its first reversal"]
F -->|No| I["Count Y as a full cycle and remove both its reversals"]
H --> D
I --> D
B -->|No| J["Count each remaining range as a half-cycle"]
class A flowInput
class B,D,E,F flowDecision
class H,I,J flowResult
classDef flowInput fill:#dcecf8,stroke:#567fa0,color:#18376a
classDef flowDecision fill:#f5e7ce,stroke:#98723a,color:#452f17
classDef flowResult fill:#d9eade,stroke:#548167,color:#1b4735
At the end, the function collects the different cycles and half-cycles and tabulates their ranges, their means, and the points at which they start and end. This information can then be used to produce a histogram of cycles.
Example
The following example shows how to use the rainflow algorithm to cycle-count the signal given in the image here below.

| Z | Reversals | Out of data? | < 3 reversals? | Y | X | r(X) < r(Y)? | Y includes Z? | Actions |
|---|---|---|---|---|---|---|---|---|
| O | O, A, B | No | No | OA | AB | No | Yes | Show
|
| A | A, B | No | Yes | — | — | — | — | ShowRead C. |
| A | A, B, C | No | No | AB | BC | Yes | — | ShowRead D |
| A | A, B, C, D | No | No | BC | CD | Yes | — | ShowRead E. |
| A | A, B, C, D, E | No | No | CD | DE | No | No | Show
|
| A | A, B, E, | No | No | AB | BE | Yes | — | ShowRead F. |
| A | A, B, E, F | No | No | BE | EF | Yes | — | ShowRead G. |
| A | A, B, E, F, G | No | No | EF | FG | No | No | Show
|
| A | A, B, G | No | No | AB | BG | No | Yes | Show
|
| B | B, G | Yes | — | — | — | — | — | ShowCount BG as ½. |
LFFD¶
In continuously monitored structures, keeping a count per recording window makes long histories easier to store and process. An excursion that crosses a window boundary may appear as multiple half-cycles when the windows are counted independently. The remaining turning points preserve the order needed to recover such excursions.
The method described by Marsh and coauthors uses the saved spectra and ordered residuals. For example, count each window of a bending-moment record and store its full-cycle histogram together with the residual turning points. If the table also includes half-cycles, set those rows aside during recovery. Concatenate the residual sequences in acquisition order, count them again, then merge the recounted rows with the saved full cycles. Keep any residuals left from this second pass for future aggregation.
This lets you combine long runs or choose different analysis windows using small retained histories. It still depends on continuous data. If acquisition stopped between windows, the residuals cannot recover the loading that went unmeasured.
---
config:
fontFamily: IBM Plex Sans
themeVariables:
fontSize: 0.75rem
flowchart:
useMaxWidth: false
wrappingWidth: 175
nodeSpacing: 25
rankSpacing: 38
---
flowchart TD
accTitle: Recover low-frequency cycles from segmented load data
accDescr: Store each window's histogram and residual reversals, then count the combined residuals and merge with the full cycles.
S["Read the next signal segment"] --> C{"Cycle count already stored?"}
C -->|No| P["Process the signal and count cycles"]
P --> H["Store the histogram and ordered residual reversals"]
C -->|Yes| W{"More segments in the time window?"}
H --> W
W -->|Yes| S
W -->|No| F["Remove half-cycles and merge the full-cycle histograms"]
W -->|No| R["Concatenate residual reversals in time order"]
R --> N["Count cycles in the combined residual sequence"]
F --> M["Merge the full cycles and recounted residual cycles"]
N --> M
M --> T["Store the combined histogram and remaining residuals"]
class S flowInput
class C,W flowDecision
class H,M,T flowResult
classDef flowInput fill:#dcecf8,stroke:#567fa0,color:#18376a
classDef flowDecision fill:#f5e7ce,stroke:#98723a,color:#452f17
classDef flowResult fill:#d9eade,stroke:#548167,color:#1b4735
For a worked example, see the MCP LFFD walkthrough or the cycle-count aggregation notebook.
Fatigue loading in wind turbines¶
NASA's experimental multi-megawatt wind turbines of the 1970s and 1980s included steel tube towers. Experience with early designs helped establish fatigue as a design requirement because the loads on a turbine vary over its lifetime.
For offshore support structures, repeated loads and the corrosive environment also affect inspection and maintenance. Structural health monitoring captures histories that can inform fatigue-life estimates and the timing of inspections. The figure below shows changes in the energy mix during the expansion of wind power in the EU-27.
Stress–strain hysteresis loops show how a material responds to nested loading excursions. Cycle counting uses the ordered peaks and valleys to represent those excursions by their ranges and weights. By convention, tensile stress is positive and compressive stress is negative.

Changes in wind and rotor thrust can create slow excursions. Waves can add faster cycles. The two effects can occur within the same record.
