Solar PV Based Electric Vehicle Charging Station with V2G and G2V Operation in Matlab.
- lms editor
- 12 hours ago
- 12 min read
Solar PV Based Electric Vehicle Charging Station with V2G and G2V Operation
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
The Solar PV Based Electric Vehicle Charging Station with V2G and G2V Operation is a MATLAB/Simulink-based system designed to demonstrate intelligent bidirectional power flow between a solar photovoltaic array, electric vehicle battery, and utility grid.

Unlike a conventional EV charger that only transfers energy from a source to the vehicle, this system supports multiple operating conditions:
Solar PV energy can charge the EV battery.
Excess solar energy can be supplied to the utility grid.
The EV battery can discharge energy back to the grid through Vehicle-to-Grid (V2G) operation.
The utility grid can charge the EV battery through Grid-to-Vehicle (G2V) operation.
Automatic mode transition is implemented using a Stateflow-based supervisory controller.
Battery State of Charge (SoC) and available solar PV power are used to determine suitable power-flow conditions.
The model is useful for understanding renewable-energy EV charging, bidirectional charging, smart-grid interaction, power electronic converters, MPPT control, and grid-connected inverter control.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The complete charging system integrates the following major sections:
Utility grid
Step-down transformer
Solar PV array
MPPT-controlled boost converter
Common DC link
EV battery
Bidirectional DC-DC converter
Three-level inverter
Harmonic filter
Grid synchronization and measurement system
dq-axis inverter controller
Stateflow-based energy-management controller
The central idea is to maintain coordinated energy transfer between the PV source, EV battery, and utility grid while keeping the DC-link voltage regulated.
Main System Specifications
Parameter | Value |
Utility grid rating | Approximately 124 MW |
Grid-side voltage | 34.5 kV |
Low-voltage side | 400 V |
Grid frequency | 50 Hz |
DC-link reference voltage | 470 V |
Solar PV rated power | Approximately 25 kW |
PV maximum power at STC | Approximately 24.94 kW |
Individual PV module rating | 445 W |
PV modules in series | 8 |
Parallel PV strings | 7 |
Inverter type | Three-level neutral-point-clamped inverter |
Reactive current reference | Zero |
Main control platform | MATLAB/Simulink |
𝐒𝐨𝐥𝐚𝐫 𝐏𝐕 𝐒𝐲𝐬𝐭𝐞𝐦
The solar photovoltaic array acts as the primary renewable-energy source.
The PV configuration uses:
445 W solar modules
8 modules connected in series
7 parallel strings
Maximum generation of approximately 24.94 kW under standard test conditions
Solar generation varies according to environmental conditions, particularly solar irradiance.
During high irradiance:
PV output power increases.
More charging power becomes available for the EV battery.
If the battery has reached its upper SoC condition, the available PV energy can instead be exported to the grid.
During low irradiance:
PV generation decreases.
Battery charging power automatically reduces.
When PV generation becomes unavailable, V2G or G2V operation can be selected according to the operating mode.
𝐌𝐏𝐏𝐓-𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐝 𝐁𝐨𝐨𝐬𝐭 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The solar array is connected to the DC link through a DC-DC boost converter.
Its primary purpose is to:
Extract maximum available power from the PV array.
Adjust the PV operating voltage.
Transfer solar energy efficiently to the common DC bus.
Respond to variations in irradiance.
The controller continuously measures:
PV voltage
PV current
These measurements are supplied to the Maximum Power Point Tracking (MPPT) controller.
The MPPT system generates a reference operating voltage. The actual PV voltage is compared with this reference and processed through a PI controller.
The resulting control signal determines the converter duty cycle, which is converted into switching pulses for the boost converter.
This arrangement allows the PV array to remain close to its maximum-power operating point even when solar irradiance changes.
𝐄𝐕 𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐚𝐧𝐝 𝐁𝐢𝐝𝐢𝐫𝐞𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The EV battery is connected to the common DC link using a bidirectional DC-DC converter.
Unlike a conventional unidirectional charger, this converter allows electrical energy to flow in both directions.
Charging Direction
DC link → EV battery
Used during:
Solar PV charging
G2V charging
Discharging Direction
EV battery → DC link → Grid
Used during:
V2G operation
The converter is controlled using DC-link voltage feedback.
The measured DC-link voltage is compared with the 470 V reference, and a PI controller generates the required switching command.
This helps maintain stable DC-link operation while the EV battery changes between charging and discharging conditions.
𝐓𝐡𝐫𝐞𝐞 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐧𝐠 𝐌𝐨𝐝𝐞𝐬
One of the main features of the model is its three-mode energy-management structure.
Mode | Operating Condition | Main Power Flow |
Mode 1 | Solar PV available | PV → Battery or PV → Grid |
Mode 2 | V2G operation | EV Battery → Grid |
Mode 3 | G2V operation | Grid → EV Battery |
𝐌𝐨𝐝𝐞 𝟏 – 𝐒𝐨𝐥𝐚𝐫 𝐏𝐕 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧
Mode 1 represents daytime operation when solar power is available.
Its behavior mainly depends on the EV battery SoC.
When Battery SoC Is Below the Upper Limit
Solar PV power is primarily used for charging the EV battery.
Power flow:
Solar PV → Boost Converter → DC Link → Bidirectional Converter → EV Battery
Under this condition:
EV battery charging power is positive according to the model convention.
Battery SoC gradually increases.
Grid current remains approximately zero.
Grid power remains around zero.
PV power changes are reflected in battery charging power.
For example, when irradiance is reduced from 1000 W/m² to 500 W/m², PV output power decreases and the EV charging power decreases accordingly.
When Battery SoC Is Above Approximately 95%
The battery does not require further charging.
The available PV energy is therefore delivered to the grid.
Power flow:
Solar PV → DC Link → Inverter → Grid
Under this condition:
Battery power remains close to zero.
Battery SoC remains almost unchanged.
PV generation is exported to the grid.
Inverter current is controlled according to the available PV power.
This prevents unnecessary charging of a battery that has already reached the selected upper SoC region.
𝐌𝐨𝐝𝐞 𝟐 – 𝐕𝐞𝐡𝐢𝐜𝐥𝐞-𝐭𝐨-𝐆𝐫𝐢𝐝 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧
Mode 2 represents Vehicle-to-Grid (V2G) operation.
In this mode, stored energy from the EV battery is delivered to the utility grid.
Power flow:
EV Battery → Bidirectional Converter → DC Link → Inverter → Grid
The model demonstrates V2G operation at different commanded power levels.
Typical V2G Response
Quantity | Observed Behavior |
Solar PV power | Approximately zero during the demonstrated V2G condition |
Battery power | Positive/discharging according to model convention |
Grid power | Indicates export to the grid |
Battery SoC | Decreases |
AC current | Present |
Voltage-current relationship | Approximately in phase during export under the selected sign convention |
Example power command | Approximately 20 kW |
Reduced command example | Approximately 10 kW |
When the V2G reference is changed from approximately 20 kW to 10 kW:
Battery discharge power decreases.
Grid export power decreases.
Battery SoC decreases more slowly.
The controller follows the new power command without requiring changes to the main converter structure.
This illustrates controllable EV participation in grid energy support.
𝐌𝐨𝐝𝐞 𝟑 – 𝐆𝐫𝐢𝐝-𝐭𝐨-𝐕𝐞𝐡𝐢𝐜𝐥𝐞 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧
Mode 3 represents Grid-to-Vehicle (G2V) charging.
In this operating mode, the EV battery receives electrical energy from the utility grid.
Power flow:
Grid → Inverter → DC Link → Bidirectional Converter → EV Battery
Typical behavior includes:
Grid power becomes positive according to the adopted sign convention.
Battery charging power changes to the charging direction.
EV battery SoC increases.
Grid current magnitude increases when the charging-power command increases.
Voltage and current exhibit the phase relationship associated with power import.
The demonstration includes charging commands up to approximately 20 kW.
When the G2V power command is increased:
Grid input power increases.
EV battery charging power increases.
AC-side current increases.
Battery SoC rises at a faster rate.
𝐌𝐨𝐝𝐞 𝐂𝐨𝐦𝐩𝐚𝐫𝐢𝐬𝐨𝐧
Parameter | Mode 1: PV Mode | Mode 2: V2G | Mode 3: G2V |
PV availability | Available | Usually unavailable in demonstrated case | Usually unavailable in demonstrated case |
EV battery | Charges or remains idle | Discharges | Charges |
Grid receives power | When PV surplus is available | Yes | No |
Grid supplies power | No | No | Yes |
Battery SoC | Increases or remains stable | Decreases | Increases |
Main energy source | Solar PV | EV battery | Utility grid |
Main objective | Renewable charging/export | Grid support | EV charging |
𝐀𝐮𝐭𝐨𝐦𝐚𝐭𝐢𝐜 𝐌𝐨𝐝𝐞 𝐓𝐫𝐚𝐧𝐬𝐢𝐭𝐢𝐨𝐧
A Stateflow-based supervisory controller manages the transition between operating states.
The controller receives information such as:
Selected mode
Solar PV power
EV battery SoC
V2G power/current reference
G2V power/current reference
PV-derived active-current reference
The Stateflow controller then determines the appropriate active-current command for the inverter.
Example State Transitions
PV becomes available
The controller can move from:
G2V → Solar PV mode
V2G → Solar PV mode
PV becomes unavailable
Depending on the selected operating command, the controller can move from:
Solar PV mode → V2G
Solar PV mode → G2V
SoC-Based Decision
During solar operation:
If SoC is below the selected upper threshold, PV energy charges the EV battery.
If SoC is above approximately 95%, PV power is exported to the grid instead of continuing battery charging.
This automatic state transition makes the system suitable for studying coordinated EV charging and smart-grid power management.
𝐆𝐫𝐢𝐝-𝐂𝐨𝐧𝐧𝐞𝐜𝐭𝐞𝐝 𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The DC system is interfaced with the AC grid through a three-level neutral-point-clamped inverter.
The inverter provides bidirectional energy conversion:
DC to AC during PV export and V2G operation.
AC to DC during G2V operation.
A harmonic filtering stage and transformer are included between the inverter and utility network.
Their purposes include:
Reducing inverter switching harmonics.
Improving AC-side waveform quality.
Providing appropriate voltage interfacing.
Supporting reliable grid connection.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The grid-connected inverter uses a feed-forward decoupled dq-axis control strategy.
Measurement Stage
The controller measures:
Three-phase grid voltage
Three-phase inverter/grid current
Reference-Frame Conversion
The measured three-phase quantities are converted into the rotating dq reference frame.
The controller therefore works with:
d-axis voltage
q-axis voltage
d-axis current
q-axis current
Active-Power Control
The d-axis current reference controls active-power transfer.
Depending on the selected mode, this reference is obtained from:
Solar PV power
V2G reference
G2V reference
The current direction changes according to whether the system is importing or exporting active power.
Reactive-Power Operation
The q-axis current reference is maintained at:
0
Therefore, the model is mainly designed to control real/active power, rather than intentionally supplying or absorbing reactive power.
𝐅𝐞𝐞𝐝-𝐅𝐨𝐫𝐰𝐚𝐫𝐝 𝐃𝐞𝐜𝐨𝐮𝐩𝐥𝐢𝐧𝐠 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The actual d-axis and q-axis currents are compared with their corresponding references.
The errors are processed by PI controllers.
Feed-forward and decoupling compensation is then applied to obtain suitable inverter control-voltage commands.
Advantages include:
Better current tracking
Improved dynamic response
Reduced interaction between d and q control channels
Smooth transition between importing and exporting power
Improved control during changes in operating mode
The resulting dq control voltages are converted back into three-phase quantities and passed to the inverter modulation system.
𝐃𝐂-𝐋𝐢𝐧𝐤 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The common DC link is an important part of the overall system.
The model maintains its reference at approximately:
470 V
DC-link voltage regulation is important because the bus connects:
Solar PV converter
EV battery converter
Grid-connected inverter
Stable DC-link voltage allows energy to move reliably between these subsystems during rapid changes in operating conditions.
The simulation shows that the controller responds to:
PV irradiance variations
Battery charging
Battery discharging
V2G power changes
G2V power changes
State transitions
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The overall operation can be understood through the following sequence:
Measure solar conditions
PV voltage and current are monitored.
Extract maximum PV power
MPPT determines the preferred PV operating condition.
The boost converter is controlled accordingly.
Monitor battery SoC
The controller determines whether the EV battery requires charging.
Check operating mode
Mode 1: Solar PV
Mode 2: V2G
Mode 3: G2V
Generate active-current reference
The Stateflow controller determines the required direction and magnitude of active-power transfer.
Control inverter current
dq-axis current controllers track the generated references.
Maintain DC-link voltage
The bidirectional converter supports DC-bus regulation.
Control energy direction
PV → Battery
PV → Grid
Battery → Grid
Grid → Battery
Automatically respond to changing conditions
Changes in PV power, SoC, mode selection, or power reference cause corresponding changes in system operation.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
Several operating conditions are demonstrated to verify the complete system.
Case 1: Solar PV Charging the EV Battery
Initial battery SoC is below the upper charging limit and solar irradiance is set to approximately 1000 W/m².
Observed response:
PV generates significant power.
Solar energy charges the EV battery.
Battery power follows available PV power.
Battery SoC increases.
Grid current remains approximately zero.
Grid power remains approximately zero.
This confirms successful renewable-energy-based EV charging without requiring grid power.
Case 2: Reduction in Solar Irradiance
Solar irradiance is reduced from approximately:
1000 W/m² → 500 W/m²
Observed response:
Solar PV output decreases.
Battery charging power decreases.
Charging continues at the available renewable-power level.
Grid power remains close to zero.
Grid current remains approximately zero.
This demonstrates that EV charging automatically follows the available solar resource.
Case 3: V2G Operation at 20 kW
PV generation is reduced to zero and Mode 2 is selected.
Observed response:
EV battery starts discharging.
Approximately 20 kW is transferred toward the grid.
Battery SoC decreases.
AC current becomes clearly visible.
The grid receives active power from the EV battery.
This demonstrates successful bidirectional operation of the EV charging interface.
Case 4: V2G Reference Reduced to 10 kW
The V2G power command is changed from approximately:
20 kW → 10 kW
Observed response:
Battery discharge power decreases.
Grid export power decreases.
Battery SoC decline becomes slower.
The controller successfully follows the new command.
This confirms variable-power V2G capability.
Case 5: G2V Charging
The controller is changed to Mode 3.
Observed response:
Power direction reverses.
Utility-grid energy is supplied to the EV battery.
Battery charging power increases.
Battery SoC starts increasing.
AC current changes according to the required grid-import power.
This validates grid-assisted EV charging.
Case 6: G2V Charging at 20 kW
The G2V command is increased to approximately 20 kW.
The simulation shows:
Grid power approaches the commanded charging level.
Battery charging power increases correspondingly.
Grid-side current magnitude increases.
EV battery SoC rises.
This demonstrates controllable high-power grid charging.
Case 7: Transition from G2V to Solar Charging
Solar irradiance is increased while the system is operating in G2V mode.
As PV power becomes available:
The Stateflow controller detects renewable generation.
The system transitions toward Mode 1.
Grid charging is reduced or stopped.
PV energy starts supplying the EV battery.
Further increases in irradiance lead to higher PV charging power.
This is particularly useful because the charging station can automatically prioritize renewable energy when sunlight becomes available.
Case 8: High-SoC Solar Operation
The battery SoC is initialized above approximately 95%, while solar irradiance is set near 1000 W/m².
Observed response:
Battery charging power remains approximately zero.
Battery SoC stays nearly constant.
Available PV power is exported to the utility grid.
Grid power indicates energy export.
This shows effective prevention of unnecessary charging when the battery is already near its upper SoC limit.
𝐒𝐮𝐦𝐦𝐚𝐫𝐲 𝐨𝐟 𝐓𝐞𝐬𝐭 𝐂𝐨𝐧𝐝𝐢𝐭𝐢𝐨𝐧𝐬
Test Condition | PV Power | Battery Behavior | Grid Behavior | SoC Trend |
1000 W/m², SoC below limit | High | Charging | Nearly idle | Increasing |
500 W/m², SoC below limit | Reduced | Charging at reduced power | Nearly idle | Increasing |
PV = 0, V2G 20 kW | Zero | Discharging | Receives power | Decreasing |
PV = 0, V2G 10 kW | Zero | Reduced discharge | Receives lower power | Slowly decreasing |
PV = 0, G2V | Zero | Charging | Supplies power | Increasing |
G2V ≈ 20 kW | Zero | Higher charging power | Supplies ≈20 kW | Increasing |
PV available, SoC >95% | Available | Approximately idle | Receives PV power | Nearly constant |
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
Approximately 25 kW solar PV charging system
Bidirectional EV charging capability
Vehicle-to-Grid operation
Grid-to-Vehicle charging
Solar-to-EV charging
Solar-to-grid energy export
Automatic SoC-based charging decision
Stateflow-based operating-mode management
MPPT-controlled solar boost converter
Bidirectional DC-DC battery converter
Three-level NPC inverter
Feed-forward decoupled dq current control
Active-power command tracking
Approximately 470 V regulated DC link
400 V, 50 Hz AC-side interface
Variable V2G and G2V power references
Dynamic transition between different energy-flow modes
𝐀𝐝𝐯𝐚𝐧𝐭𝐚𝐠𝐞𝐬
Better Utilization of Solar Energy
Available PV generation can be used directly for EV charging rather than depending entirely on utility-grid electricity.
Bidirectional Energy Transfer
The EV battery can act not only as an electrical load but also as an energy-storage resource for the grid.
Reduced Grid Dependency
During periods of strong solar generation, the vehicle can be charged primarily from renewable energy.
Renewable Energy Export
When the EV battery has sufficient SoC, unused solar energy can be transferred to the grid.
Flexible Charging Power
V2G and G2V power references can be changed according to system requirements.
Automatic Energy Management
Stateflow control enables smooth transitions between different operating modes based on PV availability, SoC, and selected commands.
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This solar PV based bidirectional EV charging model can be useful for studying and developing:
Smart EV charging stations
Solar-powered charging infrastructure
V2G-enabled charging systems
G2V charging systems
Smart-grid energy management
Renewable-energy integration
Bidirectional EV chargers
Residential solar EV charging
Commercial EV charging infrastructure
Microgrid-connected EV charging
Demand-response systems
Distributed energy-resource management
Vehicle-based energy storage
Grid-support applications
MATLAB/Simulink research on power-electronic converters
𝐖𝐡𝐲 𝐕𝟐𝐆 𝐢𝐬 𝐈𝐦𝐩𝐨𝐫𝐭𝐚𝐧𝐭
In a conventional EV charging station, the vehicle primarily consumes electricity.
With V2G technology, the EV battery becomes a controllable energy-storage unit.
When connected to a compatible charging station, stored vehicle energy can potentially support:
Peak-demand reduction
Renewable-energy balancing
Local energy management
Grid power support
Smart charging
Energy scheduling
The simulation demonstrates the fundamental bidirectional power-control mechanism required for such applications.
𝐖𝐡𝐲 𝐆𝟐𝐕 𝐑𝐞𝐦𝐚𝐢𝐧𝐬 𝐄𝐬𝐬𝐞𝐧𝐭𝐢𝐚𝐥
Solar generation is naturally variable and unavailable during nighttime.
Therefore, G2V charging provides an alternative energy path when renewable generation is insufficient.
The model allows the grid to charge the EV while maintaining controlled active-power transfer and regulated DC-link operation.
Combining PV charging + V2G + G2V makes the charging system significantly more flexible than a conventional single-direction charger.
𝐒𝐨𝐥𝐚𝐫 𝐏𝐕, 𝐕𝟐𝐆 𝐚𝐧𝐝 𝐆𝟐𝐕 𝐏𝐨𝐰𝐞𝐫 𝐅𝐥𝐨𝐰
Operating Scenario | Source | Destination |
Solar charging | Solar PV | EV battery |
Solar export | Solar PV | Utility grid |
V2G | EV battery | Utility grid |
G2V | Utility grid | EV battery |
This four-way operating capability is the central feature of the charging-station architecture.
𝐖𝐡𝐨 𝐂𝐚𝐧 𝐔𝐬𝐞 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥?
The MATLAB/Simulink model is particularly useful for:
Electrical engineering students
Power electronics learners
EV charging researchers
Renewable-energy researchers
Smart-grid engineers
Microgrid researchers
MATLAB/Simulink users
Control-system engineers
Power-system engineers
Engineers studying bidirectional converters and grid-connected inverters
It provides a clear platform for understanding how solar PV generation, battery SoC, converter control, grid interaction, and energy-management logic work together in an advanced EV charging system.
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The Solar PV Based Electric Vehicle Charging Station with V2G and G2V Operation in MATLAB/Simulink demonstrates a flexible bidirectional EV charging architecture integrating approximately 25 kW of solar PV generation, an EV battery, a bidirectional DC-DC converter, a regulated DC link, and a grid-connected three-level inverter.
The system successfully demonstrates three major operating modes:
Mode 1 – Solar PV operation: PV energy charges the EV battery or is exported to the grid depending on battery SoC.
Mode 2 – V2G operation: stored EV battery energy is supplied back to the utility grid.
Mode 3 – G2V operation: utility-grid power is used to charge the EV battery.
Simulation responses show appropriate changes in PV power, grid power, battery power, battery SoC, DC-link voltage, and AC-side voltage/current during changes in irradiance, power references, and operating modes.
The combination of MPPT control, bidirectional conversion, Stateflow-based energy management, dq current control, and automatic mode switching provides a useful framework for studying next-generation renewable-energy EV charging and smart-grid interaction.



Comments