潮流计算matlab_牛顿拉夫逊法法_第1页
潮流计算matlab_牛顿拉夫逊法法_第2页
潮流计算matlab_牛顿拉夫逊法法_第3页
潮流计算matlab_牛顿拉夫逊法法_第4页
潮流计算matlab_牛顿拉夫逊法法_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、实用标准文案用matlab潮流计算牛顿拉夫逊法%主程序:dfile,pathname=uigetfile(ieee14.m,SelectDataFile)ifpathname=0error(youmustselectavaliddatafile)elseendend;bus=PQ;PV;SW;newbus=1:nb;f=bus(:,1);nodenum=newbusbus(:,1);bus(:,1)=newbus;fori=1:nlforj=1:2fork=1:nbifline(i,j)=nodenum(k,2)line(i,j)=nodenum(k,1);breakendendendendY

2、=y(bus,line);%形成节点导纳矩阵K=0;%迭代次数初值精彩文档实用标准文案lfile=length(dfile);%stripoff.meval(dfile(1:lfile-2);%endglobaln;globalm;nb,mb=size(bus);%nl,ml=size(line);nSW=0;%nPV=0;%PVnPQ=0;%PQfori=1:nb,%nbtype=bus(i,6);iftype=3,nSW=nSW+1;%SW(nSW,:)=bus(i,:);elseiftype=2,nPV=nPV+1;%PV(nPV,:)=bus(i,:);elsenPQ=nPQ+1;%P

3、Q(nPQ,:)=bus(i,:);翻开数据文件节点重新编号平衡节点数目节点数目节点数目为总节点数统计平衡节点数目统计PV节点数目统计PQ节点数目Kmax=10;%最大迭代次数eps1=1.0e-10;eps2=1.0e-10;m=nPQ;n=nb;Um=eye(m,m);myf=fopen(output1.dat,w);forK=1:Kmaxfori=1:mforj=1:mifi=jUm(i,j)=bus(i,2);endendendb=dPQ(Y,bus);C=jac(bus,Y);dX=Cb;dx=dX;nx,mx=size(dx);fori=1:n-1%计算相角bus(i,3)=bus

4、(i,3)-dX(i,1);endB=dx(nx,n:mx)*Um;%计算电压差bus(1:m,2)=bus(1:m,2)-B;%计算电压值dx(nx,n:mx)=B;fprintf(myf,-第次迭代时雅可比矩阵-,K)fprintf(myf,n);fori=1:(n+m-1)forj=1:(n+m-1)fprintf(myf,%8.6f,C(i,j);fprintf(myf,);endfprintf(myf,n);endfprintf(myf,-第次迭代时dPQ的误差-,K)fprintf(myf,n);fori=1:(n+m-1)fprintf(myf,%8.6e,b(1,i);fpri

5、ntf(myf,n);endfprintf(myf,n);fprintf(myf,-第次迭代时dx(误差)-,K)fprintf(myf,n);fori=1:(n+m-1)fprintf(myf,%8.6e,dX(i,1);fprintf(myf,n);endfprintf(myf,n);精彩文档实用标准文案fprintf(myf,第d次迭代后节点电压(仅PQ节点),K)fprintf(myf,n);fori=1:mfprintf(myf,%8.6f,bus(i,2);fprintf(myf,n);endfprintf(myf,n);fprintf(myf,第d次迭代后相角(角度),K)fpr

6、intf(myf,n);fori=1:nfprintf(myf,%8.6f,bus(i,3)*180/pi);fprintf(myf,n);endfprintf(myf,n);if(max(abs(dx)eps1)&(max(abs(b)bus(l,1)r=bus(t,:);bus(t,:)=bus(l,:);bus(l,:)=r;endendendfori=1:nlforj=1:2fork=1:nbifline(i,j)=nodenum(k,1)精彩文档实用标准文案line(i,j)=nodenum(k,2);breakendendendendfclose(myf);Pf=loss(

7、bus,line);%计算支路潮流及损耗%将节点导纳矩阵、节点潮流计算结果写入文件output2myf=fopen(output2.dat,w);fprintf(myf,-节点导纳矩阵-n);fork=1:nforj=1:nfprintf(myf,%8.6f,real(Y(k,j);fprintf(myf,+i*);fprintf(myf,%8.6f,imag(Y(k,j);fprintf(myf,);endfprintf(myf,n);endfprintfmyf,牛顿拉夫逊法潮流计算结果n;fprintfmyf,节点计算结果n;fprintfmyf,-节点节点电压节点相角注入有功功率P注入无

8、功功率Q类型-n;forl=1:nbforj=1:mbifj=1|j=6fprintf(myf,%8.1f,bus(l,j);elseifj=3fprintf(myf,%8.6f,bus(l,j)*180/pi);elsefprintf(myf,%8.6f,bus(l,j);endendfprintf(myf,n);endfprintf(myf,-支路计算结果-n);fprintf(myf,-节点(I)节点(J)线路功率S(I,J)线路功率S(J,I)线路损耗dS(I,J)-n);fork=1:nlforj=1:5ifj0%K0时变压器支路Y(I,I)=Y(I,I)+Yt+Ym;Y(J,J)=

9、Y(J,J)+Yt/KA2;Y(I,J)=Y(I,J)-Yt/K;Y(J,I)=Y(I,J);endifK0%K0%变压器支路k0时的潮流S(I,J)=bus(I,2)A2*(conj(Ym+Yt*(1-1/K)+conj(Yt/K)-bus(I,2)*(cos(bus(I,3)+i*sin(bus(I,3)*bus(J,2)*(cos(bus(J,3)-i*sin(bus(J,3)*conj(Yt/K);S(J,I)=bus(J,2)A2*(conj(Yt)/KA2-bus(J,2)*(cos(bus(J,3)+i*sin(bus(J,3)*bus(I,2)*(cos(bus(I,3)-i*

10、sin(bus(I,3)*conj(Yt/K);delS(I,J)=S(I,J)+S(J,I);endifK0%变压器支路k0时的潮流S(I,J)=bus(I,2)A2*(conj(Ym+Yt)+bus(I,2)*(cos(bus(I,3)+i*sin(bus(I,3)*bus(J,2)*(cos(bus(J,3)-i*sin(bus(J,3)*conj(Yt*K);S(J,I)=bus(J,2)A2*(conj(Yt)*KA2+bus(J,2)*(cos(bus(J,3)+i*sin(bus(J,3)*bus(I,2)*(cos(bus(I,3)-i*sin(bus(I,3)*conj(Yt

11、*K);delS(I,J)=S(I,J)+S(J,I);endifJ=5&Zt=0Sp=line(k,1)line(k,2)S(I,5)0S(I,5);精彩文档实用标准文案elseSp=line(k,1)line(k,2)S(I,J)S(J,I)delS(I,J);endPf(k,:)=Sp;end%输入的参数数据:%datafortestcase%各节点参数:节点编号,注入有功,注入无功,(Sn=100MVA)电压幅值,电压相位,类型履型:1=PQ节点,2=PV节点,3=平衡节点%(bus#)(volt)(ang)(p)(q)(bustype)bus=1,1.0,0.0,-0.478

12、,0.039,1;2,1.0,0.0,-0.076,-0.016,1;3,1.0,0.0,0.0,0.0,1;4,1.0,0.0,-0.295,-0.166,1;5,1.0,0.0,-0.09,-0.058,1;6,1.0,0.0,-0.035,-0.018,1;7,1.0,0.0,-0.061,-0.016,1;8,1.0,0.0,-0.135,-0.058,1;9,1.0,0.0,-0.149,-0.05,1;10,1.045,0.0,0.183,0.0,2;11,1.010,0.0,-0.942,0.0,2;12,1.70,0.0,-0.112,0.047,2;13,1.90,0.0,0

13、.0,0.174,2;14,1.060,0.0,0.0,0.0,3;%各支路参数:起点编号,终点编号,电阻,电抗,电导,电纳line=1,2,0.01335,0.04211,0.0,0.0,0;1,3,0.0,0.20912,0.0,0.0,0;1,4,0.0,0.55618,0.0,0.0,0;1,10,0.05811,0.17632,0.0,0.0340,0;1,11,0.06701,0.17103,0.0,0.0128,0;2,10,0.05695,0.17388,0.0,0.0346,0;2,12,0.0,0.25202,0.0,0.0,0;2,14,0.05403,0.22304,0

14、.0,0.0492,0;3,4,0.0,0.11001,0.0,0.0,0;3,13,0.0,0.17615,0.0,0.0,0;4,5,0.03181,0.08450,0.0,0.0,0;4,9,0.12711,0.27038,0.0,0.0,0;5,6,0.08205,0.19207,0.0,0.0,0;6,12,0.09498,0.19890,0.0,0.0,0;7,8,0.22092,0.19988,0.0,0.0,0;7,12,0.12291,0.25581,0.0,0.0,0;8,9,0.17093,0.34802,0.0,0.0,0;8,12,0.06615,0.13027,0.

15、0,0.0,0;10,11,0.04699,0.19797,0.0,0.0438,0;精彩文档10,14,0.01938,0.05917,0.0,0.0528,0;输出结果数据1:- -第1次迭代时雅可比矩阵-38.62403321.5785544.7819431.797979-0.000000-0.000000-0.000000-0.000000-0.0000005.3460515.119505-0.000000-0.000000-10.4172586.840981-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.0000002

16、1.578554-38.240787-0.000000-0.000000-0.000000-0.000000-0.000000- 0.0000005.427654-0.0000006.745496-0.0000006.840981-9.429913-0.000000-0.000000- 0.000000-0.000000-0.000000-0.000000-0.0000004.781943-0.000000-24.6582889.090083-0.000000-0.000000-0.000000-0.000000-0.000000- 0.000000-0.000000-0.00000010.7

17、86262-0.000000-0.000000-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.0000001.797979-0.0000009.090083-24.28250610.365394-0.000000-0.000000-0.0000003.029050- 0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-5.3260553.902050- 0.000000-0.000000-0.0000001.424005- 0.000000-0.0000

18、00-0.00000010.365394-14.7683384.402944-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.0000003.902050-5.7829341.880885-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.0000004.402944-11.362870-0.000000-0.000000-0.000000- 0.000000-0.0000006.959926-0.000000-

19、0.000000-0.000000-0.000000-0.0000001.880885- 2.467393-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-7.6511132.251975-0.000000- 0.000000-0.0000005.399139-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000- 0.000000-2.9468152.489025-0.000000- 0.000000-0.000000-0.

20、000000-0.000000-0.000000-0.0000002.251975-14.9416222.314963- 0.000000-0.00000010.374684-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000- 0.0000002.489025-4.5556971.136994- 0.000000-0.000000-0.0000003.029050-0.000000-0.000000-0.0000002.314963-5.344014- 0.000000-0.000000-0.000000-0.000000-0.0000

21、00-0.000000-0.0000001.424005-0.000000- 0.000000-0.0000001.136994-2.5610005.3460515.427654-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000- 32.7276445.047017-0.000000-0.0000001.7619051.777691-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.0000005.119505-0.000000-0.000000-0.00

22、0000-0.000000-0.000000-0.000000-0.000000-0.0000005.047017-10.166523-0.000000-0.0000002.005835-0.000000-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.000000- 0.0000006.745496-0.000000-0.000000-0.0000006.9599265.39913910.374684-0.000000- 0.000000-0.000000-29.479246-0.000000-0.000000-0.00000

23、0-0.000000- 0.0000003.3235492.5941455.268177-0.000000- 0.000000-0.00000010.786262-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-10.786262-0.000000-0.000000-0.000000- 0.000000-0.000000-0.000000-0.000000-0.00000010.608721-6.8409810.0000000.0000000.0000000.0000000.00

24、00000.000000- 1.761905-2.0058350.0000000.000000-37.96863121.5785544.7819431.797979-0.000000- 0.000000-0.000000-0.000000-0.000000- 6.8409819.7061230.0000000.0000000.0000000.0000000.0000000.000000-1.7776910.0000000.0000000.00000021.578554-31.542421-0.000000-0.000000-0.000000实用标准文案精彩文档实用标准文案-0.000000-0

25、.000000-0.000000-0.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000004.781943-0.000000-14.4397249.090083-0.000000-0.0000000.000000-0.000000-0.000000-0.0000000.0000000.0000005.326055-3.9020500.0000000.0000000.000000-1.4240050.0000000.0000000

26、.0000000.0000001.797979-0.0000009.090083-24.28250610.365394-0.0000000.000000-0.000000-0.0000003.0290500.0000000.000000-3.9020505.782934-1.8808850.0000000.0000000.0000000.0000000.0000000.0000000.000000-0.000000-0.000000-0.00000010.365394-14.7683384.4029440.000000-0.000000-0.000000-0.0000000.0000000.0

27、000000.000000-1.8808855.2044330.0000000.0000000.0000000.0000000.000000-3.3235490.000000-0.000000-0.000000-0.000000-0.0000004.402944-5.6311660.000000-0.000000-0.000000-0.0000000.0000000.0000000.0000000.0000000.0000005.083169-2.4890250.0000000.0000000.000000-2.5941450.000000-0.000000-0.000000-0.000000

28、-0.000000-0.000000-0.000000-3.2047642.251975-0.0000000.0000000.0000000.0000000.0000000.0000000.000000-2.4890258.894195-1.1369940.0000000.000000-5.2681770.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.0000002.251975-6.3977652.3149630.0000000.0000000.000000-1.4240050.0000000.0000000.000000-1.1

29、369942.5610000.0000000.0000000.0000000.000000-0.000000-0.000000-0.0000003.029050-0.000000-0.000000-0.0000002.314963-5.344014-第1次迭代时dPQ的误差-3.822688e-0016.210513e-0020.000000e+000-2.950000e-001-9.000000e-0021.333520e+0001.007177e+0002.034249e+000-1.490000e-0016.056626e-002-9.219354e-001-7.942109e+0000

30、.000000e+0003.667009e-0013.333183e+0005.109282e+000-1.660000e-001-5.800000e-0022.847852e+0002.207175e+0004.213929e+000-5.000000e-002-第1次迭代时dx误差-7.699084e-001-0.000000-0.000000-0.0000000.0000000.000000精彩文档实用标准文案-8.544764e-001-1.189723e+000-1.410571e+000-1.585607e+000-1.994895e+000-2.196974e+000-2.162

31、427e+000-1.721659e+000-4.249173e-001-6.178169e-001-2.246296e+000-1.189723e+000-5.568104e-001-5.586033e-001-1.299237e+000-1.208867e+000-1.285646e+000-1.499291e+000-2.011550e+000-1.901143e+000-1.488513e+000第1次迭代后节点电压仅PQ节点1.5568101.5586032.2992372.2088672.2856462.4992913.0115502.9011432.488513第1次迭代后相角角

32、度44.11250048.95789268.16611180.81979290.848607114.299041125.877362123.89794698.64381324.34596735.398301128.70329568.1661110.000000精彩文档实用标准文案-第2次迭代时雅可比矩阵-88.46859650.77006215.6304994.9568020.0000000.0000000.0000000.0000008.7600318.3512030.0000000.000000-17.67902420.9626216.9766783.695668-0.000000-0.0

33、00000-0.000000-0.00000053.574257-70.1633000.0000000.0000000.0000000.0000000.0000000.0000008.844924-0.0000001.8716490.00000012.117328-29.191523-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.00000015.630499-0.000000-85.47526245.0445950.0000000.0000000.0000000.000000-0.000000-0.0000000.000000

34、24.800168-6.976678-0.0000003.13630210.112981-0.000000-0.000000-0.000000-0.000000-0.0000004.956802-0.00000045.044595-111.55769648.1013580.0000000.0000000.00000013.454941-0.000000-0.0000000.000000-0.000000-3.695668-0.000000-10.11298128.512426-0.000000-0.000000-0.00000012.548251-0.000000-0.000000-0.000

35、00054.962689-73.76120518.7985160.0000000.0000000.000000-0.000000-0.0000000.000000-0.000000-0.000000-0.000000-0.00000010.286004-30.26975019.866386-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.00000027.350216-42.1319390.0000000.000000-0.000000-0.000000-0.00000014.781722-0.000000-0.000000-0.

36、000000-0.000000-0.000000-0.152201-35.701334-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-36.269587-0.000000-0.000000-0.00000015.854836-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-43.16898221.053877-0.000000-0.000000-0.000000-0.000000-0.000000-0.

37、000000-0.00000018.91248618.617657-0.000000-0.00000028.712316-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.00000022.413069-72.7446070.293713-0.000000-0.000000-0.00000018.246829-0.0000000.0000000.00000011.613550-29.860379-0.000000-0.0000000.000000-0.000000-0.000000-0.000000-0.0000002.355263

38、-0.000000-0.000000-0.00000014.554342-14.8093936.9047626.5370840.0000000.0000000.0000000.000000-0.000000-0.000000-35.8518614.723753-0.0000000.0000005.3960026.042147-0.000000-0.000000-0.000000-0.0000000.0000000.000000-0.0000007.4049870.0000000.0000000.0000000.0000000.000000-0.0000000.0000005.183063-12

39、.588050-0.0000000.0000004.294174-0.000000-0.000000-0.000000-0.000000-0.0000000.000000-0.000000-0.000000-0.0000001.871649-0.000000-0.000000-0.00000018.91440916.62516731.272979-0.000000-0.000000-0.000000-68.684204-0.000000-0.000000-10.345614-0.000000-0.0000003.7182157.00125812.708639-0.000000-0.000000

40、-0.00000024.8001680.0000000.0000000.0000000.0000000.000000-0.000000-0.0000000.000000-24.800168-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.000000-0.00000033.280772-20.962621-6.976678-3.6956680.0000000.0000000.0000000.0000000.233337-1.8791420.0000000.000000-97.16587550.77006215.6

41、304994.9568020.0000000.0000000.0000000.000000-12.11732817.2945800.0000000.0000000.0000000.0000000.0000000.0000001.0041590.000000-10.3456140.00000053.574257-99.3571520.0000000.0000000.0000000.0000000.0000000.0000006.9766780.0000003.136302-10.1129810.0000000.0000000.0000000.000000精彩文档实用标准文案0.000000-0.0000000.0000000.000000-24.72061120.414751-66.2424590.0000000.000000-0.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论