版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 負(fù)面情緒處理課程設(shè)計(jì)
- 2024年幼兒健康管理知識(shí)培訓(xùn)題庫(kù)(含答案)
- 二零二五版四荒地承包經(jīng)營(yíng)權(quán)投資融資合同3篇
- 年度多用客房車市場(chǎng)分析及競(jìng)爭(zhēng)策略分析報(bào)告
- 年度垃圾收轉(zhuǎn)裝備戰(zhàn)略市場(chǎng)規(guī)劃報(bào)告
- 2024版遠(yuǎn)程教育平臺(tái)搭建合同3篇
- 二零二五年度門店租賃合同范本:環(huán)保節(jié)能標(biāo)準(zhǔn)版4篇
- 室外電氣工程施工方案
- 送水泵房的課程設(shè)計(jì)
- 2025年度個(gè)人電子設(shè)備買賣合同模板2篇
- 骨科手術(shù)后患者營(yíng)養(yǎng)情況及營(yíng)養(yǎng)不良的原因分析,骨傷科論文
- GB/T 24474.1-2020乘運(yùn)質(zhì)量測(cè)量第1部分:電梯
- GB/T 12684-2006工業(yè)硼化物分析方法
- 定崗定編定員實(shí)施方案(一)
- 高血壓患者用藥的注意事項(xiàng)講義課件
- 特種作業(yè)安全監(jiān)護(hù)人員培訓(xùn)課件
- (完整)第15章-合成生物學(xué)ppt
- 太平洋戰(zhàn)爭(zhēng)課件
- 封條模板A4打印版
- T∕CGCC 7-2017 焙烤食品用糖漿
- 貨代操作流程及規(guī)范
評(píng)論
0/150
提交評(píng)論