![MATLAB牛顿拉夫逊法算潮流分析_第1页](http://file2.renrendoc.com/fileroot_temp3/2021-11/10/de798082-f06b-4bf2-bba3-60811a00c66d/de798082-f06b-4bf2-bba3-60811a00c66d1.gif)
![MATLAB牛顿拉夫逊法算潮流分析_第2页](http://file2.renrendoc.com/fileroot_temp3/2021-11/10/de798082-f06b-4bf2-bba3-60811a00c66d/de798082-f06b-4bf2-bba3-60811a00c66d2.gif)
![MATLAB牛顿拉夫逊法算潮流分析_第3页](http://file2.renrendoc.com/fileroot_temp3/2021-11/10/de798082-f06b-4bf2-bba3-60811a00c66d/de798082-f06b-4bf2-bba3-60811a00c66d3.gif)
![MATLAB牛顿拉夫逊法算潮流分析_第4页](http://file2.renrendoc.com/fileroot_temp3/2021-11/10/de798082-f06b-4bf2-bba3-60811a00c66d/de798082-f06b-4bf2-bba3-60811a00c66d4.gif)
![MATLAB牛顿拉夫逊法算潮流分析_第5页](http://file2.renrendoc.com/fileroot_temp3/2021-11/10/de798082-f06b-4bf2-bba3-60811a00c66d/de798082-f06b-4bf2-bba3-60811a00c66d5.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、matlab牛顿拉夫逊法算潮流分析the function of this program is to use newton, the rafson methodthe % bl matrix: 1, the first branch of the branch; no. 2, terminal; branch resistsnce; 4, the circuit (or transformer admittance);% 5, the change of the branch; the branch head is at the k side of 1, 1 side 0;the % 7,
2、line/transformer id (0/1) transformer parameter is calculated to the end of the branch when the end of the branch is on the k side, 0 to the first end% b2 matrix: 1, power of the node generator; the load power of the node:% 3, pq node voltage initial value, or a given value of the balanee node and p
3、v node voltagethe connection of the capacitor (inductance) of the shunt capacitance (inductance) is received by the node% 5, node classification label: 1 is the balanee node (should be number 1): 2 for the pq node; 3 for pv nodes;the clear;isb = 1; % input (' please enter the balanee bus node nu
4、mber: isb 二');pr = 1 e - 5; % in put (' please in put the error accuracy: pr 二');n 二 10; % input (' please enter the number of nodes: n 二');nl = 10; % input ');('pleaseenter a number of directions: nlbl1,0,1, 2, 4, 4,1, 01, 4, 1,1, 0, 0, 1, 1, 1, 1, 4, 1, 1, 1, 0,1,4,5. 1
5、 + 19.2i 2. le-4110 0;2,3,4.25 + 16i1. 75e-4 i 1, 0, 0;4,5,4.25 + 16i7e minus 4i 1 0;1,3,5. 1 + 19.2i 2.le-4 1100;6, 4, 5. 95 + 22.4 i 9. 8e4 i 1, 0, 0;2, 7, 1. 78 + 53.89 i 0, 38.5/231, 0, 1;3, 8, 1.49 + 48.02 i 0, 11/231, 0, 1;4, 9, 9, 9, 9, 4, 9, 1, 9, 1, 0, 11, 0, 1.5 10 2. 46 + 70. 17 i 0 38. 5
6、/231 0 1% input (' please enter the matrix formed by the branch parameter: bl 二');b2 isequal to 0,0, 25.5, 0, 1;2200;2200;2200;2200;120,2313;0,61. 1137. 8735,0,2;0,47. 5329.4610,0,2;0,54. 3233.6610,0,2;2)0 40. 74 + 25. 25 i 35 0% input (' please enter the matrix of the parameter paramete
7、rs of each node: b2 二');% n 二 4; % input (' please enter the number of nodes: n 二');% nl = 4; % input (' please enter a number of directions: nl二);% bl is equal to 1, 2, 4 + 16i 0, 0, 0;% 1, 3, 4 + 16i 0, 0, 0;% 2, 3, 2 + 8i 0, 0, 0;% 2, 41. 49 + 4& 02 i 0, 11/110, 1 % input (
8、9; please enter the matrix formed by the branch parameter: bl 二');% b2 is equal to 0, 0, 115, 0, 1;% 0, 0, 110, 0, 2;% 0, 20 + 4i 110, 0, 2;% 0, 10 + 6i 100 2 % input (' please input the matrix of the parameters of each node: b2 二');y 二 zeros (n); e 二 zeros (1, n); f = zeros (1, n): v 二
9、zeros (1, n) ; sida 二 zeros (1, n) ; si 二 zeros (nl);the admittance matrix 一for 1=1: nl % from 1 to nlif bl (i, 7)二 1 %is on one sideif bl (i, 6)二二 0 % left (the first end)p = bl (i, 1); q = bl (i, 2);the else %left node(the first end)is on the k sidep = bl (i, 2); q 二 bl (i, 1);the endy (p, q)二 y (
10、p, q) - 1 / (bl (i, 3) * bl (i, 5). % the diagonal elementy of q, p is equal to y of p, q. % the diagonal elementy (q, q)二 y (q, q) + 1)/(b1 (i, 3) * bl (i, 5)八 2) ; % diagonal element k sidey (p)二 y (p)二 y (p) + 1. / bl (i, 3) + bl (i, 4) ; % diagonal element 1 + excitation admittance"else&quo
11、t;p = bl (i, 1); q = bl (i, 2);y (p,q)二 y(p, q) -1./bl (i,3) ; % thediagonal elementy of q,pisequal toyofp, q.%thediagonal elementy (q)二y(q)二 y (q)+1./ bl(i,3)+ bl(i, 4). / 2.0;%diagonally equal to half of the liney (p)二y(p)二 y (p)+1./ bl(i,3)+ bl(i, 4). / 2.0;%diagonally, half of the power of the l
12、inethe endthe enddisp (' the admittance matrix y 二');disp (y);%given the initial node voltageand given each node power injection g 二 real (y); b 二 imag (y); the % decomposes the real and imaginary parts of the admittance matrixfor 1 = 1: n % given the real and imaginary parts of the initial
13、voltage of each nodee (i)二 real (b2 (i, 3);f (i)二 imag (b2 (i, 3);v (i)二 abs (b2 (i, 3) ; % pv, balance node, and pq node voltage modulusthe endfor i = 1: n % given each node injection powers (i)二 b2 (i, 1) -b2 (i, 2) ; the % i node is injected with the power sg - slb (i, i) = b (i, i) + b2 (i, 4) ;
14、 the % i node has no amount of work compensationthe end% 二二二二二二二二二二二二二二二二二二 with newton iteration 一 ralph monson method is used to solve the nonlinear algebraic equation (power equation)二二二二二二二二二二二二二二二二二二p 二 real (s) ; q 二 imag (s) ; the % decomposition of the active and reactive power of each nodei
15、ct1 二 0; it2 二 1; no 二 2 * n; n1 二 no + 1; a 二 0; % iterations, ict1, a; the number of nodes that are not satisfied with the convergence is it2while it2 =0%n0=2 *n jacobian; n1 + 1 二 no extensionjz 二' jacobi matrix (', num2str (a), ') cancellation operations,; jz1 二'jacobi matrix c ,
16、 num2str (a), ') the second iteration ' ; jzo 二'power equation number c , num2str (a), ') the time difference:%to calculatethe power of each node and power deviation and voltage deviation of pv nodes for 1 = 1: n % n nodes 2n rows (two equations p and q or u for each node)p 二 2 * i -
17、 1; m 二 p + 1; c 二 0; d 二 0;for jl = 1: n % i row n columns (n nodes interadmittance and node voltage multiplied by the current)c (i)二 c+ g* e(jl)_ b(i,jl)* f(jl);% s(ej- bijgij* *fj)d (i)二 d+ g(i,jl)* f(jl)+ b(i,jl)* e(jl);% s(fj +bijgij* *ej)the endthe calcullate(d vallueof the work and the :react
18、;ivepowerp qpl 二 c (i) * e (i) + f (i) * d (i) ; power p % node calculation ei s (ej - bij gij * * fj) + fi 艺(fj + bij gij * * ej)q1 二 c (i) * f (i) -e (i) * d (i) ; power q % node calculation fi 2 (ej - bij gij * * fj) ei s (fj + bij gij * * ej)v2 二 e (i)八 2 + f (i)2; % voltage die squaredthe diffe
19、rence between the power difference and the pv node is equal to 二二if i 二 isb % non-equilibrium node (pq or pv node)if b2 (i, 5) 二 3 % non-pv nodes (only pq nodes)j (m, nl)二 p (i) -pl; the % pq node has the power difference j (m, nl) to extend column delta pj (p, nl)二 q (i) -ql; the % pq node has no w
20、ork power difference j (p, nl) expands column delta qelse % pv nodes 二二二二二二j (m, nl)二 p (i) -pl; the % pv node has the power difference j (m, nl) to extend column delta pj (p, nl)二 v (i)2 - v2. the % pv node voltage module (p,nl) extends column delta uthe endend % (if i = isb) non-equilibrium nodes
21、(pq or pv nodes)end % (fori 二 1:n)nnodes 2n rows (two equations p dnd q oru for eachnode)for m = 1:nojjn1 (m)二j (m,nl);the enddisp (jzo); disp (jjn1);%deviation value judgmentpower and voltage deviation value whether meet the requirements of pv nodes for k = 3: no % removes all nodes other than the
22、balanced node1 and 2det 二 abs (k, nl);if det > = pr % pq node,s power deviation and the voltagedeviation of the pv node are metit2 二 it2 + 1; the number of nodes that does not meet the requirement is plus 1the endthe endict2 (a)二 it2; the number of nodes that do not meet therequirement; a is the
23、number of iterationsict1 二 ict1 + 1; % the number of iterationsif ict2 (a)二二 0; the number of nodes currently not satisfied is zerobreak % exits the iteration operationthe end%above to calculate the various nodes of power and power deviation and voltage deviation of pv nodes the jacobi matrix formed
24、 the correct equation for the jacobi matrixfor i 二 2: n % n nodes 2n rows (two equations p and q or u for each node)if i 二 isb % non-equilibrium node (pq or pv node)if b2 (i, 5) 二 3%, the element of the jacobi matrix for the pq node is equal to 二二二c (i)二 0; d (i)二 0;for jl = 1: n % i row n columns (
25、n nodes interadmittance and node voltage multiplied by the current)c 二 c (i) + g (i) * e (jl) - b (i, jl) * f (jl) ; % s (ej -bij gij * * fj)d (i)二 d (i) + g (i, jl) * f (jl) + b (i, jl) * e (jl); % s (fj + bij gij * * ej)the endfor jl = 2: n % i row n columns (2n jacobi matrix elements dp/de and dp
26、/df or dq/de and dq/df)if jl 二 isb&j 1 二 i % unbalanced node &non-diagonal elementxi 二-g (i, jl) * e - b (i, jl) * f (i) ; % xi 二 dp/de 二-dq/df 二-x4x2 = b (i, jl) * e (i) - g (i, jl) * f (i) ; x2 二 dp/df 二 dq/de 二 x3the x3 二 x2; % x2 二 dp/df x3 二 dq/dex4 二-xi; % xi 二 dp/de x4 二 dq/dfp=2*i- 1
27、; q=2 * jl-1;j (p, q) = x3; m 二 p + 1; so it's going to be dq/de j (p, n) 二 dq.j (m, q)二 xi; q 二 q + 1; the dp/de j (m, n)二 dp.j (p, q)二 x4; j (m, q)二 x2; % x4 二 dq/df x2 二 dp/dfelseif jl 二二二 i&j 1 二 isb % non-equilibrium node & diagonal elementxi二-c(i)-g(i) * e (i)- b (i) * f (i) ;% dp/
28、dex2二-d(i)+b(i) * e (i)-g (i) * f (i) ;% dp/dfx3 二 d (i) + b (i) * e (i) -g (i) * f (i) ; % dq/dex4二-c(i)+g(i) * e (i)+ b (i) * f (i); % dq/dfp 二 2*1 - 1;q二 2* jl-1;j (p, q)二 x3; %expansion columndelta q j of p,n)二 dq;m 二 p + 1;j (m, q)二 xi; q 二 q + 1; j (p, q)二 x4; % expansion column delta p j (m,
29、n)二 dp;j (m, q)二 x2;the endthe endelse % if b2 (i, 5) 二 3 otherwise (that is the pv node)the element of the jacobi matrix is equal to 二二 二二二for jl = 1: nif jl 二 isb&j 1 二 i % unbalanced node &non-diagonal elementxi 二-g (i, jl) * e (i) - b (i, jl) * f (i); % dp/dex2 二 b (i, jl) * e (i) - g (i
30、, jl) * f (i); % dp/dfx5 =0; x6 二 0:p 二 2 * i -error.1; q 二 2 * jl-1; j (p, q)二 x 5; % pv node voltagem 二 p + 1;j (m, q)二 xi; q 二 q + 1; j (p, q)二 x6; the % pv node has the work error j (m, n)二 dp;j (m, q)二 x2;elseif jl 二二二 i&j 1 二 isb % non-equilibrium node & diagonale1ementxi 二-c (i) -g (i
31、) * e (i) - b (i) * f (i); % dp/dex2 二-d (i) + b (i) * e (i) -g (i) * f (i) ; % dp/dfx6 is equal to minus 2 times f of i.p = 2*i-1; q = 2* jl-1; j (p, q)二 x 5; % pv node voltage errorm 二 p + 1;j (m, q)二 xi; q 二 q + 1; j (p, q)二 x6; the % pv node has the work error j (m, n)二 dp;j (m, q)二 x2;the endth
32、e endend % (if b2 (i, 5) = 3 else)end % (if i 二 isb)end % (for 1 = 1: n) n nodes 2n rows (two equations p and q or u for each node)jzo 二'formed the first (', num2str (a), ') the subjacobi matrix:% disp (jzo); disp (j);% 二二二二二二二二二二二二二二二二二二二二二二二二二二二二二二 二 above to form a complete jacobi mat
33、rix =the elimination of the modified equation formed by the jacobi matrix is solved by the gaussian elimination method (by the column elimination and the return of the matrix)for k = 3: no % no = 2 * n (from the third row, the first, second line is the equilibrium node)for kl 二 k + 1: m % from the j
34、acobi element of k + 1 to the extension delta p, delta q or delta uj (k, kl)二 j (k, kl). / j (k, k) ; the non-diagonal elements of k row k columns are normalized by the k line k column diagonal elementthe endj (k, k) = 1; the % diagonally normalized k lines k column diagonal elements assignment 1% =
35、 in columns elimination operation 二二二二二二二二二二二二二二二二二二二二二二二二二二for k2 二 k + 1: no % from k + 1 to 2 * n last rowfor k3 二 k + 1: n1 % from k2 + 1 to the extension column cancels out the triangle elements after the k + 1 rowj (k2, k3)二 j (k2, k3) -j (k2, k) * j (k, k3); % elimination operationend % uses
36、the current row k3 column element minus the current row k column element times the k row k3 column elementj (k2, k) = 0; the k column element of the current row is 0the endthe end% jz = ' jacobi matrix (', num2str (a), ') cancellation operations,; jz1 二'jacobi matrix (', num2str
37、(a), ') the second iteration '% disp (jz); disp (j);% = = = = = = = = = = = = = = = = = = = = on column generation algorithm = = = = = = = = = = = = = = = = = = = = = = = = = =for k = no: - 1:3for kl = k - 1: -1:3j (kl, nl)二 j (kl, nl) - j (kl, k) * j (k, nl);j (kl, k)二 0;the endfor m 二 1: n
38、ojjnl (m)二 j (m, nl);the enddisp (jz1); disp (jjnl); % disp (j);%modify the node voltagefor k 二 3:2: no-1l is equal to k plus 1.e (l) = e (l) -j (k, nl) ; % modification node voltage real partki 二 k + 1;f (l) = f (l) -j (kl, nl) ; % modifies the voltage virtual partof the nodeu (l)二 sqrt (e (l) &quo
39、t; 2 + f (l)八 2):the enddisp (' each node voltage module '); disp (u):%二二二二二二二二二 end of an iterationthe end%* * * * * the following for the end of the iterative calculation of the output process *disp (' iteration:');disp (ict1-1);disp (' not the number of precision requirements:
40、');disp (ict2);for k = 1: nv (k)二 sqrt (e (k)八 2 + f (k)八 2) ; percent calculates the magnitude of each node's voltagesida (k)二 atan (f (k). / e (k) the percent calculates the angle of each node,s voltagee (k)二 e (k) + f (k) * j; % will represent each node voltage in the pluralcalculated out
41、putdisp (“ the voltage complex value of the nodes is (the node number is from small to large): “);disp (e) ; the actual voltage value of each node is shown in the pluraldisp (')disp (' the value of the voltage modulus of each node is the size of the node number of nodes from small to large:&
42、#39;);disp (v); the % shows the magnitude of v for each nodedisp (')disp (' the voltage phase of each node is sida (the node number is from small to large):disp (sida) ; the % display the voltage phase angle of each nodec (p)二 0;c (p)二 c (p) + conj (p, q). % calculate the conjugate value of
43、the injection current of each nodethe ends (p)二 e (p) * c (p) ; % calculates the conjugate value of the power s 二 voltage x injection current of each nodethe enddisp (“ power s of each node (node number from small to large): );disp (s); the % shows the injection power of each nodedisp (')disp (&
44、#39; the first power si on each branch of the branch is in the same order as you enter bl:');for i 二 1: nlp = bl (i, 1); q = bl (i, 2);if bl (i, 7)二二 0si (p, q)二 e (p) * conj (e (p) * bl (i, 4). / 2 + (e (p) -e (q) / bl (i, 3).siz (i)二 si (p, q);the elseif bl (i, 6)二二 0si (p, q)二 e (p) * (e (p)
45、* bl (i, 4)(p) * bl (i, 5) -e (q) * (1. / (bl (i, 3) * bl (i, 5) siz (i)二 si (p, q);the elsesi (p, q)二 e (p) * conj (e (p) - e (q) * bl (i, 5) * (1)/(b1 (i, 3) * bl (i, 5)八 2);siz (i)二 si (p, q);the endthe end's (' num2str, (p),? num2str (q),')二',num2str (si (p, q)disp (zf);disp (
46、9;the enddisp (' the end power sj of each branch is the same as when you enter bl):');for i = 1: nlp = bl (i, 1); q = bl (i, 2);if bl (i, 7)二二 0(q, p)二 e (q) * conj (e (q) * bl (i, 4). / 2 + (e (q) -e (p). / bl (i, 3).sjy (i)二 sj (q, p);the elseif bl (i, 6)二二 0sj (q) (q, p)e * conj (e (q) -
47、e (p) * bl (i, 5) * (1)/(b1 (i, 3) * bl (i, 5)八 2);sjy (i) = sj (q, p);the else (q, p)二 e (q) * (e (q) * bl (i, 4).+ (e (q) * bl (i, 5) -e (p) * (1. / (bl (i, 3) * bl (i, 5)sjy (i)二 sj (q, p);the endthe end's (' s' (' num2str '), '? num2str (p),,)二disp (zf);disp (');the e
48、nddisp (the power loss ds for each branch of the branch is the same as when you enter bl in the order);for i = 1: nlp 二 bl (i, 1); q 二 bl (i, 2);ds (i) = si (p) + sj (q, p);"the zf 二'ds (', num2str (p), ,, num2str (q),')二 num2str (ds (i)disp (zf);disp ('');the endzws 二 0; jd
49、dy 二;jdp 二;jdq 二;jddyjd 二;for 1 = 1: n % total net loss for all nodes injected with power algebra andzws 二 zws + s (i);jddyjd = strcat (jddyjd, num2str (i),(', num2str (' i)'),')jddy 二 strcat (jddy, num2str (i), ' (', num2str (v (i),');jdp 二 strcat (jdp, num2str (i), ' c , num2str),j);(jdq, num2str (i),z,);the endjddyjd 二 strcat c node voltage angle: jddy
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度写字楼租赁合同提前解除及物业管理协议
- 2025年度租赁合同模板:农业用地租赁
- 二零二五年度私人房产使用权转让与社区图书馆使用合同
- 2025年度合资公司运营管理股份分配与利润分配合同
- 2025年度车辆牌照租赁与停车管理服务合同
- 2025年度财务信息化系统实施人员用工合同
- 2025年度电商件代发及供应链金融整合服务合同
- 骆驼祥子读书报告-20210722002805
- 2025年中央空调改造合同
- 2025年专利知识产权技术权利许可转让合同
- 2024年度-美团新骑手入门培训
- 驾照体检表完整版本
- 高一数学寒假讲义(新人教A专用)【复习】第05讲 三角函数(学生卷)
- 农村高中思想政治课时政教育研究的中期报告
- 医院定岗定编方案文档
- 4-熔化焊与热切割作业基础知识(一)
- 2023年200MW储能电站储能系统设计方案
- 个人安全与社会责任的基本知识概述
- 简易劳务合同电子版
- 明代文学绪论
- 体育赛事的策划、组织与实施 体育赛事利益相关者
评论
0/150
提交评论