Application of the stem-cycle approach to calculate different phases, their duration and to plot them.
Useful links