Please help me..Question on m-file and simulink

1 view (last 30 days)
With reference to the paper ( http://www.imeko2009.it.pt/Papers/FP_622.pdf ), I have written a matlab code..I got IV and PV curves. But when I change the temperature(TaC) value,I'm getting negative values for the PV curve.What might be the problem?Can anyone suggest me?
And Also I want to model a simulink model of the PV array.Could anyone please please help me.
k = 1.381e-23; % Boltzmann constant, J/K
q=1.602e-19; % Electronic charge, C
N= 1.2; % Diode quality facror
Vg=1.12;%Band gap voltage,V
Ns=60; % Number of cells in series
% T1=0+273;% Temperature for which values are known
TaC= 25;% TaC Temperature for which values have to be found
Voc=36.6; %Open circuit voltage, V
Isc=8.3;%Short circuit current,
Ir0=1000;% Irradiance,W/m^2
T1=273+25;
Vt=k*T1/q;
%Calculation of Iph
Voc_T1=36.6/Ns;
TK=TaC+273;
K0=0.0008; %Temperature coefficient of Isc
Ir=1000;
Iph_T1=Isc*(Ir0/Ir);
Iph=Iph_T1+K0*(TK-T1);
%Calculation of Saturation current Is
Is_T1=Isc/(exp(Voc/N/Vt/Ns)-1);
Is=Is_T1*(TK/T1).^(3/N).*exp(-q*Vg/(N*k).*((1./TK)-(1/T1)));
%Rs
Xv = Is_T1*q/(N*k*T1*Ns)*exp(q*Voc_T1/(N*k*T1));
dVdI_Voc = -0.705;
Rs=-dVdI_Voc - (1/Xv);
%Rp
Vmp=29.1;
Imp=7.70;
Rp=(Vmp+Rs*Imp)/(-Imp+Iph-Is*(exp(q*(Vmp+Rs*Imp)/N*k*Ns*T1)-1));
Vt_Ta=N*k*TK / q;
V=0:0.5:Voc;
Vc=V/Ns;
I = zeros(size(Vc));
for j=1:5;
I = I - (Iph - I - Is.*( exp((V+I.*Rs)./(Vt_Ta*Ns)) -1))./(-1 - (Is.*( exp((V+I.*Rs)./(Vt_Ta*Ns)) -1)).*Rs./(Vt_Ta*Ns)-Rs/Rp);
end
P=I.*V;
% P=(Iph-Is*(exp((V+I.*Rs)/Vt/Ns/N)-1)-(V+I.*Rs)/Rp).*V;
% figure(1)
% grid on
% hold on
% plot(V,I)
figure(2)
grid on
hold on
plot(V,P)

Answers (4)

Hossein
Hossein on 2 Nov 2011
you can try the('elec_solar')model in simscape.
  3 Comments
Sai001 Cheguri
Sai001 Cheguri on 2 Nov 2011
How is the iv_data loaded in the matlab?
Hossein
Hossein on 6 Nov 2011
it is exactly my problem with elec_solar model...
I have changed the iv_data but it doesn't work....

Sign in to comment.


Hossein
Hossein on 16 Nov 2011
Hi Cheguri, I have found your problem... please tell me the value of your panel which you want to use for your work...
  4 Comments
jyoteesh arumalla
jyoteesh arumalla on 3 Oct 2016
Hello can i know why is it popping out negative values

Sign in to comment.


Emircan Han
Emircan Han on 30 Jun 2017
how did you solve that problem?

Caio Meira
Caio Meira on 6 Nov 2017
when you increase the temperature to the point of Voc tends to decrease, and as in your code the band remains the same, ie: V = 0: 0.5: Voc: it is natural that you stray.

Community Treasure Hunt

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

Start Hunting!