@@ -24,6 +24,7 @@ classdef Opti
|
||||
rPD=NaN;
|
||||
rQD=NaN;
|
||||
mLoadCurrent=NaN;
|
||||
noLoadi=NaN;
|
||||
end
|
||||
|
||||
methods
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
function [ output_args,this ] = equ( this,x )
|
||||
%EQU Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=[];
|
||||
PDi=this.PDi;
|
||||
QDi=this.QDi;
|
||||
Volt0=this.Volt0;
|
||||
@@ -23,37 +24,44 @@ 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];
|
||||
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
|
||||
|
||||
%电压恒定
|
||||
output_args=[output_args;Volt(Balance)-1];
|
||||
%相角恒定
|
||||
output_args=[output_args;VAngel(Balance)];
|
||||
this.cu=zeros(length(output_args),1);
|
||||
this.cl=this.cu;
|
||||
this.cl=zeros(length(output_args),1);
|
||||
%% 开始增加不等式约束-电压\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)];%9节点
|
||||
this.cl=[this.cl;0.93*ones(length(Volt),1)];%9节点
|
||||
% this.cu=[this.cu;1.00*ones(length(Volt),1)];
|
||||
% this.cl=[this.cl;0.90*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];
|
||||
% PDU=[0.124;0.315;0.5;1;1;0.5;0.63;0.4];%原始数据
|
||||
% PDU=[0.63;0.4;0.5;1;0.8;1;0.63;0.4];%偏差比较大
|
||||
this.cu=[this.cu;1.2*rPD];
|
||||
this.cl=[this.cl;0.8*rPD];
|
||||
this.cu=[this.cu;PDU];
|
||||
this.cl=[this.cl;0*PDU];
|
||||
%% QD
|
||||
rQD=this.rQD;
|
||||
output_args=[output_args;QD];
|
||||
this.cu=[this.cu;1.9*rQD];
|
||||
this.cl=[this.cl;0.9*rQD];
|
||||
QDU=PDU;
|
||||
% this.cu=[this.cu;1.2*rQD];
|
||||
% this.cl=[this.cl;0.8*rQD];
|
||||
this.cu=[this.cu;QDU];
|
||||
this.cl=[this.cl;0*QDU];
|
||||
%% 稠密化
|
||||
output_args=full(output_args);
|
||||
this.cu=full(this.cu);
|
||||
this.cl=full(this.cl);
|
||||
|
||||
end
|
||||
|
||||
|
||||
20
@Opti/equ.m
20
@Opti/equ.m
@@ -1,6 +1,7 @@
|
||||
function [ output_args,this ] = equ( this,x )
|
||||
%EQU Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=[];
|
||||
PDi=this.PDi;
|
||||
QDi=this.QDi;
|
||||
Volt0=this.Volt0;
|
||||
@@ -23,37 +24,44 @@ 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];
|
||||
output_args=[dP;dQ];%潮流约束
|
||||
%% 使用零注入begin
|
||||
% zeroInj=setdiff(1:busNum,union(Balance,union(PDi,QDi)));
|
||||
% output_args=[output_args(zeroInj);output_args(length(Volt0)+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;
|
||||
this.cl=zeros(length(output_args),1);
|
||||
%% 开始增加不等式约束-电压\PD\QD
|
||||
%电压不等式约束
|
||||
output_args=[output_args;Volt];
|
||||
this.cu=[this.cu;1.07*ones(length(Volt),1)];
|
||||
this.cl=[this.cl;0.93*ones(length(Volt),1)];
|
||||
% this.cu=[this.cu;1.07*ones(length(Volt),1)];%9节点
|
||||
% this.cl=[this.cl;0.93*ones(length(Volt),1)];%9节点
|
||||
this.cu=[this.cu;1.00*ones(length(Volt),1)];
|
||||
this.cl=[this.cl;0.90*ones(length(Volt),1)];
|
||||
%% PD
|
||||
rPD=this.rPD;
|
||||
output_args=[output_args;PD];
|
||||
% PDU=[0.124;0.315;0.5;1;1;0.5;0.63;0.4];%原始数据
|
||||
% PDU=[0.63;0.4;0.5;1;0.8;1;0.63;0.4];%偏差比较大
|
||||
this.cu=[this.cu;1.2*rPD];
|
||||
this.cl=[this.cl;0.8*rPD];
|
||||
% this.cu=[this.cu;PDU];
|
||||
% this.cl=[this.cl;0*PDU];
|
||||
%% QD
|
||||
rQD=this.rQD;
|
||||
output_args=[output_args;QD];
|
||||
% QDU=PDU;
|
||||
this.cu=[this.cu;1.2*rQD];
|
||||
this.cl=[this.cl;0.8*rQD];
|
||||
% this.cu=[this.cu;QDU];
|
||||
% this.cl=[this.cl;0*QDU];
|
||||
%% 稠密化
|
||||
output_args=full(output_args);
|
||||
this.cu=full(this.cu);
|
||||
this.cl=full(this.cl);
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,wVolt,wLoadCurrent,PD0,QD0,rPD,rQD,Y,Angel,r,c,PG,QG,Balance,mLoadCurrent)
|
||||
function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,wVolt,wLoadCurrent,PD0,QD0,rPD,rQD,Y,Angel,r,c,PG,QG,Balance,mLoadCurrent,noLoadi)
|
||||
%INIT Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
this.PDi=PDi;
|
||||
@@ -20,5 +20,6 @@ this.rQD=rQD;
|
||||
this.wVolt=wVolt;
|
||||
this.wLoadCurrent=wLoadCurrent;
|
||||
this.mLoadCurrent=mLoadCurrent;
|
||||
this.noLoadi=noLoadi;
|
||||
end
|
||||
|
||||
|
||||
10
@Opti/obj.m
10
@Opti/obj.m
@@ -10,19 +10,13 @@ wQD=this.wQD;
|
||||
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=this.wVolt;
|
||||
t6=(wVolt.*(SEVolt-Volt0)).^2;
|
||||
% t6=wVolt.*((SEVolt-Volt0)./Volt0).^2;
|
||||
t6=(wVolt.*((SEVolt-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 );
|
||||
@@ -30,7 +24,7 @@ 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=sum(t4)+sum(t5)+sum(t6);
|
||||
output_args=full(output_args);
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user