I have been trying to code a solar pv module for 1 diode model, the following is my code, can someone tell me the mistake ive made and the correction to it pls.

1 view (last 30 days)
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 = 28;
Tref= 25;
S= 800;
Sref= 1000;
Rs= 0.085;
V= 20;
kref= (((Vmpp+Rs*Impp)/Voc)-1)*(1-(Impp/Isc))^0.5;
Vo = Voc*(1+ a*log(S/Sref)+ b*(T-Tref));
I= zeros(330,1);
i=1;
I(1,1)=0;
for V= 32.9:-0.1:0
Is = Isc*(1+a(T-Tref))*(S/Sref);
I(i,1)= Isc(1-kref.^((V-Voc+Rs*I)/Voc));
i=i+1;
end

Accepted Answer

Alan Stevens
Alan Stevens on 3 Mar 2023
Like this? Note: I've made kref positive to avoid the I's being complex. This might be completely incorrect!!
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 = 28;
Tref= 25;
S= 800;
Sref= 1000;
Rs= 0.085;
V= 20;
kref= -(((Vmpp+Rs*Impp)/Voc)-1)*(1-(Impp/Isc))^0.5; %%%% Made kref positive
Vo = Voc*(1+ a*log(S/Sref)+ b*(T-Tref));
I= zeros(330,1);
for i = 1:330
V(i)= (i-1)*0.1;
Is = Isc*(1+a*(T-Tref))*(S/Sref); %%%% a*(T-Tref)
I(i)= Isc*(1-kref.^((V(i)-Voc+Rs*I(i))/Voc)); %%%% Isc*(1-etc. and I(i)
end
plot(V,I),grid
xlabel('V'),ylabel('I')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!