fixed wave algorythm