iamlikeme / rainflow

Implementation of the rainflow-counting algorythm in Python
MIT License
105 stars 34 forks source link

rainflow rng and mean question #53

Closed pnucoder closed 3 years ago

pnucoder commented 3 years ago

Hi Team,

I need some help to understand the process. I am running time based data through rainflow 3.0.1 and seeing cycles counted for values that do not show up in the time based data.

Example the highest pk to pk reversal cycle is 150.24 with a mean of 35 but the processor extract_cycles appears to also count the very max and min recorded in the time domain as a rng output at 174.85 with a mean of 23.

Let me know if you can help.

Thank you, B

iamlikeme commented 3 years ago

Hi! It is rather hard to explain without seeing the data. Can you try to produce a minimal test case which demonstrates the problem? Also, may I ask what you are comparing the result with?

One thought from the top of my head - the cycle from the global minimum to the global maximum is probably a half-cycle. Does the other tool you are using also returning half-cycles or only full-cycles?

pnucoder commented 3 years ago

Hi @iamlikeme, thank you for trying to help me out. I attached the focused section time based file, png, and the dataframe output using your extract_cycles code.

I am aligned with your first thought as it looks like processor is picking up the global maximum and minimum from the dataset. The occurrence of the global max and min is approx. 7 seconds. Approx. cycle at 50.7 sec and cycle at 57.2 sec. The index values i-start 1789 and i-end 18027 have a larger gap than the other reversals in the output file.

Link to NI Labview ASTM algorithm page. This is the processor I have been using but is very cumbersome but appears to align with the time based data reversals. The NI tool counts whole and half cycles.

[https://forums.ni.com/t5/Signal-Processing-and-Analysis/Rainflow-Counting-Algorithm/td-p/3503218?profile.language=en]

Still learning the application using your processor and looking forward to the discussion. Let me know if you need anything.

Thank you!! @pnucoder

raw data extract cycles output.xlsx raw data.xlsx raw data

iamlikeme commented 3 years ago

I confirm that the maximum difference between two consecutive reversals in the data is 150.24. Your question, if I understand correctly, is why rainflow counting produces cycles with a range greater than 150.24.

This is because rainflow counting does not look only at consecutive reversals. The picture below shows conceptually how that greatest peak gets produced (if you turn the image 90 degrees clockwise and imagine rain pouring on it the red line would show how water flows from the global minimum to the global maximum - that's why the algorithm is called rainflow counting).

Selection_001

The second question is why you do not get the same result from a different program which claims to implement the ASTM rainflow counting method. Can you run the following test case from ASTM and see what result you get?

time series: [-2, 1, -3, 5, -1, 3, -4, 4, -2] expected cycles (range and count): (3, 0.5), (4, 1.5), (6, 0.5), (8, 1.0), (9, 0.5),

pnucoder commented 3 years ago

Thank you for the explanation. The labview ASTM processor has not been counting the greatest peak. I attached the output matrix from the labview processor.

I will check your time series shortly. Thank you!!

rainflow output - labview.xlsx

pnucoder commented 3 years ago

Hi @iamlikeme

Here is the code and output using rainflow 3.0.1. Using Jupyter as my python vehicle.

image

iamlikeme commented 3 years ago

What I meant to ask was what is the result that you get from LabVIEW for the short time series.

pnucoder commented 3 years ago

@iamlikeme apologies for not understanding your question.

Here is the labview processor output of your time series. Similar, but slightly different due to how the bins are distributed.

I separated the rng bins to max 10 with 10 bins, and mean -5 to 5 with 10 bins

Here are the input time series and labview rainflow output.

git hub time series input plot

time series labview output plot

iamlikeme commented 3 years ago

The total number of cycles from LabVIEW is 3.5 rather than 4.0 which is expected for this time series. The time series and the expected results are provided in ASTM E1049-85 along with the algorithm itself, so it look like the implementation in LabVIEW is not correct.

pnucoder commented 3 years ago

Thank you for the support and feedback. I reviewed ASTM E1049-85 fig 6 method and agree the labview processor is missing a half cycle. I need to provide the feedback to the developer of the processor. For my work moving forward I plan to utilize your rainflow code. Thank you again!!