Grid connected PV battery with Non linear Load in MATLAB
Grid connected PV battery with Non linear Load in MATLAB
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
A Grid-Connected PV–Battery System with Nonlinear Load in MATLAB/Simulink is an effective model for studying renewable energy generation, battery energy storage, grid power exchange, DC-link voltage regulation, and variable load conditions in a single system.

The proposed configuration combines a solar PV array, P&O MPPT-controlled boost converter, battery with bidirectional DC–DC converter, single-phase grid-connected inverter, filter, utility grid, and nonlinear/variable AC load.
The main objectives are to:
Extract maximum available power from the PV array.
Maintain a stable common DC-link voltage.
Charge or discharge the battery according to the power balance.
Supply the connected AC load continuously.
Exchange surplus or deficit power with the utility grid.
Operate the grid interface under a constant-power condition when the load power falls below a predefined limit.
Analyze system performance under changing solar irradiation and load conditions.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The MATLAB/Simulink model can be represented as:
PV Array → Boost Converter → Common DC Link → Single-Phase Inverter → Filter → PCC → Grid
The battery is connected directly to the common DC bus through a bidirectional DC–DC converter.
At the AC side, the Point of Common Coupling (PCC) connects:
Grid + Inverter + Nonlinear/Variable Load
This arrangement allows coordinated energy exchange among the PV source, battery, grid, and load.
Main System Parameters
Parameter | Value / Condition |
PV maximum power | Approximately 4.6 kW |
PV operating voltage mentioned | Approximately 29.5 V |
Peak PV current | Approximately 164 A |
PV MPPT method | P&O MPPT |
Battery voltage | 240 V |
Initial battery SOC | 50% |
DC-link reference voltage | 360 V |
Grid / AC source voltage | 220 V AC |
Grid power threshold, PL Peak | 1500 W |
Solar irradiance levels | 300, 700 and 1000 W/m² |
PV converter | Boost converter |
Battery converter | Bidirectional DC–DC converter |
Grid converter | Single-phase inverter |
Synchronization | Grid-voltage-based synchronization |
Main operating modes | Grid supply, battery charging and grid power export |
𝐏𝐕 𝐀𝐫𝐫𝐚𝐲 𝐚𝐧𝐝 𝐌𝐏𝐏𝐓 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The solar PV array is the primary renewable source in the system.
PV-Side Operation
PV voltage and PV current are continuously measured.
The corresponding PV power is determined by the control system.
A Perturb and Observe (P&O) MPPT algorithm tracks the maximum power point.
The MPPT controller generates the required duty-cycle command.
The duty command is processed by the PWM/pulse generator.
The generated gate pulse controls the IGBT of the boost converter.
As irradiation increases, the available PV current and PV power increase.
The boost converter therefore provides the necessary interface between the PV source and the 360 V common DC link.
Irradiance Variation
The simulation considers different solar irradiation conditions:
Operating Stage | Irradiance | Approximate PV Power Behavior |
Low irradiation | 300 W/m² | Around 1.2 kW |
Medium irradiation | 700 W/m² | Around 2.4 kW |
High irradiation | 1000 W/m² | Around 4.6 kW |
This clearly demonstrates the response of the P&O MPPT controller to changing environmental conditions.
𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐄𝐧𝐞𝐫𝐠𝐲 𝐒𝐭𝐨𝐫𝐚𝐠𝐞
A 240 V battery with an initial SOC of approximately 50% is connected to the common DC bus through a bidirectional converter.
The battery converter performs two important functions:
DC-link voltage regulation and battery current regulation.
Battery Control Structure
The measured DC-link voltage is compared with the reference value of 360 V.
The resulting voltage error is processed by a PI controller, which generates the battery current reference.
The battery current reference is then compared with the measured battery current. A second current-control stage produces the required converter duty cycle.
The PWM generator finally generates the switching pulses for the bidirectional converter.
This cascaded control structure provides:
Stable DC-link operation.
Controlled battery charging.
Controlled battery discharging when required.
Smooth power balancing during PV and load variations.
Reduced influence of sudden power changes on the DC bus.
𝐃𝐂-𝐋𝐢𝐧𝐤 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The common DC bus is a critical point of the system because both the PV converter and battery converter interact through it.
The reference DC-link voltage is maintained at approximately:
Vdc = 360 V
During the initial transient, the DC-link voltage changes while the controllers settle.
After approximately 2 seconds, the voltage reaches its reference region and remains almost constant even when:
PV irradiation changes.
PV power increases significantly.
Load demand changes.
Battery charging current changes.
Grid power direction changes.
Maintaining a stable DC-link voltage is essential for obtaining reliable inverter operation and controlled power exchange with the grid.
𝐆𝐫𝐢𝐝-𝐂𝐨𝐧𝐧𝐞𝐜𝐭𝐞𝐝 𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The DC-link voltage is supplied to a single-phase voltage-source inverter.
The inverter converts the available DC power into AC power suitable for grid connection.
The inverter output passes through an inductive and damping/filter network before reaching the PCC.
The grid voltage is approximately 220 V AC.
The grid voltage is measured and used to obtain the synchronization information required by the inverter control system.
This ensures that the inverter current remains synchronized with the utility voltage during power exchange.
𝐍𝐨𝐧𝐥𝐢𝐧𝐞𝐚𝐫 𝐚𝐧𝐝 𝐕𝐚𝐫𝐢𝐚𝐛𝐥𝐞 𝐋𝐨𝐚𝐝
A major feature of this simulation is the variation of load demand during operation.
Multiple load sections are switched at different time intervals to study the dynamic response of the PV–battery–grid system.
Approximate Load Current Profile
Time Period | Load Current | Operating Condition |
Initial period to around 5 s | Approximately 10 A | Higher load |
After 5 s | Approximately 5 A | Reduced load |
Intermediate switching period | Approximately 7–7.5 A | Additional load connected |
Final stage | Approximately 5 A | Reduced load again |
These load transitions allow the model to demonstrate how the PV source, battery and utility grid automatically redistribute power.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The grid inverter controller uses information obtained from several parts of the system.
Important signals include:
Battery current.
Load current.
DC-link voltage.
PV power.
Grid voltage.
Calculated loss component.
Grid synchronization signal.
Load power.
The measured load current is transformed into the required stationary and synchronous reference components for control processing.
The DC-link voltage error is also processed to generate a loss-compensation component.
These signals are combined to determine the inverter current reference.
𝐂𝐨𝐧𝐬𝐭𝐚𝐧𝐭 𝐆𝐫𝐢𝐝 𝐏𝐨𝐰𝐞𝐫 𝐌𝐨𝐝𝐞
One of the interesting control features in this model is the use of a predefined load-power threshold:
PL Peak = 1500 W
The controller checks the instantaneous load power against this value.
Condition | Grid Control Action |
PL > 1500 W | Grid reference is adjusted according to system/load power requirements |
PL < 1500 W | Grid is operated using the predefined constant-power reference |
This strategy becomes particularly useful when the load suddenly decreases.
Instead of allowing the grid power to follow every load fluctuation, the controller can maintain the required grid power while the battery absorbs the difference.
This provides smoother grid-side operation.
𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫 𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
After generating the required current reference, the reference quantity is transformed back into the stationary reference frame.
The inverter current is measured and compared with its reference.
The resulting current error is processed by the current controller.
Finally:
Current Controller → Gate Signals G1 and G2 → Single-Phase Inverter
This closed-loop current control allows the inverter to inject or absorb the required grid current according to the energy-management command.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The complete power-management sequence can be understood from the simulation timeline.
Simulation Event | PV | Battery | Grid | Load |
Initial condition | Low PV generation | Nearly neutral initially | Supplies required deficit power | Supplied normally |
PV power ≈ 1.2 kW | Producing limited power | Small current initially | Supports the load | Around higher demand |
After ≈ 2 s | PV contribution increases | Charging begins | Grid contribution changes | Load remains supplied |
Around 3 s | PV ≈ 2.4 kW | Charging | Grid begins receiving surplus power | Supplied continuously |
Around 4 s | PV ≈ 4.6 kW | Charging | Receives increased PV surplus | Supplied continuously |
Around 5 s | High PV generation | Charging adjusts | Constant-power mode becomes active | Load falls below 1.5 kW threshold |
Later load switching | Nearly high PV level | Compensates power mismatch | Power remains regulated | Load changes dynamically |
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
The MATLAB/Simulink results demonstrate successful coordinated operation of the complete system.
1. PV Power
Initially, the PV array generates approximately 1.2 kW.
As irradiation increases:
1.2 kW → 2.4 kW → approximately 4.6 kW
This confirms successful maximum-power extraction by the P&O MPPT-controlled boost converter.
2. Grid Power
During low PV generation, the utility grid supplies the remaining power required by the load.
When PV generation becomes greater than the local demand, the power-flow direction changes and the grid begins to receive surplus renewable power.
After the load power falls below the predefined 1500 W threshold, the controller maintains the grid operation close to the commanded constant-power condition.
3. Battery Power and Current
The battery current remains relatively low during the initial period.
After approximately 2 seconds, surplus energy becomes available and the battery enters charging mode.
As the PV power rises further, the charging condition continues while the grid also receives surplus energy.
4. Battery State of Charge
The initial battery SOC is approximately 50%.
Once battery charging starts, the SOC gradually increases.
The increasing SOC waveform confirms that surplus power is being successfully stored in the battery.
5. DC-Link Voltage
The DC-link initially experiences a short transient.
After the control system settles, it is maintained close to its 360 V reference despite changes in PV power and load demand.
This verifies the effectiveness of the battery-side cascaded voltage-current controller.
6. PV Current
PV current varies according to solar irradiation.
When irradiation changes from:
300 → 700 → 1000 W/m²
the available PV current increases accordingly.
This is reflected directly in the increasing PV power.
7. Grid Voltage and Grid Current
The grid voltage remains sinusoidal at the PCC.
Grid current changes according to the direction and magnitude of the required grid power.
This demonstrates controlled energy exchange between the DC-side renewable sources and the AC utility network.
8. Load Current
The load-current waveform clearly shows the switching of different load levels.
Typical variations are approximately:
10 A → 5 A → 7–7.5 A → 5 A
The power-management controller responds to these changes without interrupting the load supply.
𝐏𝐨𝐰𝐞𝐫 𝐅𝐥𝐨𝐰 𝐀𝐧𝐚𝐥𝐲𝐬𝐢𝐬
The most important behavior of the system can be summarized as follows:
Power Condition | PV | Battery | Grid |
PV power lower than demand | Supplies available renewable power | Supports according to control requirement | Supplies deficit |
PV close to load demand | Supplies major load portion | Near transition condition | Grid power reduces |
PV greater than demand | Supplies load and surplus | Charges | Receives surplus |
Load suddenly decreases | PV continues MPPT operation | Absorbs power difference | Constant-power control can be maintained |
Irradiance increases | PV generation increases | Charging level changes | Exported grid power increases |
This coordinated operation is the main advantage of integrating energy storage with a grid-connected PV system.
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
4.6 kW-class solar PV system
P&O MPPT for maximum PV power extraction
Boost-converter-based PV interface
240 V battery energy storage
Bidirectional battery converter
Cascaded DC-link voltage and battery-current control
360 V regulated DC bus
Single-phase grid-connected inverter
Grid-voltage synchronization
Nonlinear and dynamically varying load
Bidirectional grid power exchange
Battery charging during surplus PV generation
Automatic power balancing
1500 W load-power threshold
Constant grid-power operating mode
Multiple irradiation conditions
Multiple load-switching conditions
PV, grid, battery and load power monitoring
Battery SOC analysis
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This MATLAB/Simulink model is useful for studying:
Grid-connected solar PV systems
PV–battery energy management
Smart-grid power-flow control
Renewable energy integration
Battery charging and discharging control
DC-link voltage regulation
Single-phase grid-connected converters
Nonlinear load behavior
Variable load power management
Constant grid-power operation
Distributed energy resources
Residential solar energy systems
Microgrid energy management
Renewable-powered uninterrupted supply systems
Advanced converter and inverter control research
𝐖𝐡𝐲 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥 𝐢𝐬 𝐔𝐬𝐞𝐟𝐮𝐥
Unlike a basic grid-connected PV model, this configuration demonstrates several operating conditions simultaneously.
It helps students, researchers, and engineers understand how:
PV generation changes → DC-link controller responds → battery power changes → inverter power changes → grid power changes → load continues receiving power.
It also demonstrates why battery storage is important in a renewable-energy system. The battery acts as an energy buffer and supports the DC bus whenever there is a mismatch between PV generation, load demand and grid-power command.
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The Grid Connected PV Battery with Nonlinear Load in MATLAB/Simulink model demonstrates effective integration of solar generation, battery energy storage, variable load demand and utility-grid interaction.
The P&O MPPT controller successfully extracts the available PV power as irradiation changes from 300 to 700 and 1000 W/m². The bidirectional battery converter regulates the common DC bus at approximately 360 V while enabling controlled battery charging.
As PV generation rises from approximately 1.2 kW to 2.4 kW and finally about 4.6 kW, the system smoothly changes from grid-supported operation to surplus renewable-power operation. The excess PV energy is used for battery charging and grid power export.
The model also demonstrates a useful constant grid-power strategy based on a 1500 W load-power threshold, allowing stable grid interaction even when the connected load varies.
Overall, the simulation provides a clear platform for understanding PV MPPT, battery energy management, DC-link regulation, grid synchronization, inverter current control, nonlinear load operation, and bidirectional power flow in modern grid-connected renewable energy systems.



Comments