您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 能源与动力工程 > 电力系统分析大作业-
电力系统分析程序设计专业班级姓名学号日期电力系统分析大作业1要求计算所给系统的潮流,设发电机G1的端电压为1p.u.,发出的有功、无功可调;发电机G2的端电压为1p.u.,按指定的有功P=0.5p.u.发电,取ε=10-4。SB=100MVA,UB=Uav。G1G21:1.05220.025+j0.08L10.03+j0.10.18+j0.121j0.19051:1.0522j0.19050.02+j0.06j0.05j0.05j0.050.8055+j0.53203245电力系统分析大作业2一牛顿—拉夫逊法(1)程序代码clear;clc;%节点编号,5号为平衡节点,4号为PV节点,1、2、3号为PQ节点%输入原始数据,求节点导纳矩阵y=0;y(1,1)=1/(0.03+0.1i)+1/(0.025+0.08i)+0.09i+0.07i;y(1,2)=-1/(0.025+0.08i);y(1,3)=-1/(0.03+0.1i);y(2,1)=-1/(0.025+0.08i);y(2,2)=1/(0.02+0.06i)+1/(0.025+0.08i)+0.05i+0.07i+1/1.0522^2*1/(0.1905i);y(2,3)=-1/(0.02+0.06i);y(2,4)=4.9889i;y(3,1)=-1/(0.03+0.1i);y(3,2)=-1/(0.02+0.06i);y(3,3)=7.7523-28.7757i;y(3,5)=4.9889i;y(4,2)=4.9889i;y(4,4)=-5.2493i;y(5,3)=4.9889i;电力系统分析大作业3y(5,5)=-5.2493i;Y=y;display('导纳矩阵为:');Y%Y为导纳矩阵G=real(Y);B=imag(Y);%原始节点功率Pg=zeros(1,5);Qg=zeros(1,5);Pd=zeros(1,5);Qd=zeros(1,5);S(1)=-0.8055-0.5320i;S(2)=-0.18-0.12i;S(3)=0;S(4)=0.5;S(5)=0;P=real(S);Q=imag(S);%赋初值U=ones(1,5);a=zeros(1,5);电力系统分析大作业4dx=ones(7,1);fx=ones(7,1);count=0;%计算迭代次数while(max(fx)1e-4)%收敛判据fori=1:4forj=1:4H(i,j)=0;dP(i)=0;endendfori=1:3forj=1:3L(i,j)=0;dQ(i)=0;endendfori=1:4forj=1:3N(i,j)=0;endendfori=1:3电力系统分析大作业5forj=1:4K(i,j)=0;endend%P%失配功率表达式fori=1:4x=0;forj=1:5%dP(i)=dP(i)-U(i)*U(j)*(G(i,j)*cos(a(i)-a(j))+B(i,j)*sin(a(i)-a(j)));x=x+U(i)*U(j)*(G(i,j)*cos(a(i)-a(j))+B(i,j)*sin(a(i)-a(j)));enddP(i)=P(i)-x;endfori=1:3y=0;forj=1:5y=y+(U(i)*U(j)*(G(i,j)*sin(a(i)-a(j))-B(i,j)*cos(a(i)-a(j))));enddQ(i)=Q(i)-y;endfx=[dP,dQ]';%求雅克比矩阵电力系统分析大作业6%当i~=j时候求H,N,K,L如下:fori=1:4forj=1:5ifi~=jH(i,i)=H(i,i)+U(i)*U(j)*(G(i,j)*sin(a(i)-a(j))-B(i,j)*cos(a(i)-a(j)));endendendfori=1:4forj=1:4ifi~=jH(i,j)=-U(i)*U(j)*(G(i,j)*sin(a(i)-a(j))-B(i,j)*cos(a(i)-a(j)));endendendfori=1:3x=0;forj=1:5ifi~=jx=x+(-(U(j)*(G(i,j)*cos(a(i)+a(j))+B(i,j)*sin(a(i)-a(j)))));endend电力系统分析大作业7N(i,i)=-2*U(i)*G(i,i)+x;endfori=1:4forj=1:3ifi~=jN(i,j)=-U(i)*(G(i,j)*cos(a(i)-a(j))+B(i,j)*sin(a(i)-a(j)));endendendfori=1:3forj=1:5ifi~=jK(i,i)=K(i,i)-U(i)*U(j)*(G(i,j)*cos(a(i)-a(j))+B(i,j)*sin(a(i)-a(j)));endendendfori=1:3forj=1:4ifi~=jK(i,j)=U(i)*U(j)*(G(i,j)*cos(a(i)-a(j))+B(i,j)*sin(a(i)-a(j)));endend电力系统分析大作业8endfori=1:3x=0;forj=1:5ifi~=jx=x+(-(U(j)*(G(i,j)*sin(a(i)-a(j))-B(i,j)*cos(a(i)-a(j)))));endendL(i,i)=2*U(i)*B(i,i)+x;endfori=1:3forj=1:3ifi~=jL(i,j)=-U(i)*(G(i,j)*sin(a(i)-a(j))-B(i,j)*cos(a(i)-a(j)));endendendJ=[H,N;K,L];%J为雅克比矩阵dx=-((inv(J))*fx);fori=1:4da(i)=dx(i);end电力系统分析大作业9fori=1:3dU(i)=dx(i+4);endfori=1:4a(i)=a(i)+da(i);endfori=1:3U(i)=U(i)+dU(i);endcount=count+1;end%求节点注入的净功率i=5;forj=1:5P(i)=P(i)+U(i)*U(j)*(G(i,j)*cos(a(i)-a(j))+B(i,j)*sin(a(i)-a(j)));Q(i)=Q(i)+U(i)*U(j)*(G(i,j)*sin(a(i)-a(j))-B(i,j)*cos(a(i)-a(j)));endS(5)=P(5)+Q(5)*sqrt(-1);ifcount==3display('最终结果为:');电力系统分析大作业10H,N,K,Ldisplay('雅可比矩阵如下:');Jdisp('//************************************************************************************//')a./pi*180disp('//************************************************************************************//')fx,dx,U,adisplay('迭代次数为:');countdisplay('节点注入净功率如下:');S%求节点注入电流display('节电注入电流如下:');I=Ydisplay('迭代次数为:');countend电力系统分析大作业11运算结果如下:导纳矩阵为:最终结果为:H=-20.602111.38949.2127011.5923-32.239815.59475.05289.395815.6419-30.1181005.05280-5.0528N=-5.61273.84733.02673.2930-8.72645.15802.50655.0456-8.09920-0.49140K=7.0121-3.9156-3.09650-3.26619.0432-5.2770-0.5001-2.4861-5.13528.11210电力系统分析大作业12L=-19.699511.19079.005011.6878-31.442415.24319.473215.3690-29.4399雅可比矩阵如下://************************************************************************************//ans=-7.4732-5.8532-5.5850-0.20060//************************************************************************************//fx=-0.0017-0.0021-0.0020-0.0001-0.0003电力系统分析大作业13-0.0004-0.0004dx=-0.0013-0.0013-0.0012-0.0013-0.0003-0.0002-0.0002U=0.99161.01751.02291.00001.0000a=-0.1304-0.1022-0.0975-0.00350迭代次数为:count=3节点注入净功率如下:S=-0.8055-0.5320i-0.1800-0.1200i00.50000.4966+0.1706i节电注入电流如下:电力系统分析大作业14迭代次数为:count=3二P—Q解耦迭代程序代码n=5;m=3;%各参数初始化Y=zeros(n,n);%导纳矩阵U=ones(n,1);%电压矢量a=zeros(n,1);%相角矢量Ps=zeros(n,1);Qs=zeros(n,1);P=zeros(n,1);Q=zeros(n,1);p=zeros(n-1,1);q=zeros(m,1);aa=zeros(n-1,1);电力系统分析大作业15u=zeros(m,1);k=0;%节点导纳矩阵的生成I=sqrt(-1);%由于后面用到ij作为循环变量,故重定义虚数单位Y=[6.311-I*20.3722-2.7523+I*9.1743-3.5587+I*11.387900;-3.5587+I*11.38798.5587-I*30.9993-5+I*15I*4.98890;-2.7523+I*9.1743-5+I*157.7523-I*28.75570I*4.9889;0I*4.98890-I*5.24930;00I*4.98890-I*5.2493];%初值的设定U=[1;1;1;1;1];a=[0;0;0;0;0];Ps=[-0.8055;-0.18;0;0.5;0];Qs=[-0.532;-0.12;0;0;0];%求失配功率△P(k)和△Q(k)fori=1:n-1s=0;forj=1:ns=s+U(j)*(real(Y(i,j))*cos(a(i)-a(j))+imag(Y(i,j))*sin(a(i)-a(j)));endP(i)=U(i)*s;end电力系统分析大作业16fori=1:n-1s=0;forj=1:ns=s+U(j)*(real(Y(i,j))*sin(a(i)-a(j))-imag(Y(i,j))*cos(a(i)-a(j)));endQ(i)=U(i)*s;endfori=1:n-1detp(i)=Ps(i)-P(i);endfori=1:mdetq(i)=Qs(i)-Q(i);end%生成B'和B矩阵Bp=zeros(n-1,n-1);Bpp=zeros(m,m);fori=1:n-1;forj=1:n-1;Bp(i,j)=imag(Y(i,j));end;end;fori=1:m;电力系统分析大作业17forj=1:m;Bpp(i,j)=imag(Y(i,j));end;end;k=0;while(max([detp])=0.0001|max([detq])=0.0001)%设定精确度aa=(-1)*inv(Bp)*[detp(1)/U(1);detp(2)/U(2);detp(3)/U(3);detp(4)/U(4)];u=(-
本文标题:电力系统分析大作业-
链接地址:https://www.777doc.com/doc-2206245 .html