|The aim of this paper is the design and implementation of the control algorithm of a PWM boost rectifier capable to handle bidirectional energy flow. For this goal, the boost rectifier control loops must be tuned for the proper operation of absorbing active power from the power grid and transfer it to the dc load at constant output voltage, and also to give the rectifier the ability to generate back to the power grid the energy intake from the dc-link, using the dc-link capacitor as intermediary energy tank. It will be proved that the transition between rectifier operation and inverter operation is done automatically, without the intervention of the human operator or of a specially designed system. The correct implementation and tuning of the control algorithm was validated on a complete Matlab Simulink model which includes in detail all the sections of the rectifier system. The simulation and experimental results proved the correct answer of the tuned dc-link voltage controller and the overall operation of the system for a step changing active load. Because the boost rectifier control algorithm is similar to shunt active filters control algorithm, the indirect current control approach was adopted, which is the most suitable for this purpose.