Grid connected Solar PV battery system in MATLAB
Grid connected Solar PV battery system in MATLAB
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
A Grid Connected Solar PV Battery System in MATLAB/Simulink is an effective model for studying renewable-energy generation, battery energy storage, bidirectional power flow, and grid integration.

In this MATLAB simulation, the system combines:
Solar PV array
Boost converter
Incremental Conductance MPPT
Battery Energy Storage System
Bidirectional DC–DC converter
220 V DC bus
Grid-connected full-bridge inverter
dq-frame current control
PWM-based inverter switching
Utility grid and load
The main purpose of the system is to extract maximum available solar power, manage battery charging and discharging, maintain the DC-bus voltage, and control the amount of current exchanged with the utility grid.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The complete MATLAB/Simulink model can be divided into four major sections.
Section | Main Components | Purpose |
Solar PV system | PV array, boost converter, MPPT | Extract maximum available solar power |
Battery system | Battery, bidirectional DC–DC converter | Store or supply energy |
DC bus | DC-link capacitor and voltage controller | Maintain stable DC voltage |
Grid interface | Full-bridge inverter, filter and grid | Exchange power with the utility grid |
The PV and battery systems are connected to a common DC bus, while the grid-connected inverter provides the interface between the DC system and the AC utility grid.
𝐒𝐨𝐥𝐚𝐫 𝐏𝐕 𝐒𝐲𝐬𝐭𝐞𝐦
The solar PV array generates DC electrical power according to the available solar irradiation and operating conditions.
The PV output is connected to a boost DC–DC converter.
Incremental Conductance MPPT
The boost converter is controlled using the Incremental Conductance (INC) Maximum Power Point Tracking algorithm.
The controller monitors:
PV voltage
PV current
From these measurements, the INC MPPT algorithm determines the required boost-converter duty cycle.
Its objective is to operate the PV array close to its maximum power point, allowing maximum available solar energy to be extracted.
Main PV power path
Solar PV → Boost Converter → DC Bus
This arrangement provides controlled power transfer from the PV array to the common DC link.
𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐄𝐧𝐞𝐫𝐠𝐲 𝐒𝐭𝐨𝐫𝐚𝐠𝐞
The battery is connected to the common DC bus through a bidirectional DC–DC converter.
Unlike a conventional one-way converter, the bidirectional converter allows energy to flow in both directions.
Battery Operating Modes
Operating Condition | Battery Mode | Power Flow |
PV power is greater than load requirement | Charging | PV → Battery |
PV power is approximately equal to load requirement | Reduced battery participation | PV → Load |
PV power is lower than load requirement | Discharging | Battery → DC Bus/Load |
Grid power support is required | Grid participation | Grid and renewable sources share demand |
This makes the battery an important element for balancing the difference between renewable generation and power demand.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The basic operation of the proposed grid-connected PV-battery system is straightforward.
When Solar Power Is High
If the available PV power is greater than the power required by the load:
The PV system supplies the required load power.
Excess PV energy becomes available.
The bidirectional converter operates in battery-charging mode.
Additional power can also be transferred toward the grid depending on the inverter current reference and control strategy.
When Solar Power Is Low
If PV generation becomes lower than the required load power:
The PV array continues supplying the available solar power.
The battery can operate in discharging mode.
The battery supports the DC bus.
The grid can provide the remaining power depending on the operating condition.
Therefore, power can be shared among the PV system, battery and utility grid.
𝐃𝐂 𝐁𝐮𝐬 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The common DC bus is one of the most important sections of the system.
In this simulation, the DC-bus reference voltage is set to approximately:
Parameter | Value |
DC-bus voltage reference | 220 V |
A voltage controller compares the measured DC-bus voltage with the reference voltage.
The controller then adjusts the operation of the bidirectional battery DC–DC converter.
This allows the battery converter to respond according to the DC-bus condition by charging or discharging the battery as required.
Maintaining the DC bus is important because the grid-connected inverter receives its input power from this DC link.
𝐆𝐫𝐢𝐝-𝐂𝐨𝐧𝐧𝐞𝐜𝐭𝐞𝐝 𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The DC bus is connected to the utility grid through a full-bridge voltage-source inverter.
The inverter converts DC power into controlled AC power suitable for grid connection.
The inverter control is implemented using a dq-frame current-control technique.
This provides accurate control over the inverter current and consequently controls the power exchanged with the grid.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The inverter-control section contains several important stages.
Grid Synchronization
The measured grid voltage is processed by the synchronization system.
The synchronization signal provides the angular information required for converting AC variables into the rotating reference frame.
abc-to-dq Transformation
The measured inverter current is transformed from the three-phase or stationary representation into d-axis and q-axis current components.
This simplifies inverter current regulation.
Current Reference Generation
The controller generates:
d-axis current reference
q-axis current reference
The d-axis current reference primarily determines the active-current component exchanged with the grid.
The q-axis reference can be selected according to the required reactive-power operating condition.
Current Controller
The measured dq currents are compared with their corresponding reference values.
The current controller generates the required voltage-control signals.
dq-to-abc Conversion
The controller output is converted back into the required AC reference quantities.
These signals are passed to the PWM generation stage.
PWM Generation
The PWM generator produces switching pulses for the full-bridge inverter semiconductor switches.
As a result, the inverter output current follows the desired reference.
𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫 𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐑𝐞𝐟𝐞𝐫𝐞𝐧𝐜𝐞
One of the useful features of this model is the ability to change the grid inverter current reference.
For example, the simulation demonstrates operation with a current-reference setting of approximately:
Control Parameter | Example Value |
Inverter current reference | 0.5 |
DC-bus reference | 220 V |
Changing the inverter current reference changes the amount of power transferred through the inverter.
This also influences the power supplied by the grid and the amount of power available for battery charging.
𝐄𝐟𝐟𝐞𝐜𝐭 𝐨𝐟 𝐂𝐡𝐚𝐧𝐠𝐢𝐧𝐠 𝐭𝐡𝐞 𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐑𝐞𝐟𝐞𝐫𝐞𝐧𝐜𝐞
The simulation clearly demonstrates the interaction between the PV system, battery and grid.
Current Reference Condition | Inverter Contribution | Grid Contribution | Battery Charging |
Lower inverter current reference | Lower | Higher | More PV power may remain available for charging |
Higher inverter current reference | Higher | Lower | Battery charging power can decrease |
For example, when the inverter-current reference is increased, the inverter supplies a greater share of current toward the grid-side system.
As a result:
inverter current increases,
grid current contribution decreases,
more PV power is directed through the inverter,
battery charging current can decrease.
When the current reference is reduced again, the power-sharing condition changes accordingly.
This demonstrates the dynamic power-sharing capability of the grid-connected PV-battery system.
𝐏𝐨𝐰𝐞𝐫 𝐅𝐥𝐨𝐰 𝐒𝐮𝐦𝐦𝐚𝐫𝐲
The main operating paths of the model are:
Source/Storage | Converter | Destination |
Solar PV | Boost converter | DC bus |
DC bus | Bidirectional DC–DC converter | Battery charging |
Battery | Bidirectional DC–DC converter | DC bus during discharge |
DC bus | Full-bridge inverter | AC grid/load |
Utility grid | Grid interface | Supports system demand when required |
This structure provides flexible energy management under changing solar generation and load conditions.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
The MATLAB/Simulink model allows several important signals to be observed.
PV and Converter Results
The simulation displays:
PV output power
Boost-converter output power
The PV power rises toward its operating point as the Incremental Conductance MPPT adjusts the converter duty cycle.
Battery Results
The battery scope displays:
Battery voltage
Battery current
The sign and magnitude of battery current indicate whether the battery is charging or discharging.
During excess PV generation, the battery can absorb the available surplus energy.
Grid/Inverter Results
The grid-side scope displays:
Inverter voltage
Inverter current
Grid current
The inverter voltage maintains the required AC waveform while the inverter-current amplitude changes according to the selected current reference.
Changing the current reference clearly demonstrates the corresponding change in grid-current sharing.
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
Grid-connected Solar PV system
Battery Energy Storage System
Incremental Conductance MPPT
Boost DC–DC converter
Bidirectional battery converter
DC-bus voltage regulation
220 V DC-link reference
Full-bridge grid-connected inverter
dq-frame inverter-current control
Grid synchronization
PWM switching control
Adjustable inverter-current reference
PV–battery–grid power sharing
Battery charging and discharging
Real-time observation of PV, battery and grid variables
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This MATLAB/Simulink model can be useful for studying and developing:
Solar PV grid-integration systems
Residential PV-battery systems
Smart-grid applications
Battery Energy Storage Systems
Renewable-energy microgrids
Solar energy management systems
Bidirectional DC–DC converter control
Grid-connected inverter control
PV power-management strategies
Distributed generation systems
Renewable-energy research projects
Undergraduate and postgraduate MATLAB/Simulink projects
𝐖𝐡𝐲 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥 𝐈𝐬 𝐔𝐬𝐞𝐟𝐮𝐥
This simulation is especially useful for students, researchers and engineers because it combines several important power-electronics concepts in a single MATLAB model.
It helps users understand how:
MPPT extracts maximum solar power.
A boost converter interfaces the PV array with the DC bus.
A bidirectional converter controls battery energy flow.
Battery storage compensates for PV power variations.
A DC bus links renewable sources with the inverter.
dq control regulates the grid-connected inverter.
Current-reference changes affect grid power sharing.
PV, battery and grid sources interact dynamically.
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The Grid Connected Solar PV Battery System in MATLAB/Simulink demonstrates an integrated renewable-energy system containing PV generation, battery storage and utility-grid connection.
The Incremental Conductance MPPT controls the PV boost converter to obtain maximum available solar power. The battery is connected through a bidirectional DC–DC converter, allowing charging during excess PV generation and discharging when additional power support is required.
A voltage-control loop helps maintain the 220 V DC bus, while the grid-connected inverter uses dq-frame current control and PWM switching to regulate the power exchanged with the utility grid.
The most interesting feature of the model is the adjustable inverter-current reference. By modifying this reference, users can directly observe changes in inverter current, grid-current sharing and battery charging behavior.
Overall, this model provides a simple and practical platform for understanding solar PV generation, battery energy storage, DC-bus control, grid inverter control and renewable-energy power management in MATLAB/Simulink.



Comments