The following are my code for simple pv modules, I keep getting the same plot for different irradiance values. Can someone help?

8 views (last 30 days)
Even after changing the values of Gn and S in code 1 and code 2 resp. I keep getting the same plot.
Code 1 for a simple Pv module with one diode and one resistor:
clc;
clear all;
K= 1.38065e-23; %Boltsman constant
q= 1.602e-19; %charge of electron
Iscn= 8.21; %nominal SC current
Vocn= 32.9; %nominal OC voltage
Kv= -0.123; %temp. voltage constant
Ki= 0.0032; %temp current constant
Ns= 54; %No. of series connected cells
T= 25+273; %operating temp.
Tn= 25+273 %nominal temp.
Gn= 1000; %nominal irradiance
a= 1.3; %diode ideality constant
Eg= 1.12; %band gap of silicon at 25 degree celcius
G= 800; %actual irradiation
Rs= 0.221;
Rp= 415.405;
tic
Vtn= Ns*(K*Tn/q);
Ion = Iscn/((exp(Vocn/(a*Vtn)))-1)
Io= Ion*((Tn/T)^3)*exp(((q*Eg/(a*K)*((1/Tn)-(1/T)))));
Ipvn = Iscn;
Ipv= (Ipvn + Ki*(T-Tn)*(G/Gn))
Vt = Ns*(K*T/q);
I= zeros(330,1);
i=1;
I(1,1)=0;
for V= 32.9:-0.1:0
I_part = Io*(exp((V+(I(i,1)*Rs))/(Vt*a))-1) + ((V+(Rs*I(i,1)))/Rp);
I(i+1)= Ipv -I_part;
V1(i)= V;
P(i)= V*I(i);
i=i+1;
end
time_elapsed=toc;
V1(i) = V1(i-1);
P(i) = P(i-1);
V1=transpose(V1);
%subplot(3,1,1)
%plot(V1,I);
%subplot(3,1,2)
plot(V1,P);
%subplot(3,1,3)
%plot(V1, I_part);
Code 2 is basically the same as code 1 but uses more complex equations and give better and faster solutions:
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 = 30;
Tref= 25;
S= 800;
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);
for i = 1:330
V(i)= (i-1)*0.1;
Is = Isc*(1+a*(T-Tref))*(S/Sref);
I(i)= Isc*(1-kref.^((V(i)-Voc+Rs*I(i))/Voc));
end
plot(V,I),grid;
xlabel('Voltage'),ylabel('Current');

Accepted Answer

Edoardo_a
Edoardo_a on 12 Mar 2023
Hi!
For what I have seen in the code 1, the plot doesn't change because you set the value of T and Tn to be identical.
Therefore the expression for Ipv= (Ipvn + Ki*(T-Tn)*(G/Gn)) never change regardless on the value of Gn.
In code 2 the plot is always the same because the expression of I(i) inside the for loop is obtained using parameters that are not dependent on S! I think you would include instead the Is value calculated inside the loop, probably instead of I(i).
  2 Comments
Aryan Sharma
Aryan Sharma on 12 Mar 2023
Thanks bro, your answer helped me...for the 2nd code but for the 1st one I changed the value of T and made G as zero but it still gave a plot
Edoardo_a
Edoardo_a on 13 Mar 2023
I don't know what is the physial meaning of this formula:
Ipv= (Ipvn + Ki*(T-Tn)*(G/Gn))
However the reason why it keeps gving problems is that
G = 0
Ipv = Ipvn
which is exactly the same result you get whenT=Tn.
If any of the 3 terms in the second part of the equation goes to 0, Ipv will be always the same value
% When Ki = 0
% or T-Tn = 0
% or G/Gn = 0
--> Ipv = Ipvn

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!