nopgqg_lineloss/FormLw.m

43 lines
1.0 KiB
Mathematica
Raw Normal View History

function Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF,noDataTransCapacity,PDU,QDU)
KK=999;
%PU=GenU(:,2);%<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD>Ͻ<EFBFBD>
VoltU=(1.1)*ones(1,Busnum);
%VoltU=10*ones(1,Busnum);
% PDU=PD0(Loadi);
% % PDU=noDataTransCapacity;
% PDU(PDU>0)=1.500*PDU(PDU>0).*unifrnd(0.75,1.25,sum(PDU>0),1);
% PDU(PDU<0)=0.500*PDU(PDU<0).*unifrnd(0.75,1.25,sum(PDU<0),1);
%
% % PDU(PDU>0)=1.200*PDU(PDU>0);
% % PDU(PDU<0)=0.800*PDU(PDU<0);
%
% PDU(PDU==0)=0.400;
realPD=PD0(Loadi);
indPD=find(realPD>0);
% PDU(indPD(3:12:end))=1.55*realPD(indPD(3:12:end));
% PDU(indPD(9:12:end))=1.05*realPD(indPD(9:12:end));
% QDU=QD0(Loadi);
%
% QDU(QDU>0)=1.500*QDU(QDU>0).*unifrnd(0.75,1.25,sum(QDU>0),1);
% QDU(QDU<0)=0.500*QDU(QDU<0).*unifrnd(0.75,1.25,sum(QDU<0),1);
%
% % QDU(QDU>0)=1.200*QDU(QDU>0);
% % QDU(QDU<0)=0.800*QDU(QDU<0);
%
% QDU(QDU==0)=0.400;
realQD=QD0(Loadi);
indQD=find(realQD>0);
% QDU(indQD(3:12:end))=1.55*realQD(indQD(3:12:end));
% QDU(indQD(9:12:end))=1.05*realQD(indQD(9:12:end));
t1=([PDU',QDU',VoltU])';
t2=Mat_G+Init_U'-t1;
Lw=t2;
end