diff --git a/run.m b/run.m index 2040b8f..ab9b9fd 100644 --- a/run.m +++ b/run.m @@ -208,17 +208,18 @@ while maxD>1e-3; SEBranchI=BranchI( SEVolt.*exp(1j*SEVAngel),lineI,lineJ,lineR,lineX );%复数支路电流 SEBranchP=BranchP( SEVolt.*exp(1j*SEVAngel),SEBranchI,lineI,lineB2 ); SEBranchQ=BranchQ( SEVolt.*exp(1j*SEVAngel),SEBranchI,lineI,lineB2 ); - SETransP=TransPower( newwordParameter,cmpY,rVolt,rVAngel ); - h=[SEVolt;SEBranchP;SEBranchQ]; - z=[mVolt;mBranchP;mBranchP]; + SETransP=TransPower( newwordParameter,SEVolt,SEVAngel ); + SETransQ=TransReactivePower( newwordParameter,SEVolt,SEVAngel ); + h=[SEVolt;SEBranchP;SEBranchQ;SETransP;SETransQ]; + z=[mVolt;mBranchP;mBranchQ;mTransP;mTransQ]; W=sparse(1:length(h),1:length(h),1/sigma.^2,length(h),length(h)); G=H'*W*H; g=-H'*W*(z-h); % 平衡节点相角恒定; - % G(length(mVolt)+Balance,:)=0; - % G(:,length(mVolt)+Balance)=0; - % G=G+sparse(length(mVolt)+Balance,length(mVolt)+Balance,1,length(mVolt)*2,length(mVolt)*2); - % g(length(mVolt)+Balance)=0; + G(length(mVolt)+Balance,:)=0; + G(:,length(mVolt)+Balance)=0; + G=G+sparse(length(mVolt)+Balance,length(mVolt)+Balance,1,length(mVolt)*2,length(mVolt)*2); + g(length(mVolt)+Balance)=0; dX=G\-g; maxD=max(abs(dX)) % 更新变量