增加线损,变压器损耗。损耗排序.
Signed-off-by: unknown <dmy@dmy-PC.(none)>
This commit is contained in:
parent
cf14e01a87
commit
5e0f4c2520
|
|
@ -0,0 +1,28 @@
|
|||
%% 计算线损
|
||||
function Lineloss(Linei,Linej,Liner,Linex,Lineb2,Transi,Transj,Transr,Transx,k0,Volt,Angle)
|
||||
%format long
|
||||
fprintf('功率为有名值\n');
|
||||
fprintf('节点号\t节点号\t有功')
|
||||
cmpVolt=Volt.*cos(Angle)+1i*Volt.*sin(Angle);
|
||||
cmpVolt=cmpVolt';
|
||||
y0=1i*Lineb2;
|
||||
%yj0=1i*standardinput(:,7);
|
||||
yij=1./(Liner+1i*Linex);
|
||||
%% 线路损耗
|
||||
Sij=cmpVolt(Linei).*conj( cmpVolt(Linei) .* y0 + ( cmpVolt(Linei)- cmpVolt(Linej) ).*yij );
|
||||
Sji=cmpVolt(Linej).*conj( cmpVolt(Linej) .*y0 + ( cmpVolt(Linej)- cmpVolt(Linei) ).*yij );
|
||||
%Sij1==Sij2
|
||||
deltLineS=Sij+Sji;
|
||||
dispLineloss=[Linei Linej real(deltLineS)*100 imag(deltLineS)*100];
|
||||
%full(dispLineloss)
|
||||
dispLineloss=sortrows(dispLineloss,-3);
|
||||
full(dispLineloss)
|
||||
%% 以下是变压器损耗
|
||||
yij=1./(Transr+1i*Transx);
|
||||
Sij=cmpVolt(Transi)./k0.*conj( ( cmpVolt(Transi)./k0- cmpVolt(Transj) ).*yij );
|
||||
Sji=cmpVolt(Transj).*conj( ( cmpVolt(Transj)- cmpVolt(Transi)./k0 ).*yij );
|
||||
deltTransS=Sij+Sji;
|
||||
dispTransloss=[Transi Transj real(deltTransS)*100 imag(deltTransS)*100];
|
||||
dispTransloss=sortrows(dispTransloss,-3);
|
||||
full(dispTransloss)
|
||||
end
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
%% 计算线损
|
||||
function Lineloss(Linei,Linej,Liner,Linex,Lineb2,Transi,Transj,Transr,Transx,k0,Volt,Angle)
|
||||
%format long
|
||||
fprintf('功率为有名值\n');
|
||||
fprintf('节点号\t节点号\t有功损耗 MW\t无功损耗 MVar')
|
||||
cmpVolt=Volt.*cos(Angle)+1i*Volt.*sin(Angle);
|
||||
cmpVolt=cmpVolt';
|
||||
y0=1i*Lineb2;
|
||||
%yj0=1i*standardinput(:,7);
|
||||
yij=1./(Liner+1i*Linex);
|
||||
%% 线路损耗
|
||||
Sij=cmpVolt(Linei).*conj( cmpVolt(Linei) .* y0 + ( cmpVolt(Linei)- cmpVolt(Linej) ).*yij );
|
||||
Sji=cmpVolt(Linej).*conj( cmpVolt(Linej) .*y0 + ( cmpVolt(Linej)- cmpVolt(Linei) ).*yij );
|
||||
%Sij1==Sij2
|
||||
deltLineS=Sij+Sji;
|
||||
dispLineloss=[Linei Linej real(deltLineS)*100 imag(deltLineS)*100];
|
||||
%full(dispLineloss)
|
||||
dispLineloss=sortrows(dispLineloss,-3);
|
||||
full(dispLineloss)
|
||||
%% 以下是变压器损耗
|
||||
yij=1./(Transr+1i*Transx);
|
||||
Sij=cmpVolt(Transi)./k0.*conj( ( cmpVolt(Transi)./k0- cmpVolt(Transj) ).*yij );
|
||||
Sji=cmpVolt(Transj).*conj( ( cmpVolt(Transj)- cmpVolt(Transi)./k0 ).*yij );
|
||||
deltTransS=Sij+Sji;
|
||||
dispTransloss=[Transi Transj real(deltTransS)*100 imag(deltTransS)*100];
|
||||
dispTransloss=sortrows(dispTransloss,-3);
|
||||
full(dispTransloss)
|
||||
end
|
||||
36
OPF.asv
36
OPF.asv
|
|
@ -1,22 +1,30 @@
|
|||
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]= ...
|
||||
pf('D:\Project\最小化潮流\最小潮流算例\金湖924(2-1)_0.5_85%.txt');
|
||||
pf('D:\Project\最小化潮流\最小潮流算例\原始\standard.txt');
|
||||
%pf('D:\Project\最小化潮流\最小潮流算例\仙海919.txt');
|
||||
%pf('c:/file31.txt');
|
||||
%pf('ieee10471PG.dat');
|
||||
%pf('ieee118PG.dat');
|
||||
|
||||
%PVi电压节点序号
|
||||
%PVu电压节点电压标幺值
|
||||
%% 计算功率因数
|
||||
%atan(PD(QD~=0 | PD~=0)./QD(QD~=0 | PD~=0));
|
||||
Volt;
|
||||
UAngel*180/3.1415926;
|
||||
%% 通过潮流计算PG
|
||||
AngleIJ=sparse(r,c,UAngel(r)-UAngel(c)-Angle',Busnum,Busnum);
|
||||
dP=PG-PD-diag(Volt)*Y.*cos(AngleIJ)*Volt';
|
||||
PG0()
|
||||
%% 初值
|
||||
PGBal=diag(Volt)*Y.*cos(AngleIJ)*Volt';
|
||||
|
||||
%% 初值-即测量值
|
||||
PG0=PG;
|
||||
PD0=PD;
|
||||
[Volt,UAngel,Init_Z,Init_W,Init_L,Init_U,Init_Y,PG,QG,RestraintCount,wG,wD,PD,PD0,randPDind,Loadi]=OPF_Init(Busnum,Balance,PG,QG,Volt,GenU,GenL,PVi,PGi,PVQU,PVQL,PD0,QD);
|
||||
|
||||
PDReal=PD;%真值
|
||||
%PD0(12)=PD0(12)+0.001;
|
||||
%%
|
||||
PG0(Balance)=PGBal(Balance);
|
||||
%%
|
||||
[Volt,UAngel,Init_Z,Init_W,Init_L,Init_U,Init_Y,PG,QG,RestraintCount,wG,wD,PD,PD0,randPDind,Loadi]=OPF_Init(Busnum,Balance,PG,QG,Volt,GenU,GenL,PVi,PGi,PVQU,PVQL,PD0,QD,PD);
|
||||
Gap=(Init_L*Init_Z'-Init_U*Init_W');
|
||||
KK=0;
|
||||
plotGap=zeros(1,50);
|
||||
|
|
@ -72,9 +80,15 @@ fprintf('
|
|||
ObjectiveFun(PG,PG0,PGi,PD,PD0,wG,wD,Loadi)
|
||||
DrawGap(plotGap);
|
||||
%%
|
||||
Volt=full(Volt');
|
||||
PD=full(PD);
|
||||
%Volt=full(Volt');
|
||||
%PD=full(PD);
|
||||
%% 统计PD误差
|
||||
abs( (PD(Loadi)-PD0(Loadi))./PD0(Loadi) )
|
||||
% absPDLoad=abs( (PD(Loadi)-PD0(Loadi))./PD0(Loadi) );
|
||||
absPDLoad=abs( (PD(Loadi)-PDReal(Loadi))./PDReal(Loadi) );
|
||||
maxPDError=max(absPDLoad);
|
||||
disp('index');
|
||||
Loadi(absPDLoad==maxPDError);
|
||||
%% 计算线损
|
||||
Lineloss(Linei,Linej,Liner,Linex,Lineb2,Transfori,Transj,Transx,k0,Volt,Angle)
|
||||
toc
|
||||
|
||||
|
|
|
|||
15
OPF.m
15
OPF.m
|
|
@ -1,8 +1,8 @@
|
|||
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]= ...
|
||||
pf('D:\Project\×îС»¯³±Á÷\×îС³±Á÷ËãÀý\Ôʼ\standard.txt');
|
||||
[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('D:\Project\×îС»¯³±Á÷\×îС³±Á÷ËãÀý\Ôʼ\½òÍ·Õ¾½òÊÓ922£¨3-1£©_0.5_120%.txt');
|
||||
%pf('D:\Project\最小化潮流\最小潮流算例\仙海919.txt');
|
||||
%pf('c:/file31.txt');
|
||||
%pf('ieee118PG.dat');
|
||||
|
|
@ -77,7 +77,7 @@ while(abs(Gap)>Precision)
|
|||
KK=KK+1;
|
||||
end
|
||||
fprintf('迭代次数%d\n',KK);
|
||||
ObjectiveFun(PG,PG0,PGi,PD,PD0,wG,wD,Loadi)
|
||||
fprintf('Ä¿±êÖµ%f\n',full(ObjectiveFun(PG,PG0,PGi,PD,PD0,wG,wD,Loadi)));
|
||||
DrawGap(plotGap);
|
||||
%%
|
||||
%Volt=full(Volt');
|
||||
|
|
@ -85,9 +85,10 @@ DrawGap(plotGap);
|
|||
%% 统计PD误差
|
||||
% absPDLoad=abs( (PD(Loadi)-PD0(Loadi))./PD0(Loadi) );
|
||||
absPDLoad=abs( (PD(Loadi)-PDReal(Loadi))./PDReal(Loadi) );
|
||||
maxPDError=max(absPDLoad)
|
||||
disp('index')
|
||||
Loadi(absPDLoad==maxPDError)
|
||||
|
||||
maxPDError=max(absPDLoad);
|
||||
disp('index');
|
||||
Loadi(absPDLoad==maxPDError);
|
||||
%% ¼ÆËãÏßËð
|
||||
Lineloss(Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Transfork0,Volt,UAngel);
|
||||
toc
|
||||
|
||||
|
|
|
|||
2
pf.m
2
pf.m
|
|
@ -1,4 +1,4 @@
|
|||
function [kmax,Precision,Uangle,U,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]=pf(FileName)
|
||||
function [kmax,Precision,Uangle,U,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(FileName)
|
||||
%**************************************************************************
|
||||
% 程序名称:电力系统潮流计算程序
|
||||
% 程序算法:极坐标下的牛顿-拉夫逊法
|
||||
|
|
|
|||
Loading…
Reference in New Issue