Issue calculating same PV curve as Simulink PV block outputs

I am trying to replicate the _1Soltech 1STH-215-P IV and PV curves programmatically but I keep overshooting as you can see in the image below (my lines are thin red in the IV plot, thin blue in the PV plot). I used the formulas from Power Electronics for Photovoltaic Power Systems textbook (screenshot below).
In short, first I go to the PV block in simulink (screenshot below) and plot curves @25C for 800 and 1000 W. Then I call my 'PVCurveGenerator' function after 'hold on'. I want to be able to generate my own curves for any irradiance and temperature.
function [Vmpp, Pmpp, Impp] = PVCurveGenerator(G, T, plotyn)
%%MATLAB PV array parameters
% Fill in panel specifics for diode model. Grouping them like the MATLAB
% PV Array block does
nser = 60; % Number of cells in series in a module
npar = 1; % Number of cells in parallel
Vnom = 36.3; % Open circuit voltage under nominal conditions (V)
Inom = 7.84; % Short circuit current under nominal conditions (A)
Vmp = 29; % Maximum power voltage (V) - must be for nominal conditions
Imp = 7.35; % Maximum power current (A) - must be for nominal conditions
KVoc = -0.36099; % Temperature coefficient of Voc (%/deg. C)
KIsc = 0.102; % Temperature coefficient of Isc (%/deg. C)
I0 = 2.9273e-10; % Diode saturation current (A)
p = 0.98117; % Diode ideality factor
Rsh = 313.3991; % Shunt resistance (Ohms)
Rs = 0.39383; % Series resistance (Ohms)
Gnom = 1000; % Nominal irradiation (W/m^2)
Tnom = 298.15; % Nominal temperature (K)
q = 1.60217662e-19; % Charge constant
k = 1.38064852e-23; % Boltzmann's constant
%%Plotting I-V curve
Isc = (Inom + KIsc*(T-Tnom)).*(G/Gnom); % Isc under input conditions
Voc = (p*k*T*nser/q).*log(Isc/I0 + 1); % Voc under input conditions
Vd = 0:0.05:Voc;
Vt = (k.*T/q)*p*nser;
I = npar*(Isc - I0 * (exp(Vd./Vt) - 1))*Rsh/(Rsh + Rs) - Vd/(Rs + Rsh);
P = I.*Vd;
Pmpp = max(P);
Impp = max(I);
Vmpp = Vd(P == Pmpp);
if(plotyn)
fprintf('Isc: %.2f\n', Isc);
fprintf('Voc: %.2f\n', Voc);
% figure(2);
subplot(2,1,1)
plot(Vd, I, 'r');
xlabel('Voltage [V]');
ylabel('Current [A]');
title('PV Array I-V curve');
ylim([0 1.05*Isc]);
subplot(2,1,2)
plot(Vd, P, 'b');
xlabel('Voltage [V]');
ylabel('Power [W]');
title('PV Array P-V curve');
ylim([0, 1.05*max(P)]);
end
end

Answers (1)

I am unable to access the textbook. One possible reason for the graph overshoot could be due to a difference in the coefficients.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Asked:

on 14 Jan 2018

Moved:

on 11 Jan 2023

Community Treasure Hunt

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

Start Hunting!