diff --git a/@Opti/Opti.m b/@Opti/Opti.m index eeed69b..0147958 100644 --- a/@Opti/Opti.m +++ b/@Opti/Opti.m @@ -20,6 +20,8 @@ classdef Opti cl=NaN;%opti toolbox大于小于等于 cu=NaN;%等式、不等式约束右边的值 Balance=NaN; + rPD=NaN; + rQD=NaN; end methods diff --git a/@Opti/equ.m b/@Opti/equ.m index 9bfc42b..4691e6a 100644 --- a/@Opti/equ.m +++ b/@Opti/equ.m @@ -24,14 +24,21 @@ 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)]; -%% 开始增加不等式约束-电压\PD\QD -%电压不等式约束 this.cu=zeros(length(output_args),1); this.cl=this.cu; +%% 开始增加不等式约束-电压\PD\QD +%电压不等式约束 output_args=[output_args;Volt]; -output_args=full(output_args); -%电压 this.cu=[this.cu;1.1*ones(length(Volt),1)]; this.cl=[this.cl;0.9*ones(length(Volt),1)]; +%% PD +rPD=this.rPD; +rQD=this.rQD; +output_args=[output_args;PD]; +this.cu=[this.cu;1.2*rPD]; +this.cl=[this.cl;0.8*rPD]; +output_args=full(output_args); +this.cu=full(this.cu); +this.cl=full(this.cl); end diff --git a/@Opti/init.m b/@Opti/init.m index a36e034..3ebf24c 100644 --- a/@Opti/init.m +++ b/@Opti/init.m @@ -1,4 +1,4 @@ -function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,PD0,QD0,Y,Angel,r,c,PG,QG,Balance ) +function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,PD0,QD0,Y,Angel,r,c,PG,QG,Balance,rPD,rQD ) %INIT Summary of this function goes here % Detailed explanation goes here this.PDi=PDi; @@ -15,5 +15,7 @@ this.PG=PG; this.QG=QG; this.Balance=Balance; this.Volt0=Volt0; +this.rPD=rPD; +this.rQD=rQD; end diff --git a/Run_YALMIP.m b/Run_YALMIP.m index 3d87926..ea6fd11 100644 --- a/Run_YALMIP.m +++ b/Run_YALMIP.m @@ -64,7 +64,7 @@ QDi=find(QD~=0); % PD0=PD0(PDi); % QD0=QD0(QDi); seOpti=Opti(); -seOpti=seOpti.init(Volt0,PDi,QDi,wPD,wQD,PD0,QD0,Y,Angle,r,c,PG,QG,Balance); +seOpti=seOpti.init(Volt0,PDi,QDi,wPD,wQD,PD0,QD0,Y,Angle,r,c,PG,QG,Balance,rPD(PDi),rQD(QDi)); opts = optiset('solver','filtersd'); opts.maxiter=85500; opts.maxtime=3000;