@@ -23,15 +23,37 @@ busNum=length(Volt0);
|
||||
VMatrix=sparse(r,c,VAngel(r)-VAngel(c)-Angel,busNum,busNum);
|
||||
dP=PG-PD_-diag(Volt)*(Y.*cos(VMatrix))*Volt;
|
||||
dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
|
||||
output_args=[dP;dQ;VAngel(Balance)];
|
||||
output_args=[dP;dQ];
|
||||
%% 使用零注入begin
|
||||
% zeroInj=setdiff(1:busNum,union(Balance,union(PDi,QDi)));
|
||||
% output_args=[output_args(zeroInj);output_args(length(PDi)+zeroInj)];
|
||||
%% 使用零注入end
|
||||
|
||||
%电压恒定
|
||||
output_args=[output_args;Volt(Balance)-1];
|
||||
%相角恒定
|
||||
output_args=[output_args;VAngel(Balance)];
|
||||
this.cu=zeros(length(output_args),1);
|
||||
this.cl=this.cu;
|
||||
%% 开始增加不等式约束-电压\PD\QD
|
||||
%电压不等式约束
|
||||
output_args=[output_args;Volt];
|
||||
this.cu=[this.cu;1.1*ones(length(Volt),1)];
|
||||
this.cl=[this.cl;0.9*ones(length(Volt),1)];
|
||||
%% PD
|
||||
rPD=this.rPD;
|
||||
output_args=[output_args;PD];
|
||||
this.cu=[this.cu;1.5*rPD];
|
||||
this.cl=[this.cl;0.5*rPD];
|
||||
%% QD
|
||||
rQD=this.rQD;
|
||||
output_args=[output_args;QD];
|
||||
this.cu=[this.cu;1.9*rQD];
|
||||
this.cl=[this.cl;0.9*rQD];
|
||||
%% 稠密化
|
||||
output_args=full(output_args);
|
||||
this.cu=zeros(length(output_args),1);
|
||||
this.cl=this.cu;
|
||||
%电压
|
||||
this.cu=[this.cu;1.1];
|
||||
this.cl=this.cu;
|
||||
this.cu=full(this.cu);
|
||||
this.cl=full(this.cl);
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
|
||||
output_args=[dP;dQ];
|
||||
%% 使用零注入begin
|
||||
% zeroInj=setdiff(1:busNum,union(Balance,union(PDi,QDi)));
|
||||
% output_args=[output_args(zeroInj);output_args(length(PDi)+zeroInj)];
|
||||
% output_args=[output_args(zeroInj);output_args(length(Volt0)+zeroInj)];
|
||||
%% 使用零注入end
|
||||
|
||||
%电压恒定
|
||||
@@ -38,8 +38,8 @@ this.cl=this.cu;
|
||||
%% 开始增加不等式约束-电压\PD\QD
|
||||
%电压不等式约束
|
||||
output_args=[output_args;Volt];
|
||||
this.cu=[this.cu;1.1*ones(length(Volt),1)];
|
||||
this.cl=[this.cl;0.9*ones(length(Volt),1)];
|
||||
this.cu=[this.cu;1.07*ones(length(Volt),1)];
|
||||
this.cl=[this.cl;0.93*ones(length(Volt),1)];
|
||||
%% PD
|
||||
rPD=this.rPD;
|
||||
output_args=[output_args;PD];
|
||||
|
||||
@@ -7,16 +7,28 @@ PD=x(1:length(PDi));
|
||||
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
||||
wPD=this.wPD;
|
||||
wQD=this.wQD;
|
||||
% wVolt=this.wVolt;
|
||||
PD0=this.PD0;
|
||||
QD0=this.QD0;
|
||||
t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
|
||||
% t4=wPD(PDi).*((PD-PD0(PDi))./PD0(PDi)).^2;
|
||||
t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
|
||||
% t5=wQD(QDi).*((QD-QD0(QDi))./QD0(QDi)).^2;
|
||||
Volt0=this.Volt0;
|
||||
SEVolt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
|
||||
wVolt
|
||||
wVolt=this.wVolt;
|
||||
t6=(wVolt.*(SEVolt-Volt0)).^2;
|
||||
output_args=sum(t4)+sum(t5)+sum(t6);
|
||||
% t6=wVolt.*((SEVolt-Volt0)./Volt0).^2;
|
||||
Balance=this.Balance;
|
||||
t6(Balance)=0;%²»¼ÆËãÆ½ºâ½ÚµãµÄ
|
||||
t6(2:0)
|
||||
% µçÁ÷
|
||||
SEVAngel=x(length(PDi)+length(QDi)+length(SEVolt)+1:end);
|
||||
loadCurrent=LoadCurrent( SEVolt,SEVAngel,PD0(PDi),QD0(QDi),PDi,QDi );
|
||||
wLoadCurrent=this.wLoadCurrent;
|
||||
mLoadCurrent=this.mLoadCurrent;
|
||||
t7=(wLoadCurrent.*(loadCurrent-mLoadCurrent)).^2;
|
||||
t7=wLoadCurrent.*((loadCurrent-mLoadCurrent)./mLoadCurrent).^2;
|
||||
output_args=sum(t4)+sum(t5)+sum(t6)+sum(0);
|
||||
output_args=full(output_args);
|
||||
end
|
||||
|
||||
|
||||
18
@Opti/obj.m
18
@Opti/obj.m
@@ -7,24 +7,30 @@ PD=x(1:length(PDi));
|
||||
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
||||
wPD=this.wPD;
|
||||
wQD=this.wQD;
|
||||
% wVolt=this.wVolt;
|
||||
PD0=this.PD0;
|
||||
QD0=this.QD0;
|
||||
t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
|
||||
t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
|
||||
% t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
|
||||
t4=wPD(PDi).*((PD-PD0(PDi))./PD0(PDi)).^2;
|
||||
% t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
|
||||
t5=wQD(QDi).*((QD-QD0(QDi))./QD0(QDi)).^2;
|
||||
Volt0=this.Volt0;
|
||||
SEVolt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
|
||||
wVolt=this.wVolt;
|
||||
t6=(wVolt.*(SEVolt-Volt0)).^2;
|
||||
% t6=(wVolt.*(SEVolt-Volt0)).^2;
|
||||
t6=wVolt.*((SEVolt-Volt0)./Volt0).^2;
|
||||
Balance=this.Balance;
|
||||
t6(Balance)=0;%²»¼ÆËãÆ½ºâ½ÚµãµÄ
|
||||
% xx=t6(8);
|
||||
% t6=xx;
|
||||
% t6(9:end)=0;
|
||||
% µçÁ÷
|
||||
SEVAngel=x(length(PDi)+length(QDi)+length(SEVolt)+1:end);
|
||||
loadCurrent=LoadCurrent( SEVolt,SEVAngel,PD0(PDi),QD0(QDi),PDi,QDi );
|
||||
wLoadCurrent=this.wLoadCurrent;
|
||||
mLoadCurrent=this.mLoadCurrent;
|
||||
t7=(wLoadCurrent.*(loadCurrent-mLoadCurrent)).^2;
|
||||
output_args=sum(t4)+sum(t5)+sum(t7);
|
||||
% t7=(wLoadCurrent.*(loadCurrent-mLoadCurrent)).^2;
|
||||
t7=wLoadCurrent.*((loadCurrent-mLoadCurrent)./mLoadCurrent).^2;
|
||||
output_args=sum(t4)+sum(t5)+sum(t6)+sum(0);
|
||||
output_args=full(output_args);
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user