top of page

Bidirectional Power Flow Control in EV Systems: V2G & G2V Using MATLAB Simulink

Electric Vehicles (EVs) are no longer just transportation devices; they are now integral components of smart grids. With Vehicle-to-Grid (V2G) and Grid-to-Vehicle (G2V) technologies, EVs can function as both energy consumers and energy providers. This blog walks you through the MATLAB Simulink implementation of a three-phase grid-connected EV system using a bidirectional DC-DC converter, allowing for seamless V2G and G2V operations.

System Architecture Overview

The simulation model includes:

  • A three-phase AC grid supplying 450V at 50 Hz.

  • An LCL filter to reduce harmonics and smoothen the current waveform.

  • A universal bridge inverter (three-phase) configured with IGBT-diodes, capable of bidirectional operation.

  • An EV battery connected through a bidirectional (buck-boost) DC-DC converter.

This setup facilitates power flow in both directions: from the grid to the battery (charging) and from the battery back to the grid (discharging).

Why Use a Bidirectional DC-DC Converter?

To achieve dual-mode operation (V2G and G2V), a bidirectional converter is essential. It regulates the flow of energy:

  • G2V Mode: Grid supplies energy to charge the EV battery.

  • V2G Mode: Battery discharges stored energy back into the grid.

The converter manages voltage levels and power direction efficiently between the battery and inverter.

Battery Current Control Strategy

The bidirectional converter's switching is controlled by battery current feedback:

  • A reference current value determines the operational mode.

    • Positive value (e.g., +30 A) activates V2G mode.

    • Negative value (e.g., -30 A) triggers G2V mode.

  • The actual battery current is compared with the reference current.

  • A PI controller processes the error and outputs the required duty cycle.

  • The PWM (Pulse Width Modulation) signal generated controls the lower and upper IGBT switches of the converter.

Inverter Control: Voltage and Current Loops

The three-phase universal bridge (inverter) is managed by a dual-loop control system:

  1. Outer Voltage Control Loop:

    • Monitors and controls the DC link voltage (setpoint = 100 V).

    • Uses a PI controller to generate a reference for the current loop (Id_ref).

  2. Inner Current Control Loop:

    • Implements feedforward decoupling control in the d-q rotating reference frame.

    • Measures actual inverter currents (Id, Iq) and grid voltage (Vd, Vq) after Clarke and Park transformations.

    • The control output is transformed back to ABC signals using an inverse Park transformation and sent to a sinusoidal PWM generator.

This precise control ensures stable operation and dynamic response during power direction changes.

Phase-Locked Loop (PLL) Synchronization

A Phase-Locked Loop (PLL) is used to synchronize the inverter’s output with the grid voltage. It detects the grid voltage phase angle (ωt) and ensures all control calculations remain phase-aligned, which is critical for proper d-q transformation and decoupling.

Simulation and Results

The system simulation showcases the performance in both V2G and G2V modes:

  • 0–1 second: V2G Mode

    • Current reference is +30 A.

    • Battery discharges power to the grid.

    • Grid voltage and current are in phase.

    • Real power from the inverter and at the point of common coupling (PCC) is positive.

  • 1–2 seconds: G2V Mode

    • Current reference is changed to –30 A.

    • Grid supplies power to the battery.

    • Voltage and current are 180° out of phase.

    • Real power becomes negative, indicating power is flowing from grid to EV.

This proves the correct functionality of both operating modes and the successful handling of power flow transitions.

Scopes and Visualization

The simulation includes several measurement scopes to visualize:

  • Battery voltage and current

  • Inverter active/reactive power

  • Grid point (PCC) voltage, current, and power

  • Phase-wise voltage and current

  • Transition dynamics during switching between V2G and G2V modes

These scopes confirm the system’s real-time behavior, phase alignment, and the accuracy of the current reference-based control.

Conclusion

This simulation demonstrates an efficient and responsive control framework for bidirectional energy flow between EVs and the grid using MATLAB Simulink. With current reference control, PI regulation, and feedforward decoupled inverter control, the model successfully replicates both V2G and G2V functionalities.

This modeling approach can be extended to support:

  • Smart grid integration,

  • Demand response,

  • Peak load shaving,

  • Renewable energy storage applications.

Comments


bottom of page