The continuous growth of Renewable Energy (RE) in the grid reduces system inertia and damping, impacting the overall stability of power systems. To alleviate this issue, "virtual" inertia can be provided by power electronics converters. Under this functionality they are controlled to emulate the behavior of rotating machines, operating as Virtual Synchronous Generators (VSGs). However, gridconnected inverters are susceptible to voltage and frequency disturbances which negatively affect their performance. Therefore, this paper introduces a Unified Power Flow Controller (UPFC) with VSG functionality that can compensate for voltage variations at the point of common coupling and provide a constant voltage reference for the connection of remote RE systems. The detailed controlled strategy together with the small-signal analysis are also developed in this work. The UPFC-VSG is compared with an equivalent Static Synchronous Compensator (STATCOM) with centralized energy storage also under VSG control to illustrate the major benefits of the UPFC-VSG. Validation of the analysis and the proposed control method is provided through simulation of a UPFC-VSG and a STATCOM-VSG supporting the grid-connection of a 100-MVA RE system. INDEX TERMS Unified Power Flow Controller (UPFC), Virtual Synchronous Generator (VSG), inertia emulation, renewable energy, power reference variations, grid disturbances, Static Synchronous Compensator (STATCOM) NOMENCLATURE D p Damping coefficient E m Voltage amplitude reference generated by VSG E m0 Static reference of E m E ref_se Voltage reference of series converter E ref_sh Voltage reference of shunt converter E ref_st Voltage reference of STATCOM f g Grid frequency f UPFC Frequency in UPFC-VSG f STATCOM Frequency in STATCOM-VSG I RES_ST Current amplitude of RES in STATCOM-VSG I RES_UPFC Current amplitude of RES in UPFC-VSG J p Virtual inertia coefficient k V Voltage regulation coefficient k vp , k vi PI in excitation voltage generator