parent
028a09917a
commit
f50bbd3435
14
run.asv
14
run.asv
|
|
@ -65,14 +65,20 @@ SEBranchP=real((cmpSEV(lineI)-cmpSEV(lineJ)).*conj(SEBranchI));
|
||||||
SEBranchQ=imag((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+(SEBranchP-mBranchP)'*(1./sigma^2*eye(length(mBranchP)))*(SEBranchP-mBranchP);
|
||||||
Objective=Objective+(SEBranchQ-mBranchQ)'*(1./sigma^2*eye(length(mBranchQ)))*(SEBranchQ-mBranchQ);
|
Objective=Objective+(SEBranchQ-mBranchQ)'*(1./sigma^2*eye(length(mBranchQ)))*(SEBranchQ-mBranchQ);
|
||||||
%% 发电机注入功率
|
|
||||||
%% 0×¢Èë½Úµã
|
%% 0×¢Èë½Úµã
|
||||||
zerosInjectionIndex=1:length(Volt);
|
zerosInjectionIndex=1:length(Volt);
|
||||||
zerosInjectionIndex=zerosInjectionIndex( ~(PD~=0|QD~=0|PG~=0|QG~=0) );
|
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Çó½â
|
%% YALMIPÇó½â
|
||||||
PQ=diag(SEVolt)*cmpY*SEVolt;
|
Constraints=[SEVAngel(Balance)==0,zeroInjP==0,zeroInjP==0];
|
||||||
zeros
|
|
||||||
Constraints=[SEVAngel(Balance)==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];
|
% 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');
|
options = sdpsettings('verbose',2,'solver','ipopt');
|
||||||
solvesdp(Constraints,Objective,options)
|
solvesdp(Constraints,Objective,options)
|
||||||
|
|
|
||||||
14
run.m
14
run.m
|
|
@ -1,5 +1,5 @@
|
||||||
addpath('.\Powerflow')
|
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));
|
SEBranchQ=imag((cmpSEV(lineI)-cmpSEV(lineJ)).*conj(SEBranchI));
|
||||||
Objective=Objective+(SEBranchP-mBranchP)'*(1./sigma^2*eye(length(mBranchP)))*(SEBranchP-mBranchP);
|
Objective=Objective+(SEBranchP-mBranchP)'*(1./sigma^2*eye(length(mBranchP)))*(SEBranchP-mBranchP);
|
||||||
Objective=Objective+(SEBranchQ-mBranchQ)'*(1./sigma^2*eye(length(mBranchQ)))*(SEBranchQ-mBranchQ);
|
Objective=Objective+(SEBranchQ-mBranchQ)'*(1./sigma^2*eye(length(mBranchQ)))*(SEBranchQ-mBranchQ);
|
||||||
%% 发电机注入功率
|
|
||||||
%% 0注入节点
|
%% 0注入节点
|
||||||
zerosInjectionIndex=1:length(Volt);
|
zerosInjectionIndex=1:length(Volt);
|
||||||
zerosInjectionIndex=zerosInjectionIndex( ~(PD~=0|QD~=0|PG~=0|QG~=0) );
|
zerosInjectionIndex=zerosInjectionIndex( ~(PD~=0|QD~=0|PG~=0|QG~=0) );
|
||||||
%% YALMIP求解
|
PQ=diag(SEVolt)*conj(cmpY*SEVolt);
|
||||||
PQ=diag(SEVolt)*cmpY*SEVolt;
|
|
||||||
zeroInjP=real(PQ(zerosInjectionIndex));%% 0注入节点
|
zeroInjP=real(PQ(zerosInjectionIndex));%% 0注入节点
|
||||||
zeroInjQ=imag(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=[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];
|
% 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');
|
options = sdpsettings('verbose',2,'solver','ipopt');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue