My matlab code for PV P&O tracking algorithm has an error

조회 수: 38 (최근 30일)
Jirada Gosumbonggot
Jirada Gosumbonggot 2017년 11월 23일
댓글: MUSTAFA MOHAMMED 2021년 5월 29일
Hello
I'm writing the code for P&O tracking as I want the output to be Power and Voltage where the max point is located. From the figure, I expected the max power to be at 51.53 W at 16.32 V.
But when I run the code, it always gives the result to the open-circuit voltage (last point of the curve) which is not correct, it gives me the result of 30.01 W at 19 V.
The code that I write is here, not sure I've done something wrong or not (I'm pretty new to matlab). The outputs are P and Vmpp
function [Vmpp,P] = PandO(V,I)
persistent Vold Pold Iold dV dI dP Power;
if isempty(Vold)
Vold =0; Iold = 0;
Pold = 0; dV = 0; dI = 0; dP = 0; Power = zeros(1000,1);
end
deltaV = 0.0001; % initialize
for i = 1:size(V,1)
Power(i) = V(i) .* I(i);
dV = V(i) - Vold;
dI = I(i) - Iold;
dP = Power(i) - Pold;
if dP ~= 0
if dP < 0
if dV <0
Vmpp = V(i) + deltaV;
else
Vmpp = V(i) - deltaV;
end
else
if dV < 0
Vmpp = V(i) - deltaV;
else
Vmpp = V(i) + deltaV;
end
end
else
Vmpp = V(i);
P = Power(i);
break
end
Vold = V(i);
Iold = I(i);
Pold = V(i).*I(i);
end
end
Any suggestion for me? thank you so much in advance

답변 (3개)

Roshan Reji
Roshan Reji 2019년 10월 21일
Did you find the solution please reply asap. I have the same problem.

mehmet salih fidaner
mehmet salih fidaner 2020년 1월 9일
Did you find the solution please reply asap. I have the same problem.
  댓글 수: 1
VENKATA ARAVINDA SATVIK MUVVALA
VENKATA ARAVINDA SATVIK MUVVALA 2020년 1월 10일
if you find any solution, please comment here ASAP. I also have same problem.

댓글을 달려면 로그인하십시오.


M.Saud Khan
M.Saud Khan 2020년 1월 26일
I think the problem is in deltaV. For some reason, my simulation worked with deltaV = 0.04. Decreasing below this value, resulted in Vmpp = open circuit voltage. I have disabled the "zero crossings" in the solver settings & simulated the system using ode23t solver (my system used power electronics blocks; ode23t & ode23tb are mostly used with power electronic blocks).
I'm not a fan of using array indexing & for-loops inside the simulink MATLAB function block. That's why I used the following code:
function [step, flag,Vmpp] = fcn(V,V_old, P,P_old)
flag = 5; % Arbitrary
Vmpp = 35; % Arbitrary
dV = 0.04;
% persistent Pold Vold dV
if isempty(V_old) || isempty(P_old)
V_old = 30; P_old = 800; % Initial conditions
end
delta_P = P - P_old;
delta_V = V - V_old;
if delta_P > 0
flag = 1;
if delta_V > 0
Vmpp = V + dV; % Increase voltage
elseif delta_V < 0
Vmpp = V - dV; % Decrease voltage
end
elseif delta_P < 0
flag = -1;
if delta_V > 0
Vmpp = V - dV; % Decrease voltage
elseif delta_V < 0
Vmpp = V + dV; % Increase voltage
end
elseif delta_P == 0
flag = 0;
Vmpp = V;
end
step = dV;
end
For V_old & P_old, I used the delay block & to produce the gate signal (duty ratio) of a MOSFET/IGBT, I used a PI controller. The PI gains were selected by hit & trial. All of this is in the picture below:
Capture.PNG
I have used a flag variable to note the state of delta_P. Results are not very accurate, however, it is working for me..
Hope this helps somebody..
  댓글 수: 8
At?l COSGUN
At?l COSGUN 2021년 1월 15일
Could you pls mail me your this study. My mail adress is atilcosgun@gmail.com
MUSTAFA MOHAMMED
MUSTAFA MOHAMMED 2021년 5월 29일
can you plese mail me daldoulmustafa3@gmail.com

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by