Measurement of the ripple of magnet power supply and its effect to the beam energy