資源簡介
本資源為變步長的INC算法仿真的MPPT算法,采用MATLAB的simulink模塊仿真,附有變步長的INC算法源代碼(s函數),默認最大功率50W,其他參數均寫在仿真中,供大家學習參考。
注意:需MATLABR2016b及以上版本才可運行!

代碼片段和文件信息
function?[sysx0strts]?=?MPPT_AD_INC(txuflag)
switch?flag
??case?0
????[sysx0strts]?=?mdlInitializeSizes;
??case?2????????????????????????????????????????????????
????sys?=?mdlUpdate(txu);?
??case?3????????????????????????????????????????????????
????sys?=?mdlOutputs(txu);
??case?{149}????????????????????????????????????????????????
????sys?=[];
??otherwise
????error([‘unhandled?flag?=?‘num2str(flag)]);
end
function?[sysx0strts]?=?mdlInitializeSizes
sizes?=?simsizes;
sizes.NumContStates??=?0;
sizes.NumDiscStates??=?4;
sizes.NumOutputs?????=?1;
sizes.NumInputs??????=?2;
sizes.DirFeedthrough?=?0;
sizes.NumSampleTimes?=?1;
sys?=?simsizes(sizes);
x0??=[0?0?0?0];
str?=[];
ts??=[0.002?0];????%步長為1e-6
function?sys?=?mdlUpdate(txu)??
%?增量電導法MPPT
dU=u(1)-x(1);
dI=u(2)-x(2);
slope=0;
n=0.0002;???%占空比步長
%變步長
Pnew=u(1)*u(2);
P=x(1)*x(2);
dP=Pnew-P;
if?dU~=0
????m=dP/dU;
????k1=n*abs(m);
else?k1=0.05;
end
if?k1>0.05;
????k1=0.05;
end
if?dU==0
????if?dI==0
????slope?=?0;
????elseif?dI?>?0
????slope?=?1;????????????
????elseif??dI?0
????slope?=?-1;??
????end
else
????if??(dI/dU)?==(-u(2)/u(1))
????????slope?=?0;????
????elseif?(dI/dU)?>(-u(2)/u(1))
????????slope?=?-1;???
????elseif??(dI/dU)?<(-u(2)/u(1))
????????slope?=?1;?
????end
end
%找到最大功率點的判斷
if?abs(u(2)+u(1)*dI/dU)<2e-5
????x(4)=1;
else
????x(4)=0;
end
if?x(4)==0
????x(3)=x(3)+k1*slope;?????%更新占空比值??
else
????x(3)=x(3);
end
x(1)=u(1);
x(2)=u(2);
sys=[x(1)?x(2)?x(3)?x(4)];
function?sys?=?mdlOutputs(txu)
if?x(3)<=0
????x(3)=0.1;
end
if?x(3)>=0.8
????x(3)=0.8;
end
sys=x(3);?????%?輸出占空比值
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1718??2018-12-23?08:52??作業四\MPPT_AD_INC.m
?????文件??????109004??2018-12-22?22:32??作業四\my_PVtest.mdl
?????目錄???????????0??2019-01-04?10:41??作業四\
評論
共有 條評論