Select Page

function Ipv_sr = PVMps(Gvec,Tvec,Vpv_sr)

% © 2020 Universiti Teknologi Malaysia – All Rights Reserved

A=1.65;

Isc=2.32;

Ki=0.002;

Kv=-0.16;

Ns=72;

Rs=1;

Voc=44.4;

Vpvcriadj=3;

iadj=1.3;

k=1.38e-23;

q=1.602e-19;

Vpvsum=0;

Iph=zeros(1,length(Gvec));

Vpvcri=zeros(1,length(Gvec));

Vt=zeros(1,length(Gvec));

Is=zeros(1,length(Gvec));

%% Proposed Partial Shading Adjuster

Iph(1)=Gvec(1)/1000*(Isc+Ki*(Tvec(1)-25));

for i=1:length(Gvec)

    if i<length(Gvec)

        Iph(i+1)=Gvec(i+1)/1000*(Isc+Ki*(Tvec(i+1)-25));

    end

    Vt(i)=Ns*k*(Tvec(i)+273)/q;

    Is(i)=(Isc+Ki*(Tvec(i)-25))/(exp((Voc+Kv*(Tvec(i)-25))/(A*Vt(i)))-1);

    if i<length(Gvec)

        Vpvcri(i)=A*Vt(i)*log((Iph(i) – Iph(i+1))/Is(i) + 1) – Iph(i+1)*Rs;

    else

        break;

    end

    Vpvsum=sum(Vpvcri)+(i-1)^iadj*Vpvcriadj;

    if Vpv_sr<Vpvsum

        Vpvsum=Vpvsum-Vpvcri(i);

        break;

    end

end

Vpvsub=Vpv_sr-Vpvsum;

%% Standard PV Model

Ipv_sr=0;

for j=1:5

    Ipv_sr=Iph(i)-Is(i)*(exp((Vpvsub+Rs*Ipv_sr)/(Vt(i)*A))-1);

end