clc
clear all
alpha=0.015;belta=0.7;Rs=2;Tref=28;Rref=1000;Umax=390;Imax=26;Uoc=506;Isc=30;
Ta=25;tc=0.008;
C2=(Umax/Uoc-1)/(log(1-Imax/Isc));
C1=(1-Imax/Isc)*exp(-Umax/C2/Uoc);
K=10;
L=520;
for i=1:K
R(i)=i*100;
Tc(i)=Ta+tc*R(i);
DT(i)=Tc(i)-Tref;
DI(i)=alpha*R(i)/Rref*DT(i)+(R(i)/Rref-1)*Isc;
DV(i)=-belta*DT(i)-Rs*DI(i);
for j=1:L
U(i,j)=j;
I(i,j)=Isc*(1-C1*(exp((U(i,j)-DV(i))/C2/Uoc)-1))+DI(i);
P(i,j)=U(i,j)*I(i,j);
end
end
for i=1:K
for j=1:L
M(j)=U(i,j);
N(j)=P(i,j);
end
plot(M,N,'k');
hold on;
end
i=1;
n=0;
while (i<=K)
R=i*100;
Tc=Ta+tc*R;
DT=Tc-Tref;
DI=alpha*R/Rref*DT+(R/Rref-1)*Isc;
DV=-belta*DT-Rs*DI;
U1=220;
U2=U1+10;
I1=Isc*(1-C1*(exp((U1-DV)/C2/Uoc)-1))+DI;
P1=U1*I1;
I2=Isc*(1-C1*(exp((U2-DV)/C2/Uoc)-1))+DI;
P2=U2*I2;
deltaP=P2-P1;
while (abs(deltaP)>=0.01)
temp=U2;
U2=U2+0.95*deltaP/(U2-U1);
U1=temp;
I1=Isc*(1-C1*(exp((U1-DV)/C2/Uoc)-1))+DI;
P1=U1*I1;
I2=Isc*(1-C1*(exp((U2-DV)/C2/Uoc)-1))+DI;
P2=U2*I2;
deltaP=P2-P1;
n=n+1;
if n>=8500
break
end
end
PP(i)=P2;
UU(i)=U2;
i=i+1;
end
hold on;
for i=1:K
plot(UU,PP,'*k');
hold on;
plot(UU,PP,'-.k');
end
n
hold on;
axis([0 520 0 11000]);
grid on;
xlabel('\fontname{times new roman}\fontsize{10}{光伏阵列输出电压(V)}');
ylabel('\fontname{times new roman}\fontsize{10}{光伏阵列输出功率(W)}');
% legend('\fontname{宋体}\fontsize{7}{环境温度25℃}');
%title('\fontname{宋体}\fontsize{10}{光伏阵列P-U特性曲线}');