The code I am using ''idx'' is giving me wrong Voltage value.

1 view (last 30 days)
The voltage is suppose to drop as I increase the temperature, but the ''idx'' selects the highest Voltage value in the vector. Is there way to reduce the Vpmax as the temperature increases?
Io = 0.1*10^(-9);
IL = 9.5;
V = linspace(0,0.691,100);
q = 1.6*10^(-19);
k = 1.380649*10^(-23);
% Temperature at 45°C and Irradiance of 900 W/m^2
T = 273.15+45;
G =700;
Gr = 1000;
I = (IL*(G./Gr))-(Io.*(exp((q.*V)./(k.*T))-1));
n = 72;
Vp = V.*n;
P = (I.*Vp);
[Pmax,idx] = max(P);
Imax = I(idx);
Vpmax = Vp(idx);
Isc = max(I);
Voc = max(Vp);
figure(8)
plot(Vp,P,'r','linewidth',2);
xlabel('Voltage (V)','fontsize',15);
ylabel('Power (W)','fontsize',15);
title('PV Panel PV Curve at 45°C 900 W/m^2','fontsize',15)
grid minor
axis([0,55,0,400])
figure(9)
plot(Vp,I,'k','linewidth',2);
xlabel ('Voltage [V]','fontsize',15);
ylabel ('Current [A]','fontsize',15);
title('PV Panel IV Curve at 45 °C 900W/m^2','fontsize',15)
yline(Imax)
xline(Vpmax)
text(Vpmax,Imax,['MPP=',num2str(Pmax),'[W]'])
grid minor
axis([0,55,0,9])
Any help will be greatly appreciated
  1 Comment
Voss
Voss on 22 Feb 2022
idx, as calculated, is the index where P (Power) is at its maximum, not Voltage.
[Pmax,idx] = max(P); % idx: index of maximum Power
Also, temperature is a scalar constant, so I'm not sure why you say Voltage is a function of Temperature in this code. Can you please clarify?

Sign in to comment.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!