필터 지우기
필터 지우기

I am trying to solve current equations of a pv cell using fsolve butit keeps showing error, can someone pls see what the error in my code is?

조회 수: 2 (최근 30일)
Here is the main code:
clc;
clear all;
Pmpp = 50; %Max Power
Vmpp = 17.98; %Vol at Pmax
Impp = 2.77; %Current at Pmax
Isc= 3; %Short-circuit current
Voc= 22; %Open Circuit Voltage
a= 0.0004; %Temp coeff. of Isc
b= -0.0033; %Temp coeff. of Voc
T = 35;
Tref= 25;
S= 600;
Sref= 1000;
Rs= 0.085;
V= 30;
kref= (1-(Impp/Isc))^(1/(((Vmpp+Rs*Impp)/Voc)-1));
Vo = Voc*(1+ a*log(S/Sref)+ b*(T-Tref));
I= zeros(330,1);
Is = Isc*(1+a*(T-Tref))*(S/Sref);
for i = 1:330
V(i)= (i-1)*0.1;
fhandle = @fun4bisec;
[I]= fsolve(@(I) fhandle(I,V(i)));
y(i)= I;
end
plot(V,y),grid,hold on;
xlabel('Voltage'),ylabel('Current');
The code for function fun4bisec is:
function fval1= fun4bisec(Is,kref, Vo,Rs, Voc)
fval1= I(i) -Is*(1-kref.^((V(i)-Vo+Rs*I(i))/Voc));
end

채택된 답변

Torsten
Torsten 2023년 3월 14일
clc;
clear all;
Pmpp = 50; %Max Power
Vmpp = 17.98; %Vol at Pmax
Impp = 2.77; %Current at Pmax
Isc= 3; %Short-circuit current
Voc= 22; %Open Circuit Voltage
a= 0.0004; %Temp coeff. of Isc
b= -0.0033; %Temp coeff. of Voc
T = 35;
Tref= 25;
S= 600;
Sref= 1000;
Rs= 0.085;
V= 30;
kref= (1-(Impp/Isc))^(1/(((Vmpp+Rs*Impp)/Voc)-1));
Vo = Voc*(1+ a*log(S/Sref)+ b*(T-Tref));
y= zeros(330,1);
Is = Isc*(1+a*(T-Tref))*(S/Sref);
I0 = 1.0;
for i = 1:330
V(i)= (i-1)*0.1;
fhandle = @fun4bisec;
[I]= fsolve(@(I) fhandle(I,V(i),kref, Vo,Rs, Voc),I0,optimset('Display','none'));
y(i)= I;
I0 = I;
end
plot(V,y),grid,hold on;
xlabel('Voltage'),ylabel('Current');
function fval1= fun4bisec(Is,V,kref, Vo,Rs, Voc)
fval1= Is -Is*(1-kref.^((V-Vo+Rs*Is)/Voc));
end

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by