Fuzzy Energy Management in Grid Connected PV Battery System in MATLAB
Fuzzy Energy Management in Grid Connected PV Battery System in MATLAB
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
A grid-connected solar PV system with battery energy storage requires an intelligent control method to manage power flow between the PV array, battery, DC bus, AC load, and utility grid.
Fuzzy Energy Management in Grid Connected PV Battery System

This MATLAB/Simulink model uses a Fuzzy Logic Energy Management System to determine the inverter current reference according to:
Solar PV power availability
Battery state of charge
Power transfer requirement
Grid import and export conditions
The complete system also includes:
Incremental Conductance MPPT
Boost converter
Bidirectional battery DC–DC converter
400 V DC-link regulation
Grid-connected full-bridge inverter
LCL filter
PLL-based synchronization
d-q current control
Fuzzy Logic Controller
Grid import/export operation
The model is useful for students, researchers, and engineers who want to understand intelligent energy management in grid-connected renewable energy systems using MATLAB/Simulink.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The overall system consists of five major sections:
Solar PV generation system
PV boost converter with MPPT
Battery energy storage with bidirectional converter
Fuzzy energy management controller
Grid-connected inverter with LCL filter
Main Power Flow
The battery is connected directly to the common DC bus through a bidirectional DC–DC converter.
Depending on PV generation and battery SOC, the system can:
Supply solar power to the AC side
Charge the battery
Discharge the battery
Export excess power to the grid
Import power from the grid
Maintain the DC-link voltage
𝐏𝐕 𝐀𝐫𝐫𝐚𝐲 𝐂𝐨𝐧𝐟𝐢𝐠𝐮𝐫𝐚𝐭𝐢𝐨𝐧
The solar PV source uses eight modules in series per string and two parallel strings.
Parameter | Value |
Power rating of one PV module | 250 W |
Voltage near maximum power point per module | 30.7 V |
Modules connected in series | 8 |
Parallel strings | 2 |
Power per string | 2000 W |
Total PV rated power | 4000 W |
PV string operating voltage | ≈245.6 V |
DC bus voltage | 400 V |
Therefore, the PV system is designed to generate approximately 4 kW under rated irradiance conditions.
𝐏𝐕 𝐁𝐨𝐨𝐬𝐭 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The PV voltage is lower than the required DC-link voltage. Therefore, a boost converter is used between the PV array and the DC bus.
Boost Converter Specifications
Parameter | Value |
PV rated power | 4000 W |
Input voltage | ≈245.6 V |
Required DC output | 400 V |
Switching frequency | 10 kHz |
Converter type | DC–DC Boost Converter |
The converter inductor and capacitor are selected based on these operating requirements.
The calculated component values are then implemented directly in the Simulink boost converter.
𝐈𝐧𝐜𝐫𝐞𝐦𝐞𝐧𝐭𝐚𝐥 𝐂𝐨𝐧𝐝𝐮𝐜𝐭𝐚𝐧𝐜𝐞 𝐌𝐏𝐏𝐓
The solar PV system uses an Incremental Conductance MPPT algorithm.
Inputs
PV voltage
PV current
Output
Duty cycle for the boost converter
The controller continuously monitors PV voltage and current and adjusts the duty cycle to operate the PV array close to its maximum power point.
MPPT Control Flow
PV Voltage + PV Current → Incremental Conductance MPPT → Duty Cycle → PWM Generator → Boost Converter
This allows the PV array to extract maximum available power even when solar irradiance changes.
𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐄𝐧𝐞𝐫𝐠𝐲 𝐒𝐭𝐨𝐫𝐚𝐠𝐞
The battery is connected to the 400 V DC bus through a bidirectional DC–DC converter.
Parameter | Value |
Battery voltage | 240 V |
DC bus voltage | 400 V |
Converter power design level | Based on system power requirement |
Switching frequency | 10 kHz |
Power flow | Bidirectional |
The bidirectional converter supports:
Battery charging
Battery discharging
DC-link voltage support
Grid-assisted charging
𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫 𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The battery converter is controlled using the DC-link voltage.
Control Sequence
DC Bus Voltage → Compare with 400 V → Voltage Error → PI Controller → Duty Cycle → PWM Generator → Bidirectional Converter
The reference DC voltage is:
400 V
If the DC-link voltage decreases, the battery or grid can supply additional power.
If the DC-link has excess energy, the battery can absorb power depending on the energy management command.
The primary objective is to keep the DC bus close to 400 V under changing power conditions.
𝐆𝐫𝐢𝐝-𝐂𝐨𝐧𝐧𝐞𝐜𝐭𝐞𝐝 𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫
A full-bridge inverter connects the DC bus to the AC system.
The inverter is designed for the combined PV and battery power requirement.
Parameter | Value |
PV power | 4 kW |
Battery contribution considered | 1 kW |
Inverter design power | 5 kW |
DC-link voltage | 400 V |
Grid voltage | 230 V |
Grid frequency | 50 Hz |
Inverter switching frequency | 7.5 kHz |
Output filter | LCL filter |
The LCL filter reduces switching-frequency harmonics before the inverter current reaches the point of common coupling.
𝐋𝐂𝐋 𝐅𝐢𝐥𝐭𝐞𝐫
The inverter output uses an LCL filter consisting of:
Inverter-side inductor
Filter capacitor
Grid-side inductor
The filter components are selected considering:
5 kW inverter power
400 V DC bus
230 V AC grid
50 Hz fundamental frequency
7.5 kHz switching frequency
The LCL filter helps obtain a clean sinusoidal grid current with reduced high-frequency ripple.
𝐅𝐮𝐳𝐳𝐲 𝐄𝐧𝐞𝐫𝐠𝐲 𝐌𝐚𝐧𝐚𝐠𝐞𝐦𝐞𝐧𝐭
The main intelligent part of the model is the Fuzzy Logic Energy Management System.
The fuzzy controller decides how much inverter current should flow and in which direction.
Fuzzy Controller Inputs
PV power
Battery SOC
Fuzzy Controller Output
Inverter current reference
𝐏𝐞𝐫-𝐔𝐧𝐢𝐭 𝐈𝐧𝐩𝐮𝐭 𝐒𝐜𝐚𝐥𝐢𝐧𝐠
Before applying the signals to the fuzzy controller, they are normalized.
Signal | Actual Range | Fuzzy Range |
PV power | 0–4000 W | 0–1 pu |
Battery SOC | 0–100% | 0–1 pu |
Current reference | — | −1.3 to +1.3 |
This normalization makes fuzzy membership-function design easier and improves controller implementation.
𝐅𝐮𝐳𝐳𝐲 𝐌𝐞𝐦𝐛𝐞𝐫𝐬𝐡𝐢𝐩 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬
PV Power Membership Functions
PV power is divided into approximately four operating levels:
Zero
Small
Medium
Big
Battery SOC Membership Functions
Battery SOC is divided into five levels:
Zero
Small
Medium
Big
Very Big
Output Current Reference
The fuzzy output represents the required direction and magnitude of power transfer.
Typical linguistic levels include:
Negative Big
Negative Medium
Zero
Positive Medium
Positive Big
𝐌𝐞𝐚𝐧𝐢𝐧𝐠 𝐨𝐟 𝐭𝐡𝐞 𝐅𝐮𝐳𝐳𝐲 𝐎𝐮𝐭𝐩𝐮𝐭
The sign of the current reference is important.
Fuzzy Output | Power Flow Meaning |
Large positive | Strong power transfer from DC side toward AC/grid side |
Small positive | Moderate export from DC side |
Near zero | Nearly balanced operating condition |
Small negative | Moderate power import from grid |
Large negative | Strong grid power import |
For example:
High PV + High SOC → Positive current reference
Low PV + Low SOC → Negative current reference
Medium PV + Medium SOC → Current reference near zero
This allows the system to automatically select grid import or export operation.
𝐄𝐱𝐚𝐦𝐩𝐥𝐞 𝐅𝐮𝐳𝐳𝐲 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐧𝐠 𝐋𝐨𝐠𝐢𝐜
PV Condition | Battery SOC | Current Command | Typical Operation |
Very low | Very low | Large negative | Import power from grid |
Low | Medium | Negative | Grid-assisted supply/charging |
Medium | Medium | Near zero | Balanced operation |
High | High | Positive | Export available power |
Very high | Very high | Large positive | Maximum grid-side power transfer |
The exact current reference varies continuously according to the fuzzy rule surface.
𝐈𝐧𝐯𝐞𝐫𝐭𝐞𝐫 𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐑𝐞𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐨𝐧
The fuzzy controller produces a DC-valued reference quantity.
This signal is scaled and combined with a synchronized sinusoidal waveform to produce an AC current reference.
Reference Generation Process
PV Power + SOC → Fuzzy Controller → Current Magnitude → Sinusoidal Reference → d-q Transformation
The resulting d-axis and q-axis current references are then used by the inverter current controller.
𝐏𝐋𝐋 𝐚𝐧𝐝 𝐆𝐫𝐢𝐝 𝐒𝐲𝐧𝐜𝐡𝐫𝐨𝐧𝐢𝐳𝐚𝐭𝐢𝐨𝐧
The measured grid voltage is supplied to a Phase-Locked Loop.
The PLL provides:
Grid angle
Sine reference
Cosine reference
Synchronization information
This ensures that the inverter current remains synchronized with the utility voltage.
The system operates at approximately:
50 Hz
𝐝-𝐪 𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The measured grid current is converted into the d-q reference frame.
Control Process
Measure grid current.
Convert current into d-q components.
Compare measured d-q currents with reference currents.
Process errors through current controllers.
Generate d-q control signals.
Convert the commands back to the stationary frame.
Generate PWM pulses.
Control the inverter switches.
This closed-loop structure allows bidirectional inverter current control.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The complete operation can be understood in the following sequence:
PV panels generate DC power according to solar irradiance.
Incremental Conductance MPPT calculates the required boost duty cycle.
The boost converter raises the PV voltage to the 400 V DC bus.
The battery bidirectional converter supports DC-link regulation.
PV power and battery SOC are normalized.
The normalized signals are supplied to the fuzzy controller.
Fuzzy logic generates the inverter current reference.
The PLL synchronizes the control system with the grid.
The current controller regulates the inverter current.
The LCL filter removes high-frequency switching components.
Power is exchanged between the PV-battery system and the grid according to operating conditions.
𝐈𝐫𝐫𝐚𝐝𝐢𝐚𝐧𝐜𝐞 𝐕𝐚𝐫𝐢𝐚𝐭𝐢𝐨𝐧
The simulation tests the PV system under changing irradiance.
A representative test pattern is:
Irradiance | Approximate PV Output |
1000 W/m² | 4000 W |
500 W/m² | 2000 W |
Very low irradiance | Close to 0 W |
500 W/m² | 2000 W |
1000 W/m² | 4000 W |
This test demonstrates whether the MPPT, battery controller, and fuzzy energy management system can respond correctly to rapidly changing PV generation.
𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧 𝐔𝐧𝐝𝐞𝐫 𝐕𝐚𝐫𝐲𝐢𝐧𝐠 𝐏𝐕 𝐏𝐨𝐰𝐞𝐫
The battery changes between charging and discharging depending on PV availability and the fuzzy control decision.
Approx. Simulation Interval | PV Condition | Battery Behavior |
0–0.6 s | PV available | Charging |
0.6–0.9 s | PV close to zero | Discharging |
0.9–1.5 s | PV power returns | Charging |
When PV generation decreases significantly, stored battery energy can support the system.
When sufficient PV energy becomes available, the battery can return to charging operation.
𝐋𝐨𝐰 𝐁𝐚𝐭𝐭𝐞𝐫𝐲 𝐒𝐎𝐂 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧
An additional operating condition is tested with the battery SOC set close to 10%.
Under this condition:
The fuzzy controller detects low battery energy.
The inverter current reference becomes negative.
Power is imported from the utility grid.
The battery operates mainly in charging mode.
SOC gradually increases.
Grid support continues even when PV generation becomes very low.
This demonstrates one of the main advantages of fuzzy energy management: automatic power-flow decision making without manually changing operating modes.
𝐆𝐫𝐢𝐝 𝐈𝐦𝐩𝐨𝐫𝐭 𝐚𝐧𝐝 𝐄𝐱𝐩𝐨𝐫𝐭
The voltage-current phase relationship indicates the direction of active power transfer.
Export Condition
When sufficient PV and battery energy are available:
Current flows from the inverter toward the AC side.
Power can be supplied to the AC load and grid.
Grid voltage and current follow the corresponding export relationship.
Import Condition
When PV power and battery SOC are low:
Power is obtained from the utility grid.
Grid current direction reverses.
A phase reversal can be observed between the measured voltage and current according to the selected current sign convention.
Imported power can support the DC bus and battery charging.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
The model monitors several important electrical quantities.
PV Measurements
PV voltage
PV current
PV power
PV output follows the applied solar irradiance changes and reaches approximately 4 kW at 1000 W/m².
DC-Link Measurements
DC-link voltage
Converter response
Voltage settling
After the initial transient, the voltage-control system maintains the DC bus near 400 V.
Battery Measurements
Battery voltage
Battery current
Battery SOC
Charging/discharging status
The battery automatically changes its power direction according to PV generation and energy management requirements.
Grid Measurements
Grid voltage
Grid current
Active power
Power-flow direction
The inverter produces sinusoidal grid current and supports both power import and export.
Frequency
The system frequency remains close to:
50 Hz
even when PV irradiance and battery operating conditions change.
𝐌𝐚𝐢𝐧 𝐌𝐨𝐧𝐢𝐭𝐨𝐫𝐞𝐝 𝐒𝐢𝐠𝐧𝐚𝐥𝐬
Scope/Measurement | Signals |
PV scope | PV voltage, current, power |
DC bus scope | DC-link voltage |
Battery scope | Battery voltage and current |
Energy scope | PV power, load power, SOC, grid power |
Grid scope | Grid voltage and current |
PCC measurement | Point-of-common-coupling variables |
Frequency scope | Grid frequency |
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
4 kW solar PV array
Eight PV modules in series per string
Two parallel PV strings
Incremental Conductance MPPT
400 V regulated DC bus
Battery energy storage
Bidirectional battery DC–DC converter
Fuzzy Logic Energy Management System
PV power and SOC based decision making
Grid import and export operation
Full-bridge grid-connected inverter
LCL output filter
PLL synchronization
d-q current control
Bidirectional active-power flow
Dynamic irradiance testing
Low-SOC grid charging operation
50 Hz grid-frequency operation
𝐖𝐡𝐲 𝐔𝐬𝐞 𝐅𝐮𝐳𝐳𝐲 𝐋𝐨𝐠𝐢𝐜 𝐟𝐨𝐫 𝐄𝐧𝐞𝐫𝐠𝐲 𝐌𝐚𝐧𝐚𝐠𝐞𝐦𝐞𝐧𝐭?
Fuzzy logic is suitable for hybrid renewable energy systems because the controller can make decisions based on operating ranges rather than relying only on fixed switching thresholds.
Major advantages include:
Easy implementation of expert control rules
Smooth transition between operating conditions
Suitable for nonlinear renewable energy systems
Handles fluctuating PV generation
Handles varying battery SOC
Supports automatic grid import/export decisions
Reduces the need for multiple manually selected operating modes
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This type of MATLAB/Simulink model is useful for studying:
Grid-connected solar PV systems
PV-battery energy management
Battery charging and discharging control
Smart inverter control
Renewable energy integration
Grid-supporting battery systems
Bidirectional power conversion
Intelligent microgrid control
Fuzzy Logic Controller development
MPPT controller analysis
Grid current regulation
Energy storage integration
𝐖𝐡𝐚𝐭 𝐂𝐚𝐧 𝐁𝐞 𝐋𝐞𝐚𝐫𝐧𝐞𝐝 𝐟𝐫𝐨𝐦 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥?
By studying the complete simulation, users can understand:
How to size a PV boost converter
How a bidirectional battery converter operates
How a 400 V DC bus is regulated
How Incremental Conductance MPPT works in Simulink
How PV power and SOC are normalized
How fuzzy membership functions are selected
How fuzzy rules determine grid current
How a PLL synchronizes an inverter with the grid
How d-q current controllers regulate inverter output
How an LCL filter interfaces the inverter with the AC grid
How grid power direction changes during charging and discharging
How battery SOC influences energy management
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The Fuzzy Energy Management in Grid Connected PV Battery System in MATLAB demonstrates a complete intelligent renewable-energy power management structure.
A 4 kW PV array is connected to a 400 V DC bus through an Incremental Conductance MPPT controlled boost converter. A battery energy storage system is integrated through a bidirectional DC–DC converter, while a full-bridge inverter connects the DC system to the 230 V, 50 Hz grid.
The fuzzy energy management controller uses PV power and battery SOC to determine the inverter current reference. As a result, the system can automatically change between grid import, balanced operation, battery support, and grid export.
The simulation clearly demonstrates MPPT control, battery charging and discharging, DC-link regulation, intelligent energy management, grid synchronization, and bidirectional power flow within a single MATLAB/Simulink environment.



Comments