加发电机注入功率

Signed-off-by: facat <dugg@21cn.com>
This commit is contained in:
facat 2013-04-14 16:30:53 +08:00
parent 028a09917a
commit f50bbd3435
2 changed files with 20 additions and 8 deletions

14
run.asv
View File

@ -65,14 +65,20 @@ SEBranchP=real((cmpSEV(lineI)-cmpSEV(lineJ)).*conj(SEBranchI));
SEBranchQ=imag((cmpSEV(lineI)-cmpSEV(lineJ)).*conj(SEBranchI));
Objective=Objective+(SEBranchP-mBranchP)'*(1./sigma^2*eye(length(mBranchP)))*(SEBranchP-mBranchP);
Objective=Objective+(SEBranchQ-mBranchQ)'*(1./sigma^2*eye(length(mBranchQ)))*(SEBranchQ-mBranchQ);
%% 发电机注入功率
%% 0×¢Èë½Úµã
zerosInjectionIndex=1:length(Volt);
zerosInjectionIndex=zerosInjectionIndex( ~(PD~=0|QD~=0|PG~=0|QG~=0) );
PQ=diag(SEVolt)*conj(cmpY*SEVolt);
zeroInjP=real(PQ(zerosInjectionIndex));%% 0注入节点
zeroInjQ=imag(PQ(zerosInjectionIndex));%% 0注入节点
%% 发电机注入功率
% 先找到只有发电机的节点
PDQDi=union(PDi,QDi);
onlyPG=setdiff(PGi,PDQDi);
onlyQG=setdiff(QGi,PDQDi);
PG-real(PQ())
%% YALMIPÇó½â
PQ=diag(SEVolt)*cmpY*SEVolt;
zeros
Constraints=[SEVAngel(Balance)==0,];
Constraints=[SEVAngel(Balance)==0,zeroInjP==0,zeroInjP==0];
% Constraints=[[zeros(length(c)) A' -eye(length(lbounds))]*x==-c;[A zeros(length(b)) zeros(length(b),length(lbounds))]*x<=b;10>=x>=0];
options = sdpsettings('verbose',2,'solver','ipopt');
solvesdp(Constraints,Objective,options)

14
run.m
View File

@ -1,5 +1,5 @@
addpath('.\Powerflow')
[~, ~, ~, ~,Volt,Vangle,Y,Yangle,r,c,newwordParameter,PG,QG,PD,QD,Balance]=pf('ieee30.dat', '0');
[~, ~, ~, ~,Volt,Vangle,Y,Yangle,r,c,newwordParameter,PG,QG,PD,QD,Balance]=pf('ieee14.dat', '0');
%%
%
%%
@ -65,14 +65,20 @@ SEBranchP=real((cmpSEV(lineI)-cmpSEV(lineJ)).*conj(SEBranchI));
SEBranchQ=imag((cmpSEV(lineI)-cmpSEV(lineJ)).*conj(SEBranchI));
Objective=Objective+(SEBranchP-mBranchP)'*(1./sigma^2*eye(length(mBranchP)))*(SEBranchP-mBranchP);
Objective=Objective+(SEBranchQ-mBranchQ)'*(1./sigma^2*eye(length(mBranchQ)))*(SEBranchQ-mBranchQ);
%%
%% 0
zerosInjectionIndex=1:length(Volt);
zerosInjectionIndex=zerosInjectionIndex( ~(PD~=0|QD~=0|PG~=0|QG~=0) );
%% YALMIP
PQ=diag(SEVolt)*cmpY*SEVolt;
PQ=diag(SEVolt)*conj(cmpY*SEVolt);
zeroInjP=real(PQ(zerosInjectionIndex));%% 0
zeroInjQ=imag(PQ(zerosInjectionIndex));%% 0
%%
%
PDQDi=union(PDi,QDi);
onlyPG=setdiff(PGi,PDQDi);
onlyQG=setdiff(QGi,PDQDi);
Objective=Objective+(PG(onlyPG)-real(PQ(onlyPG)))'*(1./sigma^2*eye(length(PG(onlyPG))))*(PG(onlyPG)-real(PQ(onlyPG)));
Objective=Objective+(QG(onlyQG)-imag(PQ(onlyQG)))'*(1./sigma^2*eye(length(QG(onlyQG))))*(QG(onlyQG)-imag(PQ(onlyQG)));
%% YALMIP
Constraints=[SEVAngel(Balance)==0,zeroInjP==0,zeroInjP==0];
% Constraints=[[zeros(length(c)) A' -eye(length(lbounds))]*x==-c;[A zeros(length(b)) zeros(length(b),length(lbounds))]*x<=b;10>=x>=0];
options = sdpsettings('verbose',2,'solver','ipopt');