The growing popularity and deployment of plug-in electric vehicles (PEVs), create new challenges in power grid operation and stability. To address the operational challenges of the power grid with high penetration of PEVs such as grid’s congestion, increasing power loss, and deteriorating frequency and voltage profiles, the active and reactive power of PEVs should be managed. In fact, the PEVs’ energy storage system can be utilize for reactive power compensation (voltage regulation) and active power compensation (frequency regulation) by controlling bidirectional power electronics interfaces, which are integrating PEVs into the grid. In this dissertation, we have focused on active and reactive power compensation using PEVs, firstly reactive power compensation, to generate reactive power locally, secondly considering active and reactive generation with a double loop controller, and finally validating our proposed control strategy using an industrial control card through a hardware-in-the-loop (HIL) experimental testbed. Local reactive power compensation using PEVs is specifically more beneficial for long distances, where reactive power losses, which are proportional to line susceptance, is much greater than the active power losses. In this work, a PEV-based reactive power compensation and a novel phase-detector-based feedback control strategy is proposed. The effects of reactive power compensation on the battery’s State- Of-Charge (SOC) are investigated. The advantages of using multilevel inverter (MLI) compared to conventional inverter is the ability to reduce the higher order harmonics of voltages, which results in better power quality, higher efficiency, and improved stability of the grid. In this work, a capacitor clamped three-level inverter, interfacing plug-in electric vehicle (PEV) battery into the grid, is utilized to compensate for active and reactive power of the load. To achieve this goal, a double-loop control strategy is proposed. Finally, an experimental testbed including Hardware-In-the-Loop (HIL) Typhoon- HIL 602, and TI TMS320F28335 control card is utilized to validate the proposed control strategy and its feasibility for practical applications. Index Terms— Plug-in electric vehicle (PEV), active and reactive power compensation, voltage regulation, frequency regulation, State- Of-Charge (SOC), multilevel inverter (MLI), hardware-in-the-loop (HIL), vehicle-to-grid (V2G), grid-to-vehicle (G2V), power management.