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

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)

you can try the('elec_solar')model in simscape.

3 Comments

Yeah..I've tried the model. When I change the values in elec_solar to match the data sheet what I'm working on, it is not working. Could you please make me understand the matlab code for the elec_solar model?
How is the iv_data loaded in the matlab?
it is exactly my problem with elec_solar model...
I have changed the iv_data but it doesn't work....

Sign in to comment.

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

Can you tell your mail id,so that I can attach my data sheet?
can any one please send me MATLAB code for shading effects of array(I-V,P-V ) Characterstics
plz send me (v-I) code of this.
Hello can i know why is it popping out negative values

Sign in to comment.

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.

Asked:

on 1 Nov 2011

Answered:

on 6 Nov 2017

Community Treasure Hunt

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

Start Hunting!