MATLAB Simulation of Grid Connected PV Battery System with PO MPPT | Grid Tied PV Battery System
- lms editor
- 2 days ago
- 8 min read
MATLAB Simulation of Grid Connected PV Battery System with PO MPPT | Grid Tied PV Battery System
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
Grid Connected PV Battery System with PO MPPT
This MATLAB/Simulink model demonstrates a grid-connected solar PV and battery energy system controlled using the Perturb and Observe Maximum Power Point Tracking technique.
The system combines:
A solar PV array
P&O MPPT control
A boost converter
A battery energy-storage unit
A bidirectional DC–DC converter
A regulated 400 V DC bus
A DC load
A single-phase grid-connected inverter
Grid import and export control

The model is useful for understanding solar power extraction, battery charging and discharging, DC-bus regulation, grid-current control, and power balancing under changing solar irradiation.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The PV array generates electrical power based on the available solar irradiation. A boost converter connects the PV array to the common DC bus.
The P&O MPPT controller continuously adjusts the converter duty cycle so that the PV array operates close to its maximum power point.
The battery is connected to the DC bus through a bidirectional DC–DC converter. It absorbs excess PV power during charging and supplies power when the PV output is insufficient.
A single-phase full-bridge inverter connects the DC bus to the utility grid through an LCL filter.
Main system components
Component | Main function |
PV array | Converts solar irradiation into DC power |
P&O MPPT controller | Tracks the maximum available PV power |
Boost converter | Increases PV voltage to the DC-bus level |
Battery | Stores excess energy and supplies deficit power |
Bidirectional converter | Controls battery charging and discharging |
DC bus | Provides a common power-transfer link |
DC load | Consumes regulated DC power |
Full-bridge inverter | Transfers power between the DC bus and grid |
LCL filter | Reduces inverter switching harmonics |
PLL and current controller | Synchronize and control grid current |
𝐏𝐕 𝐀𝐫𝐫𝐚𝐲 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
The PV array contains eight modules connected in series. Each module produces approximately 250 W under rated conditions.
Parameter | Value |
Number of PV modules | 8 |
Connection type | Series |
Maximum power per module | Approximately 250 W |
Module voltage at maximum power | 30.7 V |
Module current at maximum power | 8.15 A |
Approximate array voltage at maximum power | 245 V |
Approximate total PV power | 2 kW |
Parallel strings | 1 |
The model also displays the I–V and P–V characteristics of the PV array under different irradiation levels. These curves show how the maximum power point changes when solar irradiation varies.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
01) Solar power generation
The PV array produces DC voltage and current according to the applied solar irradiation.
A higher irradiation level produces greater PV current and power, while a lower irradiation level reduces the available solar power.
02) PV voltage and current measurement
The controller measures:
PV voltage
PV current
PV power
Change in PV voltage
Change in PV power
These values are updated at every MPPT sampling instant.
03) Maximum power tracking
The P&O MPPT controller compares the present PV operating point with the previous operating point.
Based on the direction of change in voltage and power, the controller determines whether the PV operating voltage must increase or decrease.
04) Boost-converter control
The MPPT controller generates the required duty cycle.
The duty cycle is passed to a PWM generator, which produces the switching pulse for the boost-converter IGBT.
The converter performs two main functions:
Extracts maximum available power from the PV array
Boosts the PV voltage from approximately 245 V to the 400 V DC bus
05) Battery power management
The battery stores energy when the PV generation is higher than the system demand.
When PV generation becomes lower than the load and grid-export requirement, the battery supplies the required power.
06) Grid power exchange
The inverter controls the flow of active current between the system and the utility grid.
Depending on PV current and battery SOC, the system can:
Export power to the grid
Import power from the grid
Supply the DC load
Charge the battery
Discharge the battery
𝐏&𝐎 𝐌𝐏𝐏𝐓 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The Perturb and Observe controller uses the direction of change in PV voltage and power to modify the boost-converter duty cycle.
MPPT operating logic
Change in PV voltage | Change in PV power | Required PV-voltage movement | Duty-cycle action |
Positive | Positive | Increase PV voltage | Decrease duty cycle |
Negative | Negative | Increase PV voltage | Decrease duty cycle |
Positive | Negative | Decrease PV voltage | Increase duty cycle |
Negative | Positive | Decrease PV voltage | Increase duty cycle |
The duty cycle is restricted between predefined minimum and maximum limits.
MPPT initialization parameters
The controller initializes the following values:
Initial duty cycle
Minimum duty cycle
Maximum duty cycle
Duty-cycle step size
Previous PV voltage
Previous PV power
Previous duty cycle
If the newly calculated duty cycle exceeds its permitted range, the previous valid duty cycle is retained.
𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐒𝐲𝐬𝐭𝐞𝐦
The battery provides energy support during low solar irradiation and stores excess solar energy during high generation.
Battery specifications
Parameter | Value |
Nominal battery voltage | 240 V |
Rated capacity | 48 Ah |
Normal test initial SOC | 50% |
Low-SOC test condition | 9% |
Converter type | Bidirectional DC–DC converter |
Control objective | Maintain 400 V DC bus |
Battery operating modes
System condition | Battery response |
PV generation exceeds demand | Charging |
PV generation is lower than demand | Discharging |
Low SOC and insufficient PV power | Charging from the grid |
DC-bus voltage decreases | Battery supplies additional power |
Excess DC-bus power is available | Battery absorbs power |
𝐃𝐂-𝐁𝐮𝐬 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The bidirectional converter is operated in voltage-control mode to maintain the common DC bus at approximately 400 V.
The measured DC-bus voltage is compared with the 400 V reference.
The resulting voltage error is processed by a PI controller. The controller output is then supplied to the PWM generator for controlling the bidirectional converter switches.
Voltage-control sequence
Measure DC-bus voltage
Compare it with the 400 V reference
Process the voltage error through the PI controller
Generate the converter control signal
Produce PWM switching pulses
Control battery charging or discharging
Restore the DC bus to its reference value
𝐆𝐫𝐢𝐝-𝐒𝐢𝐝𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The single-phase full-bridge inverter is connected to the grid through an LCL filter.
Grid voltage is measured and processed using a phase-locked loop. The PLL generates a synchronized sinusoidal reference signal for inverter-current control.
The actual inverter current is transformed into the control reference frame and compared with the reference current. PI current controllers generate the required inverter voltage commands.
The control signals are converted back into the stationary frame and supplied to the PWM generator.
Grid-control functions
Grid-voltage synchronization
Active current regulation
Sinusoidal current-reference generation
Grid power import
Grid power export
Inverter switching-pulse generation
Harmonic reduction through the LCL filter
𝐄𝐧𝐞𝐫𝐠𝐲 𝐌𝐚𝐧𝐚𝐠𝐞𝐦𝐞𝐧𝐭 𝐋𝐨𝐠𝐢𝐜
The grid-current reference is selected according to the PV current and battery SOC.
PV current condition | Battery SOC condition | Grid operating mode | Current reference |
PV current above 0.5 A | SOC above 10% | Power export | Approximately 2 A |
PV current below 0.5 A | SOC below 10% | Power import | Approximately −10 A |
A positive grid-current reference represents power export in the demonstrated control convention, while a negative reference represents power import.
The imported grid power can supply the load and charge the battery when both PV generation and battery SOC are low.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐂𝐨𝐧𝐝𝐢𝐭𝐢𝐨𝐧𝐬
The solar irradiation is varied during the simulation to evaluate the dynamic response of the PV, battery, DC bus, and grid interface.
Simulation parameter | Value |
Total simulation duration | Approximately 1.6 s |
Irradiation update interval | Approximately 0.3 s |
Irradiation levels | 1000, 500, 10, 500 and 1000 W/m² |
DC-bus reference voltage | 400 V |
DC-load power | Approximately 1000 W |
Grid-export current | Approximately 2 A |
Grid-import current | Approximately 10 A |
Normal initial battery SOC | 50% |
Low-SOC test value | 9% |
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
PV response
The PV voltage, current, and power vary according to the applied irradiation.
Irradiation level | Approximate PV power |
1000 W/m² | Around 1950–2000 W |
500 W/m² | Around 1000 W |
10 W/m² | Close to zero |
The results confirm that the P&O MPPT controller adjusts the boost-converter duty cycle according to changing solar conditions.
DC-bus response
The DC-bus voltage reaches and remains close to the 400 V reference, even when the PV irradiation changes.
This demonstrates the effectiveness of the bidirectional converter and battery voltage-control loop.
Battery response with 50% initial SOC
At high PV generation, excess power charges the battery.
When the PV output becomes lower than the combined load and grid-export demand, the battery changes to discharging mode.
Time period | PV condition | Battery mode | ||
Initial high-irradiation interval | PV power is high | Charging | ||
Approximately 0.3 to 1.2 s | PV power is lower | Discharging | ||
Final high-irradiation interval | PV power increases | Charging | ||
The battery SOC increases during charging and decreases during discharging.
Grid response with 50% initial SOC
When sufficient PV power and battery energy are available, the inverter exports approximately 2 A of current to the grid.
The grid and inverter currents remain synchronized with the grid voltage.
Low-SOC test
A second operating condition is evaluated with the battery SOC set to approximately 9%.
When PV current becomes very low and the SOC remains below 10%, the controller changes the grid-current reference from export mode to import mode.
Condition | System response |
PV generation is available | Power can be exported to the grid |
PV power becomes nearly zero | Grid-import mode is activated |
Battery SOC is below 10% | Battery charging is prioritized |
Grid power is imported | Load is supplied and battery is charged |
The battery SOC begins to increase because energy is drawn from the grid for charging.
Power-balance verification
The model measures:
PV-converter current
Battery-converter current
DC-load current
Inverter input current
Sum of currents at the DC bus
The sum of the DC-bus input and output currents remains close to zero, confirming that the system satisfies the required power balance.
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
Complete grid-connected PV battery model in MATLAB/Simulink
Approximately 2 kW solar PV array
Eight series-connected PV modules
P&O MPPT-based maximum power extraction
PV boost-converter control
400 V regulated DC bus
240 V, 48 Ah battery model
Bidirectional battery charging and discharging
PI-based DC-bus voltage regulation
Single-phase full-bridge grid inverter
LCL output filter
PLL-based grid synchronization
Grid import and export operation
SOC-based energy-management logic
Variable-irradiation testing
Low-battery-SOC operating scenario
DC-bus current-balance verification
PV, battery, load, inverter, grid, and SOC measurements
𝐖𝐡𝐚𝐭 𝐂𝐚𝐧 𝐁𝐞 𝐎𝐛𝐬𝐞𝐫𝐯𝐞𝐝?
The simulation allows users to examine:
PV voltage under changing irradiation
PV current and generated power
P&O MPPT tracking behaviour
Boost-converter operation
DC-bus voltage regulation
Battery voltage and current
Battery charging and discharging
Battery SOC variation
DC-load voltage, current, and power
Inverter voltage and current
Grid-current direction
Power import from the grid
Power export to the grid
Current balance at the common DC bus
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This simulation can support studies related to:
Grid-connected rooftop solar systems
Residential solar battery systems
Renewable-energy integration
Solar energy-storage control
Smart-grid power management
Battery-supported DC microgrids
Grid-tied inverter control
Bidirectional power converters
Maximum power point tracking
DC-bus voltage regulation
Energy-management strategy development
MATLAB and Simulink learning
Power-electronics control analysis
𝐒𝐮𝐢𝐭𝐚𝐛𝐥𝐞 𝐟𝐨𝐫
Electrical engineering students
Power-electronics learners
Renewable-energy researchers
MATLAB/Simulink users
Control-system engineers
Solar-system designers
Battery-energy-storage researchers
Grid-integration engineers
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The MATLAB simulation presents a complete grid-connected PV battery system with P&O MPPT.
The PV boost converter extracts maximum solar power, while the bidirectional battery converter maintains the DC bus near 400 V. The battery automatically changes between charging and discharging according to the available PV power and total demand.
The grid-side inverter supports both power export and power import. When PV generation and battery SOC are sufficient, energy is delivered to the grid. When the PV output is low and the battery SOC falls below the specified limit, grid power is imported to supply the load and recharge the battery.
The model provides a clear platform for studying MPPT control, battery energy management, DC-bus regulation, inverter control, variable irradiation, grid power exchange, and complete system power balancing.



Comments