加入了各种统计值。

This commit is contained in:
facat 2013-01-21 21:47:54 +08:00
parent 7ded138066
commit 0f8edee30b
15 changed files with 266 additions and 128 deletions

14
@ForThesis/AddPDQDPGQG.m Normal file
View File

@ -0,0 +1,14 @@
function this=AddPDQDPGQG( this, PD,QD,PG,QG)
%ADDPD Summary of this function goes here
% Detailed explanation goes here
if this.currentPos>this.sampleNum
error('');
return;
end
this.currentPos=this.currentPos+1;
this.PDArray(:,this.currentPos)=PD;
this.QDArray(:,this.currentPos)=QD;
this.PGArray(this.currentPos)=PG;
this.QGArray(this.currentPos)=QG;
end

30
@ForThesis/ForThesis.m Normal file
View File

@ -0,0 +1,30 @@
classdef ForThesis
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
properties
currentPos=0;
sampleNum=0;
LoadNum=0;
PDArray=0;
QDArray=0;
PGArray=0;
QGArray=0;
end
methods
function this=ForThesis(sampleNum,LoadNum)
this.currentPos=0;%100
this.sampleNum=sampleNum;
this.LoadNum=LoadNum;
this.PDArray=zeros(LoadNum,sampleNum);
this.QDArray=zeros(LoadNum,sampleNum);
this.PGArray=zeros(sampleNum,1);
this.QGArray=zeros(sampleNum,1);
end
end
end

View File

@ -0,0 +1,7 @@
function MaxDeviation(this,PG0,QG0,PD0,QD0)
PD0Array=repmat(PD0,1,this.sampleNum);
QD0Array=repmat(QD0,1,this.sampleNum);
PDMaxDev=max(abs(this.PDArray-PD0Array),[],2)
QDMaxDev=max(abs(this.QDArray-QD0Array),[],2)
PG0Array=repmat()
end

11
@ForThesis/MaxDeviation.m Normal file
View File

@ -0,0 +1,11 @@
function [output_arg]=MaxDeviation(this,PG0,QG0,PD0,QD0)
PD0Array=repmat(PD0,1,this.sampleNum);
QD0Array=repmat(QD0,1,this.sampleNum);
PDMaxDev=max(abs( (this.PDArray-PD0Array)./PD0Array ),[],2);
QDMaxDev=max(abs( (this.QDArray-QD0Array)./QD0Array ),[],2);
PG0Array=repmat(PG0,this.sampleNum,1);
QG0Array=repmat(QG0,this.sampleNum,1);
PGMaxDev=max(abs( (PG0Array-this.PGArray)./PG0Array ));
QGMaxDev=max( abs( (QG0Array-this.QGArray)./QG0Array ) );
output_arg=max([PDMaxDev;QDMaxDev;PGMaxDev;QGMaxDev]);
end

7
@ForThesis/MeanPD.m Normal file
View File

@ -0,0 +1,7 @@
function [ output_args ] = MeanPD(this)
%MEANPD Summary of this function goes here
% Detailed explanation goes here
output_args=sum(this.PDArray,2)/this.sampleNum;
end

7
@ForThesis/MeanPG.m Normal file
View File

@ -0,0 +1,7 @@
function [ output_args ] = MeanPG( this )
%MEANPG Summary of this function goes here
% Detailed explanation goes here
output_args=sum(this.PGArray,1)/this.sampleNum;
end

7
@ForThesis/MeanQD.m Normal file
View File

@ -0,0 +1,7 @@
function [ output_args ] = MeanQD(this)
%MEANQD Summary of this function goes here
% Detailed explanation goes here
output_args=sum(this.QDArray,2)/this.sampleNum;
end

7
@ForThesis/MeanQG.m Normal file
View File

@ -0,0 +1,7 @@
function [ output_args ] = MeanQG( this )
%MEAQG Summary of this function goes here
% Detailed explanation goes here
output_args=sum(this.QGArray,1)/this.sampleNum;
end

View File

@ -0,0 +1,15 @@
function [ output_args ] = StatDeviation( this,PG0,QG0,PD0,QD0 )%ͳ¼ÆÎó²î
%STATDEVIATION Summary of this function goes here
% Detailed explanation goes here
PD0Array=repmat(PD0,1,this.sampleNum);
QD0Array=repmat(QD0,1,this.sampleNum);
PDMaxDev=max(abs(this.PDArray-PD0Array),[],2);
QDMaxDev=max(abs(this.QDArray-QD0Array),[],2);
PG0Array=repmat(PG0,this.sampleNum,1);
QG0Array=repmat(QG0,this.sampleNum,1);
PGMaxDev=max(abs(PG0Array));
QGMaxDev=max(abs(QG0Array));
end

View File

@ -0,0 +1,20 @@
function [ output_args ] = StatDeviation( this,PG0,QG0,PD0,QD0 )%ͳ¼ÆÎó²î
%STATDEVIATION Summary of this function goes here
% Detailed explanation goes here
PD0Array=repmat(PD0,1,this.sampleNum);
QD0Array=repmat(QD0,1,this.sampleNum);
PDDev=(this.PDArray-PD0Array)/0.05;
QDDev=(this.QDArray-QD0Array)/0.05;
PG0Array=repmat(PG0,this.sampleNum,1);
QG0Array=repmat(QG0,this.sampleNum,1);
PGDev=(PG0Array-this.PGArray)/0.01;
QGDev=(QG0Array-this.QGArray)/0.01;
wholeMat=[PDDev;QDDev;PGDev';QGDev'];
t1=wholeMat.^2;
t2=sum(t1,1);
t3=t2/size(t1,1);
t4=t3.^2;
output_args=sum(t4)/length(t4);
end

View File

@ -8,14 +8,14 @@ VoltU=(1.1)*ones(1,Busnum);
%VoltU=10*ones(1,Busnum);
PDU=PD0(Loadi);
% PDU=noDataTransCapacity;
PDU(PDU>0)=1.200*PDU(PDU>0);
PDU(PDU<0)=0.800*PDU(PDU<0);
PDU(PDU>0)=1.300*PDU(PDU>0);
PDU(PDU<0)=0.700*PDU(PDU<0);
PDU(PDU==0)=0.400;
%PDU=10*ones(length(Loadi),1);
QDU=QD0(Loadi);
QDU(QDU>0)=1.200*QDU(QDU>0);
QDU(QDU<0)=0.800*QDU(QDU<0);
QDU(QDU==0)=0.200;
QDU(QDU>0)=1.300*QDU(QDU>0);
QDU(QDU<0)=0.700*QDU(QDU<0);
QDU(QDU==0)=0.400;
% PF=0.85;
% QDU=1.0*PD(Loadi).*sqrt(1 -PF.^2)./PF;
t1=([PU',QU',PDU',QDU',VoltU])';

View File

@ -7,14 +7,14 @@ QL=-5*ones(length(PVQL(:,1)),1);
VoltL=(0.9)*ones(1,Busnum);
%VoltL=-10*ones(1,Busnum);
PDL=PD0(Loadi);
PDL(PDL>0)=0.800*PDL(PDL>0);
PDL(PDL<0)=1.200*PDL(PDL<0);
PDL(PDL>0)=0.700*PDL(PDL>0);
PDL(PDL<0)=1.300*PDL(PDL<0);
PDL(PDL==0)=-0.400;
%PDL=-10*ones(length(Loadi),1);
QDL=QD0(Loadi);
QDL(QDL>0)=0.800*QDL(QDL>0);
QDL(QDL<0)=1.200*QDL(QDL<0);
QDL(QDL==0)=-0.200;
QDL(QDL>0)=0.700*QDL(QDL>0);
QDL(QDL<0)=1.300*QDL(QDL<0);
QDL(QDL==0)=-0.400;
% QDL=0*PD(Loadi).*sqrt((1-PF.^2))./PF;
t1=([PL',QL',PDL',QDL',VoltL])';
t2=Mat_G-Init_L'-t1;

View File

@ -51,7 +51,8 @@ QD0(Loadi)=QD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
PG0(PGi)=PG0(PGi).*(1+normrnd(0,0.01,length(PGi),1));
QG0(PVi)=QG0(PVi).*(1+normrnd(0,0.01,length(PVi),1));
%% 读变压器容量
[noDataTransNum noDataTransCapacity noDataTransPowerFactor]=ReadNoDataTrans(fileName);
%[noDataTransNum noDataTransCapacity noDataTransPowerFactor]=ReadNoDataTrans('C:/b/东际911_2751267_2012-09-05/iPso_东际911_2751267_2012-09-05_变压器无负载.txt');
noDataTransCapacity=0;
while(abs(Gap)>Precision)
if KK>kmax
break;
@ -83,7 +84,7 @@ while(abs(Gap)>Precision)
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,QD_NON_ZERO,QD_NON_ZERO_IND,Loadi);
Ly=Mat_H;
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,PD0,QD0,Loadi,KK,PF);
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF);
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF,noDataTransCapacity);
Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W);
YY=FormYY(Lul,Lz,Ly,Luu,Lw,Lx);
%% 开始解方程
@ -97,7 +98,7 @@ while(abs(Gap)>Precision)
end
fprintf('迭代次数%d\n',KK);
fprintf('目标值%f\n',full(ObjectiveFun(PG,PG0,PGi,QG,QG0,PVi,PD,PD0,QD,QD0,wPG,wQG,wPD,wQD,Loadi)));
DrawGap(plotGap);
% DrawGap(plotGap);
%%
%Volt=full(Volt');
%PD=full(PD);

238
OPF.m
View File

@ -1,120 +1,132 @@
tic
clc
clear
[kmax,Precision,UAngel,Volt,Busnum,PVi,PVu,Balance,Y,Angle,P0,Q0,r,c,GB,Linei,Linej,Transfori,Transforj,GenU,GenL,GenC,PG,QG,PD,QD,CenterA,PGi,PVQU,PVQL,Liner,Linex,Lineb,Transforr,Transforx,Transfork0]= ...
pf('c:/newFIle.txt');
%pf('D:\Project\\\\\9223-1_0.5_120%.txt');
%pf('D:\Project\\\919.txt');
%pf('c:/file31.txt');
%%
Loadi=QD~=0 | PD~=0;
PF=sqrt(PD(Loadi).^2./(QD(Loadi).^2+PD(Loadi).^2))
%%
Volt;
UAngel*180/3.1415926;
%% PG
AngleIJ=sparse(r,c,UAngel(r)-UAngel(c)-Angle',Busnum,Busnum);
PGBal=PD+diag(Volt)*Y.*cos(AngleIJ)*Volt';
QGBal=QD+diag(Volt)*Y.*sin(AngleIJ)*Volt';
%% -
PG0=PG;
QG0=QG;
PD0=PD;
QD0=QD;
PDReal=PD;%
QDReal=QD;%
%PD0(12)=PD0(12)+0.001;
%%
PG0(Balance)=PGBal(Balance);
PG(Balance)=PGBal(Balance);
QG0(Balance)=QGBal(Balance);
QG0(PVi)=QGBal(PVi);
QG(PVi)=QGBal(PVi);
%%
[Volt,UAngel,Init_Z,Init_W,Init_L,Init_U,Init_Y,PG,QG,RestraintCount,wPG,wQG,wPD,wQD,PD,PD0,QD,randPDind,Loadi]=OPF_Init(Busnum,Balance,PG,QG,Volt,GenU,GenL,PVi,PGi,PVQU,PVQL,PD0,QD0,QD,PD);
Gap=(Init_L*Init_Z'-Init_U*Init_W');
KK=0;
plotGap=zeros(1,60);
ContrlCount=size(PVi,1)+size(PGi,1)+size(Loadi,1)*2+Busnum*2;
kmax=60;
%% 20120523
QD_NON_ZERO=QD(PD==0 & QD~=0);
QD_NON_ZERO_IND=find(PD==0 & QD~=0);
%%
Precision=Precision/1;
%%
PD0(Loadi)=PD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
QD0(Loadi)=QD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
PG0(PGi)=PG0(PGi).*(1+normrnd(0,0.01,length(PGi),1));
QG0(PVi)=QG0(PVi).*(1+normrnd(0,0.01,length(PVi),1));
%%
%[noDataTransNum noDataTransCapacity noDataTransPowerFactor]=ReadNoDataTrans('C:/b/911_2751267_2012-09-05/iPso_911_2751267_2012-09-05_.txt');
noDataTransCapacity=0;
while(abs(Gap)>Precision)
if KK>kmax
break;
end
plotGap(KK+1)=Gap;
Init_u=Gap/2/RestraintCount*CenterA;
AngleIJMat=0;
%% OPF
%%
deltH=func_deltH(Busnum,Volt,PVi,Y,PGi,UAngel,r,c,Angle,Loadi);
%%
deltG=func_deltG(Busnum,PVi,PGi,Loadi,PD,QD);
%%
L_1Z=diag(Init_Z./Init_L);
U_1W=diag(Init_W./Init_U);
%%
deltdeltF=func_deltdeltF(PVi,wPG,wQG,wPD,wQD,ContrlCount);
%% ddHy
ddh=func_ddh(Volt,Init_Y,Busnum,PVi,PGi,Y,UAngel,r,c,Angle,Loadi,ContrlCount);
%% ddg
ddg=func_ddg(PGi,PVi,Busnum,RestraintCount,Loadi,PD,QD);
%% deltF
deltF=func_deltF(PG,QG,PVi,PGi,wPG,wQG,wPD,wQD,PG0,QG0,PD0,PD,QD,QD0,Busnum,Loadi);
thesis=ForThesis(4,8);
for II=1:4
[kmax,Precision,UAngel,Volt,Busnum,PVi,PVu,Balance,Y,Angle,P0,Q0,r,c,GB,Linei,Linej,Transfori,Transforj,GenU,GenL,GenC,PG,QG,PD,QD,CenterA,PGi,PVQU,PVQL,Liner,Linex,Lineb,Transforr,Transforx,Transfork0]= ...
pf('c:/newFIle.txt');
%pf('D:\Project\\\\\9223-1_0.5_120%.txt');
%pf('D:\Project\\\919.txt');
%pf('c:/file31.txt');
%%
Luu=Init_U'.*Init_W'+Init_u*ones(RestraintCount,1);
Lul=Init_L'.*Init_Z'-Init_u*ones(RestraintCount,1);
Mat_G=FormG(Volt,PVi,PGi,PG,QG,PD,QD,Loadi);
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,QD_NON_ZERO,QD_NON_ZERO_IND,Loadi);
Ly=Mat_H;
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,PD0,QD0,Loadi,KK,PF);
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF,noDataTransCapacity);
Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W);
YY=FormYY(Lul,Lz,Ly,Luu,Lw,Lx);
%%
fprintf(' %d Gap %f\n',KK+1,plotGap(KK+1));
XX=SolveIt(deltF,deltG,Init_L,Init_Z,Init_U,Init_W,deltdeltF,ddh,ddg,deltH,Init_Y,Ly,Lz,ContrlCount,Lw,Lul,Luu,RestraintCount,Lx,Balance,PVi,PGi,Busnum,Loadi);
%%
[deltZ,deltL,deltW,deltU,deltX,deltY]=AssignXX(XX,ContrlCount,RestraintCount,Busnum);
[Init_Z,Init_L,Init_W,Init_U,Init_Y,PG,QG,Volt,UAngel,PD,QD]=Modification(Init_Z,Init_L,Init_W,Init_U,Init_Y,deltZ,deltL,deltW,deltU,deltX,deltY,PG,QG,Volt,UAngel,PVi,ContrlCount,Balance,Busnum,PGi,PD,QD,Loadi);
%%
Loadi=QD~=0 | PD~=0;
PF=sqrt(PD(Loadi).^2./(QD(Loadi).^2+PD(Loadi).^2))
%%
Volt;
UAngel*180/3.1415926;
%% PG
AngleIJ=sparse(r,c,UAngel(r)-UAngel(c)-Angle',Busnum,Busnum);
PGBal=PD+diag(Volt)*Y.*cos(AngleIJ)*Volt';
QGBal=QD+diag(Volt)*Y.*sin(AngleIJ)*Volt';
%% -
PG0=PG;
QG0=QG;
PD0=PD;
QD0=QD;
PDReal=PD;%
QDReal=QD;%
%PD0(12)=PD0(12)+0.001;
%%
PG0(Balance)=PGBal(Balance);
PG(Balance)=PGBal(Balance);
QG0(Balance)=QGBal(Balance);
QG0(PVi)=QGBal(PVi);
QG(PVi)=QGBal(PVi);
%%
[Volt,UAngel,Init_Z,Init_W,Init_L,Init_U,Init_Y,PG,QG,RestraintCount,wPG,wQG,wPD,wQD,PD,PD0,QD,randPDind,Loadi]=OPF_Init(Busnum,Balance,PG,QG,Volt,GenU,GenL,PVi,PGi,PVQU,PVQL,PD0,QD0,QD,PD);
Gap=(Init_L*Init_Z'-Init_U*Init_W');
KK=KK+1;
KK=0;
plotGap=zeros(1,60);
ContrlCount=size(PVi,1)+size(PGi,1)+size(Loadi,1)*2+Busnum*2;
kmax=60;
%% 20120523
QD_NON_ZERO=QD(PD==0 & QD~=0);
QD_NON_ZERO_IND=find(PD==0 & QD~=0);
%%
Precision=Precision/10;
%%
PD0(Loadi)=PD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
QD0(Loadi)=QD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
% PG0(PGi)=PG0(PGi).*(1+normrnd(0,0.01,length(PGi),1));
% QG0(PVi)=QG0(PVi).*(1+normrnd(0,0.01,length(PVi),1));
%%
%[noDataTransNum noDataTransCapacity noDataTransPowerFactor]=ReadNoDataTrans('C:/b/911_2751267_2012-09-05/iPso_911_2751267_2012-09-05_.txt');
noDataTransCapacity=0;
while(abs(Gap)>Precision)
if KK>kmax
break;
end
plotGap(KK+1)=Gap;
Init_u=Gap/2/RestraintCount*CenterA;
AngleIJMat=0;
%% OPF
%%
deltH=func_deltH(Busnum,Volt,PVi,Y,PGi,UAngel,r,c,Angle,Loadi);
%%
deltG=func_deltG(Busnum,PVi,PGi,Loadi,PD,QD);
%%
L_1Z=diag(Init_Z./Init_L);
U_1W=diag(Init_W./Init_U);
%%
deltdeltF=func_deltdeltF(PVi,wPG,wQG,wPD,wQD,ContrlCount);
%% ddHy
ddh=func_ddh(Volt,Init_Y,Busnum,PVi,PGi,Y,UAngel,r,c,Angle,Loadi,ContrlCount);
%% ddg
ddg=func_ddg(PGi,PVi,Busnum,RestraintCount,Loadi,PD,QD);
%% deltF
deltF=func_deltF(PG,QG,PVi,PGi,wPG,wQG,wPD,wQD,PG0,QG0,PD0,PD,QD,QD0,Busnum,Loadi);
%%
Luu=Init_U'.*Init_W'+Init_u*ones(RestraintCount,1);
Lul=Init_L'.*Init_Z'-Init_u*ones(RestraintCount,1);
Mat_G=FormG(Volt,PVi,PGi,PG,QG,PD,QD,Loadi);
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,QD_NON_ZERO,QD_NON_ZERO_IND,Loadi);
Ly=Mat_H;
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,PD0,QD0,Loadi,KK,PF);
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF,noDataTransCapacity);
Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W);
YY=FormYY(Lul,Lz,Ly,Luu,Lw,Lx);
%%
fprintf(' %d Gap %f\n',KK+1,plotGap(KK+1));
XX=SolveIt(deltF,deltG,Init_L,Init_Z,Init_U,Init_W,deltdeltF,ddh,ddg,deltH,Init_Y,Ly,Lz,ContrlCount,Lw,Lul,Luu,RestraintCount,Lx,Balance,PVi,PGi,Busnum,Loadi);
%%
[deltZ,deltL,deltW,deltU,deltX,deltY]=AssignXX(XX,ContrlCount,RestraintCount,Busnum);
[Init_Z,Init_L,Init_W,Init_U,Init_Y,PG,QG,Volt,UAngel,PD,QD]=Modification(Init_Z,Init_L,Init_W,Init_U,Init_Y,deltZ,deltL,deltW,deltU,deltX,deltY,PG,QG,Volt,UAngel,PVi,ContrlCount,Balance,Busnum,PGi,PD,QD,Loadi);
Gap=(Init_L*Init_Z'-Init_U*Init_W');
KK=KK+1;
end
fprintf('%d\n',KK);
fprintf('%f\n',full(ObjectiveFun(PG,PG0,PGi,QG,QG0,PVi,PD,PD0,QD,QD0,wPG,wQG,wPD,wQD,Loadi)));
% DrawGap(plotGap);
%%
%Volt=full(Volt');
%PD=full(PD);
%% PD
% absPDLoad=abs( (PD(Loadi)-PD0(Loadi))./PD0(Loadi) );
absPDLoad=abs( (PD(Loadi)-PDReal(Loadi))./PDReal(Loadi) );
maxPDError=max(absPDLoad(absPDLoad<10))
absQDLoad=abs( (QD(Loadi)-QDReal(Loadi))./QDReal(Loadi) );
maxQDError=max(absQDLoad(absQDLoad<10))
disp('index');
%Loadi(absPDLoad==maxPDError);
%% 线
totalLoss=(sum(PG)-sum(PD(Loadi)))*100;
fprintf('%f(MW )\n',full(totalLoss));
fprintf('线 %f\n',full(totalLoss/sum(PG)));
%% 线
%Lineloss(Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Transfork0,Volt,UAngel);
thesis=thesis.AddPDQDPGQG(PD(Loadi),QD(Loadi),PG(Balance),QG(PVi));
end
fprintf('%d\n',KK);
fprintf('%f\n',full(ObjectiveFun(PG,PG0,PGi,QG,QG0,PVi,PD,PD0,QD,QD0,wPG,wQG,wPD,wQD,Loadi)));
DrawGap(plotGap);
%%
%Volt=full(Volt');
%PD=full(PD);
%% PD
% absPDLoad=abs( (PD(Loadi)-PD0(Loadi))./PD0(Loadi) );
absPDLoad=abs( (PD(Loadi)-PDReal(Loadi))./PDReal(Loadi) );
maxPDError=max(absPDLoad(absPDLoad<10))
absQDLoad=abs( (QD(Loadi)-QDReal(Loadi))./QDReal(Loadi) );
maxQDError=max(absQDLoad(absQDLoad<10))
disp('index');
%Loadi(absPDLoad==maxPDError);
%% 线
totalLoss=(sum(PG)-sum(PD(Loadi)))*100;
fprintf('%f(MW )\n',full(totalLoss));
fprintf('线 %f\n',full(totalLoss/sum(PG)));
%% 线
%Lineloss(Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Transfork0,Volt,UAngel);
toc
PD(Loadi)=thesis.MeanPD();
QD(Loadi)=thesis.MeanQD();
PG(Balance)=thesis.MeanPG();
QG(PVi)=thesis.MeanQG();
thesis.MaxDeviation(PG0(Balance),QG0(PVi),PD0(Loadi),QD0(Loadi));
thesis.StatDeviation(PG0(Balance),QG0(PVi),PD0(Loadi),QD0(Loadi))
toc

View File

@ -17,8 +17,8 @@ tPL=sparse(GenL(:,2));%
tQL=sparse(PVQL(:,1));%
PG(PGi)=(tPU+tPL)/2;
QG(PVi)=(tQU+tQL)/2;
wPG=100*ones(size(PGi,1),1);
wQG=100*ones(size(PVi,1),1);
wPG=0*ones(size(PGi,1),1);
wQG=0*ones(size(PVi,1),1);
%randInt=randperm(size(Loadi,1));
%randPDind=randInt(1:10);
randPDind=0;