In order to solve the problem of voltage drop by use of serial compensation, real-time compensation signal generation algorithm is designed in order to provide reference input signal to DVR control system. The algorithm uses iterative filtering to generate the reference waveform of the sinusoidal and orthogonal in real time and provides a basis for pqr transformation. In the pqr coordinate system, p -axis component of the ideal voltage signal during the voltage drop is DC, p -axis, r -axis component is zero, which provides a simple representation to the calculation of the compensation component. Calculate the compensation component in the pqr coordinate system and get the compensation component of the abc coordinate system by using the pqr inverse transform in real-time. The simulation results demonstrate the effectiveness of the algorithm.