Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Experiment-4 Experiment of solar Charge controller, PWM, MPPT with boost converter and

algorithms.

let's break down the MATLAB code step by step:

Defining Parameters:

 Voc and Isc: Open circuit voltage and short circuit current of the solar panel respectively.
 L, C, and R: Parameters of the boost converter - inductor value, capacitor value, and load
resistance respectively.
 Vref and fs: Parameters of the PWM controller - reference voltage and switching frequency
respectively.
 Vmppt: Initial guess for the maximum power point tracking (MPPT) voltage.
 t: Simulation time vector from 0 to 0.1 seconds with a time step of 1e-6 seconds.

Initialization:

Initialize the storage for the output voltage Vo with zeros to store the results of the simulation.

Simulation Loop:

 Iterate over each time step in the simulation time vector t.


 Calculate the voltage generated by the solar panel Vpv using an exponential decay model.
 Adjust the MPPT voltage Vmppt based on the difference between Vpv and Vmppt using a
perturb and observe algorithm.
 Calculate the duty cycle of the PWM signal based on the reference voltage Vref and the actual
solar panel voltage Vpv.
 Pass the calculated duty cycle to the boost converter function boost_converter along with other
parameters and obtain the output voltage Vo.
 Store the output voltage Vo at each time step.

Plotting:

 After the simulation loop completes, plot the output voltage Vo against time t.
 Add labels to the axes and a title to the plot.

Boost Converter Function:

 The function boost_converter takes the input voltage Vin, inductor value L, load resistance R,
duty cycle, and time t as arguments.
 It calculates the average input voltage Vin_avg based on the duty cycle.
 It computes the output voltage Vo of the boost converter based on the boost converter model.
 Overall, this code simulates a solar charge controller system with PWM control, MPPT
algorithm, and a boost converter, and plots the output voltage over time.

Matlab Code

% Experiment of Solar Charge Controller with PWM, MPPT, and Boost Converter
% Solar Panel Parameters
Voc = 22; % Open Circuit Voltage (V)
Isc = 5; % Short Circuit Current (A)
% Boost Converter Parameters
L = 5e-3; % Inductor value (H)
C = 1e-3; % Capacitor value (F)
R = 10; % Load resistance (ohms)
% PWM Controller Parameters
Vref = 20; % Reference voltage for PWM (V)
fs = 1e3; % Switching frequency (Hz)
% MPPT Algorithm (Perturb and Observe)
Vmppt = 18; % Initial guess for MPPT voltage (V)
% Simulation Time
t = 0:1e-6:0.1;
% Initialize storage for Vo
Vo = zeros(size(t));
% Simulation Loop
for i = 1:length(t)
% Solar Panel Model
Vpv = Voc - (Isc * R) * exp(-t(i) / (R * C));
% MPPT Algorithm (Perturb and Observe)
dV = Vpv - Vmppt;
if dV > 0
Vmppt = Vmppt + 0.01;
else
Vmppt = Vmppt - 0.01;
end
% Calculate duty cycle based on PWM
duty_cycle = Vref / Vpv;
% Boost Converter
Vo(i) = boost_converter(Vpv, L, C, R, duty_cycle, fs, t(i));
end
% Plotting
plot(t, Vo);
xlabel('Time (s)');
ylabel('Output Voltage (V)');
title('Solar Charge Controller Experiment');
% Boost Converter Function
function Vo = boost_converter(Vin, L, ~, R, duty_cycle, ~, t)
% Boost converter model
Vin_avg = Vin * duty_cycle;
Vo = Vin_avg * (1 - exp(-t / (L * R))) / (1 - duty_cycle);
end

Results
The result of the MATLAB simulation is a plot showing the output voltage of the solar charge
controller system over time. Here's an explanation of what the plot represents and why it looks the
way it does:

Initial Behavior:
At the beginning of the simulation, the output voltage Vo starts from zero because there's no input
voltage from the solar panel until the simulation starts.

Solar Panel Response:


As time progresses, the solar panel generates voltage Vpv based on the exponential decay model.
This voltage increases gradually towards its open circuit voltage (Voc) as the simulation progresses.

MPPT Algorithm Adjustment:


The MPPT algorithm (Perturb and Observe) continuously adjusts the MPPT voltage (Vmppt) based
on the difference between the generated solar panel voltage (Vpv) and the guessed MPPT voltage
(Vmppt). This adjustment aims to maximize the power output of the solar panel by tracking the
maximum power point.

PWM Control and Boost Converter:


The duty cycle of the PWM signal is calculated based on the reference voltage (Vref) and the actual
solar panel voltage (Vpv). This duty cycle controls the operation of the boost converter.
The boost converter then converts the varying input voltage from the solar panel into a stable output
voltage (Vo) suitable for charging a battery or powering a load.

Stabilization:
As the simulation progresses, the output voltage Vo stabilizes to a certain level determined by the
boost converter parameters (L, C, R) and the control algorithms (MPPT and PWM).

End of Simulation:
The plot shows the behavior of the output voltage over the entire simulation time (0.1 seconds in this
case).

Overall, the plot demonstrates the dynamic behavior of the solar charge controller system as it
adjusts its parameters to efficiently harvest energy from the solar panel and provide a stable output
voltage. The specific shape and characteristics of the plot will vary depending on the exact
parameters and conditions of the simulation.

You might also like