voltage ref the output of the operational amplifier 20 is connected to the gate g of the power switch m 1 a comparator 30 is implemented one input terminal of the comparator 30 is connected to the gate g of the power switch m 1 another input terminal of the comparator 30 is connected to a threshold voltage v 1 the output of the comparator is connected to a discharge switch s 1 a dynamic reference generating circuit is implemented the discharge switch s 1 is in series with a discharge circuit r 2 an integrating capacitor c 2 is connected to the discharge switch s 1 and the discharge circuit r 2 a charge circuit 40 is connected to the integrating capacitor c 2 the charge circuit 40 is usually a current source or a resistor the voltage on the integrating capacitor c 2 is scaled by the proportional convertor 50 the output of the proportional convertor 50 is the dynamic reference voltage ref and is fed into the positive input of the operational amplifier 20 fig3 is a waveform diagram that illustrates the operation of the current ripple canceling led driver the input current source contains a current ripple for example the first stage apfc led driver delivers a current source containing a current ripple with twice of the ac line frequency the filtering capacitor c 1 stores the ripple current of the input current source and a ripple voltage is established on the filtering capacitor c 1 the current in the led load flows into the drain d of the power switch m 1 and flows out from the source s of the power switch m 1 the current.