Rainflow modelling algorithm



  • Avatar

    Hi Rachel,

    I haven't seen this type of model but I have seen models that do things like count the number of storm events (and other statistics) recorded in a rainfall time history, like the one described in this blog post. Are you trying to count the number of rain events?


  • Avatar
    Rachel Lee

    Hi Jason,

    Thanks for coming back to me; I don't think that's the same thing though. (I thought after posting that mentioning rainflow might cause confusion!).  It's essentially a way of counting cycles/magnitudes of cycles.  The idea is that you end up with an array with the number of, say, 1% magnitude cycles, 2% magnitude cycles etc all the way up to 100%.  The problem comes in the way that the algorithm deals with matching pairs of rising/falling values. If you have access to ASTM standards then this is a good paper to look at:  

    "Standard Practices for Cycle Counting in Fatigue Analysis" at section 5.4.4

    The essence of the algorithm is:

    5.4.4 Rainflow Counting: Rules for this method are as follows: let X denote
    range under consideration; Y, previous range adjacent to X; and S, starting point in the history.

    (1) Read next peak or valley. If out of data, go to Step 6.

    (2) If there are less than three points, go to Step 1. Form
    ranges X and Y using the three most recent peaks and valleys that have not been discarded.

    (3) Compare the absolute values of ranges X and Y.

    (a)If X<Y, go to Step 1.

    (b)If X ≥ Y, go to Step 4.

    (4) If range Y contains the starting point S, go to Step 5;
    otherwise, count range Y as one cycle; discard the peak and valley of Y; and go to Step 2.

    (5) Count range Y as one-half cycle; discard the first point
    (peak or valley) in range Y; move the starting point to the second point in range Y; and go to Step 2.

    (6) Count each range that has not been previously counted
    as one-half cycle.


    It's quite hard to get your head round; I suspect the easiest way to do it is to run it on a reduced set of data after the main simulation has run, perhaps using a script function.


  • Avatar


    Thank you for adding more detail. I wonder if a submodel might be a better option than the script because it might be a little easier to visualize. You can pass the time series definition into the submodel through the interface then trigger to run the submodel each time the main model reads a peak or valley. When the submodel is triggered, you count the cycles and send output back through the submodel interface to the main model and advance the main model until the submodel is triggered again. 

    I'm still trying to visualize the exact logic as you described above but don't have a full grasp. Does the idea of a submodel help? 


  • Avatar


    I finally took the time to look deeper into this rainfall-counting algorithm and will spend some time with it to see if there might be a good GoldSim solution for it. Sorry for the long delay!

Please sign in to leave a comment.