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

40 ビュー (過去 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 Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by