top of page

MATLAB Simulation of V2G and G2V operation with Three Phase Grid

5 minutes ago
6 min read

MATLAB Simulation of V2G and G2V operation with Three Phase Grid


𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧

The growing adoption of Electric Vehicles (EVs) has increased the demand for intelligent charging systems and bidirectional power transfer technologies. 𝐕𝐞𝐡𝐢𝐜𝐥𝐞-𝐭𝐨-𝐆𝐫𝐢𝐝 (𝐕𝟐𝐆) and 𝐆𝐫𝐢𝐝-𝐭𝐨-𝐕𝐞𝐡𝐢𝐜𝐥𝐞 (𝐆𝟐𝐕) are important technologies that enable electrical energy to flow between EV batteries and the utility grid.


V2G and G2V operation with Three Phase Grid


MATLAB Simulation of V2G and G2V operation with Three Phase Grid
₹10,000.00₹5,000.00
Buy Now


This MATLAB/Simulink model demonstrates the operation of a 𝐭𝐡𝐫𝐞𝐞-𝐩𝐡𝐚𝐬𝐞 𝐠𝐫𝐢𝐝-𝐜𝐨𝐧𝐧𝐞𝐜𝐭𝐞𝐝 𝐄𝐕 𝐛𝐚𝐭𝐭𝐞𝐫𝐲 𝐬𝐲𝐬𝐭𝐞𝐦 using a bidirectional DC–DC converter and a three-phase voltage source converter.

The system supports two operating modes:

  • 🔋 𝐕𝟐𝐆 𝐌𝐨𝐝𝐞: Transfers stored energy from the EV battery to the three-phase grid.

  • ⚡ 𝐆𝟐𝐕 𝐌𝐨𝐝𝐞: Draws electrical energy from the grid to charge the EV battery.

The simulation includes battery current regulation, DC-link voltage control, PLL synchronization, and decoupled current control for efficient bidirectional power exchange.

𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰

The proposed system integrates an EV battery with a three-phase utility grid through power electronic converters and control systems.

EV Battery

Bidirectional DC–DC

DC Link

Three-Phase Converter

LCL Filter

Three-Phase Grid

𝐌𝐚𝐢𝐧 𝐒𝐲𝐬𝐭𝐞𝐦 𝐂𝐨𝐦𝐩𝐨𝐧𝐞𝐧𝐭𝐬

Component

Function

Three-Phase Grid

Supplies and receives electrical power

EV Battery

Stores electrical energy

Bidirectional DC–DC Converter

Controls battery charging and discharging

Three-Phase VSC

Enables bidirectional AC–DC power conversion

LCL Filter

Reduces switching harmonics

DC-Link Capacitor

Supports DC-link voltage regulation

PLL

Synchronizes the converter with the grid

PI Controllers

Regulate battery current, DC-link voltage, and grid currents

PWM Generator

Generates converter switching pulses

𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐏𝐚𝐫𝐚𝐦𝐞𝐭𝐞𝐫𝐬

Parameter

Value

Simulation Software

MATLAB/Simulink

Grid System

Three-phase AC

Grid Voltage

450 V (as stated in narration)

Grid Frequency

50 Hz

DC-Link Reference Voltage

1000 V

V2G Battery Current Reference

+30 A

G2V Battery Current Reference

−30 A

Simulation Duration

2 seconds

Mode Transition Time

1 second

Converter Switching Devices

IGBT with antiparallel diodes

Grid Interface Filter

LCL Filter

Control Technique

PI with feedforward decoupling

𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬

1. 𝐕𝐞𝐡𝐢𝐜𝐥𝐞-𝐭𝐨-𝐆𝐫𝐢𝐝 (𝐕𝟐𝐆) 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧

During V2G operation, the EV battery supplies stored electrical energy to the utility grid.

  • The battery current reference is maintained at 𝐢+𝟑𝟎 𝐀.

  • The bidirectional DC–DC converter operates to transfer energy from the battery toward the DC link.

  • The three-phase VSC converts DC power into AC power.

  • The LCL filter reduces unwanted switching harmonics.

  • The converted power is delivered to the three-phase grid.

  • Battery State of Charge (SOC) gradually decreases.

This operating mode demonstrates how EV batteries can support grid power requirements.

2. 𝐆𝐫𝐢𝐝-𝐭𝐨-𝐕𝐞𝐡𝐢𝐜𝐥𝐞 (𝐆𝟐𝐕) 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧

During G2V operation, electrical energy is transferred from the three-phase grid to the EV battery.

  • The battery current reference is changed to 𝐢−𝟑𝟎 𝐀.

  • Power is drawn from the three-phase grid.

  • The VSC operates in rectifier mode.

  • The bidirectional DC–DC converter regulates battery charging current.

  • The battery begins charging.

  • Battery SOC gradually increases.

The transition between the two modes is achieved by changing the battery current reference.

𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲

The simulation incorporates coordinated control of the battery-side converter and grid-side converter.

1. 𝐁𝐢𝐝𝐢𝐫𝐞𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐃𝐂–𝐃𝐂 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫 𝐂𝐨𝐧𝐭𝐫𝐨𝐥

The battery-side converter uses a PI-based current controller.

Control sequence:

  1. Measure the actual EV battery current.

  2. Compare actual current with the reference current.

  3. Process the current error through a PI controller.

  4. Generate the required duty cycle.

  5. Apply the duty cycle to a PWM generator.

  6. Supply switching pulses to the converter IGBTs.

  7. Regulate battery charging or discharging according to the current reference.

The lower IGBT receives the direct PWM signal, while the upper IGBT receives the complementary switching signal in the presented control arrangement.

2. 𝐃𝐂-𝐋𝐢𝐧𝐤 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥

The grid-side converter employs an outer voltage control loop.

  • Reference DC-link voltage: 𝐢𝟏𝟎𝟎𝟎 𝐕.

  • Measure the actual DC-link voltage.

  • Compare measured and reference values.

  • Apply a PI voltage controller.

  • Generate the direct-axis reference current.

  • Supply the reference to the inner current control loop.

This control maintains the DC-link voltage near its reference during power exchange.

3. 𝐏𝐋𝐋 𝐚𝐧𝐝 𝐆𝐫𝐢𝐝 𝐒𝐲𝐧𝐜𝐡𝐫𝐨𝐧𝐢𝐳𝐚𝐭𝐢𝐨𝐧

The Phase-Locked Loop (PLL) synchronizes the three-phase converter with the utility grid.

  • Measure three-phase grid voltages.

  • Extract the grid synchronization angle using the PLL.

  • Convert measured three-phase voltages into the dq reference frame.

  • Transform measured inverter currents into direct-axis and quadrature-axis components.

  • Use the synchronized quantities for converter current regulation.

4. 𝐅𝐞𝐞𝐝𝐟𝐨𝐫𝐰𝐚𝐫𝐝 𝐃𝐞𝐜𝐨𝐮𝐩𝐥𝐢𝐧𝐠 𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐂𝐨𝐧𝐭𝐫𝐨𝐥

The grid-side converter uses a dq-axis current control technique.

  • The outer voltage controller generates the direct-axis current reference.

  • The quadrature-axis current reference is maintained at zero.

  • Measured direct-axis and quadrature-axis currents are compared with their references.

  • Separate PI controllers regulate the current errors.

  • Feedforward decoupling terms compensate for cross-coupling between the dq axes.

  • Grid voltage components are incorporated into the control.

  • The reference voltages are converted back into three-phase quantities.

  • A PWM generator produces switching pulses for the three-phase VSC.

This arrangement enables controlled active and reactive power exchange between the EV battery and the grid.

𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬

The MATLAB/Simulink model is simulated for 𝐢𝟐 𝐬𝐞𝐜𝐨𝐧𝐝𝐬 to evaluate both V2G and G2V operations.

𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐧𝐠 𝐌𝐨𝐝𝐞 𝐂𝐨𝐦𝐩𝐚𝐫𝐢𝐬𝐨𝐧

Parameter

V2G Mode

G2V Mode

Simulation Time

0–1 s

1–2 s

Battery Current Reference

+30 A

−30 A

Battery Operation

Discharging

Charging

Power Direction

EV → Grid

Grid → EV

Battery SOC

Decreases

Increases

Grid Power Exchange

Receives power

Supplies power

Voltage–Current Relationship

Approximately in phase

Approximately 180° out of phase

Active Power Direction

Positive

Negative

Battery current reference during simulation

The reference changes at 1 second to switch between V2G and G2V modes.

Illustrative current-reference profile based on the described switching sequence; not exported measured simulation data.

1. 𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐕𝐨𝐥𝐭𝐚𝐠𝐞, 𝐂𝐮𝐫𝐫𝐞𝐧𝐭, 𝐚𝐧𝐝 𝐒𝐎𝐂

The battery scope displays three important parameters.

  • Battery voltage remains regulated during operation.

  • Battery current follows the selected reference value.

  • Battery SOC decreases during discharging and increases during charging.

  • A current transition occurs at 1 second when the operating mode changes.

2. 𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫 𝐀𝐜𝐭𝐢𝐯𝐞 𝐚𝐧𝐝 𝐑𝐞𝐚𝐜𝐭𝐢𝐯𝐞 𝐏𝐨𝐰𝐞𝐫

The inverter power scope illustrates the change in power direction.

  • During V2G operation, the inverter transfers active power toward the grid.

  • At 1 second, the power direction changes.

  • During G2V operation, power flows from the grid toward the EV battery.

  • Reactive power is monitored during both operating modes.

3. 𝐆𝐫𝐢𝐝 𝐀𝐜𝐭𝐢𝐯𝐞 𝐚𝐧𝐝 𝐑𝐞𝐚𝐜𝐭𝐢𝐯𝐞 𝐏𝐨𝐰𝐞𝐫

The grid-side power scope demonstrates bidirectional energy transfer.

  • Active power is positive during the demonstrated V2G operation.

  • Active power becomes negative during G2V operation.

  • The grid power waveform shows a transient response during mode switching.

  • Reactive power is also measured to evaluate grid-side performance.

4. 𝐓𝐡𝐫𝐞𝐞-𝐏𝐡𝐚𝐬𝐞 𝐆𝐫𝐢𝐝 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐚𝐧𝐝 𝐂𝐮𝐫𝐫𝐞𝐧𝐭

The AC voltage and current scope displays the three-phase electrical quantities.

  • Three-phase grid voltages are monitored.

  • Grid currents change according to power transfer direction.

  • The current waveform responds to the transition between V2G and G2V.

  • The PLL supports synchronized converter operation.

5. 𝐏𝐡𝐚𝐬𝐞 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐚𝐧𝐝 𝐂𝐮𝐫𝐫𝐞𝐧𝐭

The phase voltage and current waveforms provide a clear indication of the power flow direction.

During V2G: Grid voltage and current are approximately in phase under the demonstrated measurement convention.

During G2V: Grid voltage and current are approximately 180° out of phase, indicating reverse active power flow.

The waveform transition confirms the change in operating mode at 1 second.

𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬

  • ✅ Bidirectional power transfer between EV battery and three-phase grid.

  • ✅ Integrated three-phase voltage source converter.

  • ✅ Bidirectional DC–DC converter for battery charging and discharging.

  • ✅ PI-based battery current controller.

  • ✅ DC-link voltage regulation using an outer PI controller.

  • ✅ PLL-based synchronization with the utility grid.

  • ✅ dq-axis current control with feedforward decoupling.

  • ✅ LCL filter for reducing switching harmonics.

  • ✅ Automatic transition between V2G and G2V through current-reference switching.

  • ✅ Monitoring of battery SOC, inverter power, grid power, voltages, and currents.

𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬

⚡ Smart Grid Integration

Enables bidirectional energy exchange between electric vehicles and modern utility grids.

🔋 EV Charging Infrastructure

Supports the development and analysis of bidirectional EV charging systems.

🚗 Vehicle-to-Grid Technology

Demonstrates how stored EV battery energy can be transferred back to the grid when required.

🏠 Vehicle-to-Home and Energy Management Research

Provides a useful foundation for studying EV-based power support and energy management strategies.

🌱 Renewable Energy Integration

Can be extended to investigate coordinated operation with solar PV, wind energy, and battery storage systems.

🎓 Academic and Research Applications

Suitable for studying power electronics, electric vehicle charging, grid-connected converters, and advanced control strategies using MATLAB/Simulink.

𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧

The 𝐌𝐀𝐓𝐋𝐀𝐁 𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐨𝐟 𝐕𝟐𝐆 𝐚𝐧𝐝 𝐆𝟐𝐕 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧 𝐰𝐢𝐭𝐡 𝐓𝐡𝐫𝐞𝐞 𝐏𝐡𝐚𝐬𝐞 𝐆𝐫𝐢𝐝 demonstrates bidirectional power flow between an electric vehicle battery and the utility grid.

The simulation successfully illustrates:

  • Controlled battery discharging during V2G mode.

  • Regulated battery charging during G2V mode.

  • Battery current reversal from +30 A to −30 A.

  • DC-link voltage regulation.

  • Grid synchronization and dq-axis current control.

  • Reversal of active power flow between the EV battery and three-phase grid.

The results demonstrate the effectiveness of coordinated PI controllers, feedforward decoupling, and bidirectional power electronic converters for studying EV–grid energy exchange.

This simulation provides a practical learning platform for 𝐬𝐭𝐮𝐝𝐞𝐧𝐭𝐬, 𝐫𝐞𝐬𝐞𝐚𝐫𝐜𝐡𝐞𝐫𝐬, 𝐚𝐧𝐝 𝐩𝐨𝐰𝐞𝐫 𝐞𝐥𝐞𝐜𝐭𝐫𝐨𝐧𝐢𝐜𝐬 𝐞𝐧𝐠𝐢𝐧𝐞𝐞𝐫𝐬 interested in modern EV charging and smart grid technologies.

Relevant Keywords: MATLAB V2G Simulation, G2V MATLAB Simulink, Three Phase Grid Connected EV, Bidirectional DC DC Converter, Electric Vehicle Charging Simulation, Vehicle to Grid Control, Grid to Vehicle Charging, MATLAB Simulink EV Battery, Three Phase VSC Control, PLL Grid Synchronization, dq Current Control, Feedforward Decoupling Control.


Comments


bottom of page