a unified control solution for both bridgeless power factor controllers and grid connected inverters is disclosed . conventionally , the bridgeless power factor controllers and the grid connected inverters are controlled with different approaches . in the present invention , it is disclosed that the two kinds of applications can be controlled with one unified approach . with the disclosed method , one single integrated circuit can be made and be used in both applications . firstly , a sample based controller is disclosed to derive the ac current reference from the ac voltage and the dc voltage . the ac current reference is forced to be proportional to the ac voltage . the proportion coefficient is derived from the dc voltage in such a way to keep the dc voltage constant . furthermore , the coefficient is updated only once every half ac line cycle . so as long as the ac current follows the current reference , the dc voltage will be regulated to a constant , and the ac current will be pure sinusoidal . secondly , a new current mode switching pattern is disclosed based on an improved hysteretic switching pattern . the disclosed switching pattern minimizes the number of switching event and removes the deadtime requirement without the risk of shoot through .