├── IEEE33Bus.m ├── IEEE69Bus.m ├── Paper.pdf ├── forwardSweep.m └── main.m /IEEE33Bus.m: -------------------------------------------------------------------------------- 1 | 2 | base_mva = 100000; 3 | % P+jQ 4 | Sl = [ 5 | 0+0j; 6 | 100+60j; 7 | 90+40j; 8 | 120+80j; 9 | 60+30j; 10 | 60+20j; 11 | 200+100j; 12 | 200+100j; 13 | 60+20j; 14 | 60+20j; 15 | 45+30j; 16 | 60+35j; 17 | 60+35j; 18 | 120+80j; 19 | 60+10j; 20 | 60+20j; 21 | 60+20j; 22 | 90+40j; 23 | 90+40j; 24 | 90+40j; 25 | 90+40j; 26 | 90+40j; 27 | 90+50j; 28 | 420+200j; 29 | 420+200j; 30 | 60+25j; 31 | 60+25j; 32 | 60+20j; 33 | 120+70j; 34 | 200+600j; 35 | 150+70j; 36 | 210+100j; 37 | 60+40j ]; 38 | 39 | %Converting the Power to its p.u value 40 | Sl = (Sl/base_mva); 41 | Sl = Sl; 42 | %To add interconnections, append the Z_branch matrix with a new row with 43 | %the in bus, out bus, and impedance values of the connection. The 44 | %interconnection must be added at the end of the matrix for the program to 45 | %run correctly. Similarly, a new row should be added to I_branch matrix 46 | %with the in bus, out bus and initial branch current set as 0. The index of 47 | %the new row should be the same in both matrices 48 | 49 | % inbus outbus R + jX 50 | Z_branch = [ 51 | 1, 2, 0.0922+ 0.0477j; 52 | 2, 3, 0.493 + 0.2511j; 53 | 3, 4, 0.366 + 0.1864j; 54 | 4, 5, 0.3811+ 0.1941j; 55 | 5, 6, 0.819 + 0.707j; 56 | 6, 7, 0.1872+ 0.6188j; 57 | 7, 8, 1.7114+ 1.2351j; 58 | 8, 9, 1.03 + 0.74j; 59 | 9, 10, 1.04 + 0.74j; 60 | 10, 11, 0.1966+ 0.065j; 61 | 11, 12, 0.3744+ 0.1238j; 62 | 12, 13, 1.468 + 1.155j; 63 | 13, 14, 0.5416+ 0.7129j; 64 | 14, 15, 0.591 + 0.526j; 65 | 15, 16, 0.7463+ 0.545j; 66 | 16, 17, 1.289 + 1.721j; 67 | 17, 18, 0.732+0.574j; 68 | 2 , 19, 0.164+0.1565j; 69 | 19, 20, 1.5042+1.3554j; 70 | 20, 21, 0.4095+0.4784j; 71 | 21, 22, 0.7089+0.9373j; 72 | 3, 23, 0.4512+0.3083j; 73 | 23, 24, 0.898+0.7091j; 74 | 24, 25, 0.896+0.7011j; 75 | 6, 26, 0.203+0.1034j; 76 | 26, 27, 0.2842+0.1447j; 77 | 27, 28, 1.059+0.9337j; 78 | 28, 29, 0.8042+0.7006j; 79 | 29, 30, 0.5075+0.2585j; 80 | 30, 31, 0.9744+0.963j; 81 | 31, 32, 0.3105+0.3619j; 82 | 32, 33, 0.341+0.5302j;]; 83 | %8, 21, 2+2j; 84 | %9, 15, 2+2j; 85 | %12, 22, 2+2j; 86 | %18, 33, 0.5+0.5j; 87 | %25, 29, 0.5+0.5j]; 88 | 89 | %Converting the Impedence to its p.u value 90 | Z_branch(:,3) = (Z_branch(:,3)/1.69); 91 | 92 | % inbus outbus Iio 93 | I_branch = [ 1 2 0; 94 | 2 3 0; 95 | 3 4 0; 96 | 4 5 0; 97 | 5 6 0; 98 | 6 7 0; 99 | 7 8 0; 100 | 8 9 0; 101 | 9 10 0; 102 | 10 11 0; 103 | 11 12 0; 104 | 12 13 0; 105 | 13 14 0; 106 | 14 15 0; 107 | 15 16 0; 108 | 16 17 0; 109 | 17 18 0; 110 | 2 19 0; 111 | 19 20 0; 112 | 20 21 0; 113 | 21 22 0; 114 | 3 23 0; 115 | 23 24 0; 116 | 24 25 0; 117 | 6 26 0; 118 | 26 27 0; 119 | 27 28 0; 120 | 28 29 0; 121 | 29 30 0; 122 | 30 31 0; 123 | 31 32 0; 124 | 32 33 0;]; 125 | %8 21 0; 126 | %9 15 0; 127 | %12 22 0; 128 | %18 33 0; 129 | %25 29 0;]; -------------------------------------------------------------------------------- /IEEE69Bus.m: -------------------------------------------------------------------------------- 1 | 2 | base_mva = 100000; 3 | % P+jQ 4 | Sl = [ 5 | 0 + 0j; 6 | 0 + 0j; 7 | 0 + 0j; 8 | 0 + 0j; 9 | 2.6 + 2.2j; 10 | 40.4 + 30j; 11 | 75 + 54j; 12 | 30 + 22j; 13 | 28 + 19j; 14 | 145 + 104j; 15 | 145 + 104j; 16 | 8 + 5.5j; 17 | 8 + 5.5j; 18 | 0 + 0j; 19 | 45.5 + 30j; 20 | 60 + 35j; 21 | 60 + 35j; 22 | 0 + 0j; 23 | 1 + 0.6j; 24 | 114 + 81j; 25 | 5.3 + 3.5j; 26 | 0 + 0j; 27 | 28 + 20j; 28 | 0 + 0j; 29 | 14 + 10j; 30 | 14 + 10j; 31 | 26 + 18.6j; 32 | 26 + 18.6j; 33 | 0 + 0j; 34 | 0 + 0j; 35 | 0 + 0j; 36 | 14 + 10j; 37 | 19.5 + 14j; 38 | 6 + 4j; 39 | 0 + 0j; 40 | 79 + 56.4j; 41 | 384.7 + 274.5j; 42 | 384.7 + 274.5j; 43 | 40.5 + 28.3j; 44 | 3.6 + 2.7j; 45 | 4.35 + 3.5j; 46 | 26.4 + 19j; 47 | 24 + 17.2j; 48 | 0 + 0j; 49 | 0 + 0j; 50 | 0 + 0j; 51 | 100 + 72j; 52 | 0 + 0j; 53 | 1244 + 888j; 54 | 32 + 23j; 55 | 0 + 0j; 56 | 227 + 162j; 57 | 59 + 42j; 58 | 18 + 13j; 59 | 18 + 13j; 60 | 28 + 20j; 61 | 28 + 20j; 62 | 26 + 18.55j; 63 | 26 + 18.55j; 64 | 0 + 0j; 65 | 24 + 17j; 66 | 24 + 17j; 67 | 1.2 + 1j; 68 | 0 + 0j; 69 | 6 + 4.3j; 70 | 0 + 0j; 71 | 39.22 + 26.3j; 72 | 39.22 + 26.3j; 73 | 39.22 + 26.3j; ]; 74 | 75 | %Converting the Power to its p.u value 76 | Sl = (Sl/base_mva); 77 | 78 | %To add interconnections, append the Z_branch matrix with a new row with 79 | %the in bus, out bus, and impedance values of the connection. The 80 | %interconnection must be added at the end of the matrix for the program to 81 | %run correctly. Similarly, a new row should be added to I_branch matrix 82 | %with the in bus, out bus and initial branch current set as 0. The index of 83 | %the new row should be the same in both matrices 84 | 85 | % inbus outbus R + jX 86 | Z_branch = [ 87 | 1 2 0.0005 + 0.0012j; 88 | 2 3 0.0005 + 0.0012j; 89 | 3 4 0.0015 + 0.0036j; 90 | 4 5 0.0251 + 0.0294j; 91 | 5 6 0.3660 + 0.1864j; 92 | 6 7 0.3811 + 0.1941j; 93 | 7 8 0.0922 + 0.0470j; 94 | 8 9 0.0493 + 0.0251j; 95 | 9 10 0.8190 + 0.2707j; 96 | 10 11 0.1872 + 0.0619j; 97 | 11 12 0.7114 + 0.2351j; 98 | 12 13 1.0300 + 0.3450j; 99 | 13 14 0.0440 + 0.3450j; 100 | 14 15 0.0580 + 0.3496j; 101 | 15 16 0.1966 + 0.0650j; 102 | 16 17 0.3744 + 0.1238j; 103 | 17 18 0.0047 + 0.0016j; 104 | 18 19 0.3276 + 0.1083j; 105 | 19 20 0.2106 + 0.0696j; 106 | 20 21 0.3416 + 0.1129j; 107 | 21 22 0.0140 + 0.0046j; 108 | 22 23 0.1591 + 0.0526j; 109 | 23 24 0.3463 + 0.1145j; 110 | 24 25 0.7488 + 0.2475j; 111 | 25 26 0.3089 + 0.1021j; 112 | 26 27 0.1732 + 0.0572j; 113 | 3 28 0.0044 + 0.0108j; 114 | 28 29 0.0640 + 0.1565j; 115 | 29 30 0.3978 + 0.1315j; 116 | 30 31 0.0702 + 0.0232j; 117 | 31 32 0.3510 + 0.1160j; 118 | 32 33 0.8390 + 0.2816j; 119 | 33 34 0.7080 + 0.5646j; 120 | 34 35 0.4740 + 0.4873j; 121 | 3 36 0.0034 + 0.0084j; 122 | 36 37 0.0851 + 0.2083j; 123 | 37 38 0.2898 + 0.7091j; 124 | 38 39 0.0822 + 0.2011j; 125 | 39 40 0.0928 + 0.0473j; 126 | 40 41 0.3319 + 0.1114j; 127 | 41 42 0.1740 + 0.0886j; 128 | 42 43 0.2030 + 0.1034j; 129 | 43 44 0.2842 + 0.1447j; 130 | 44 45 0.2813 + 0.1433j; 131 | 45 46 0.5900 + 0.5337j; 132 | 4 47 0.7837 + 0.2630j; 133 | 47 48 0.3042 + 0.1006j; 134 | 48 49 0.3861 + 0.1172j; 135 | 49 50 0.5075 + 0.2585j; 136 | 8 51 0.0974 + 0.0496j; 137 | 51 52 0.1450 + 0.0738j; 138 | 9 53 0.7105 + 0.3619j; 139 | 53 54 0.0410 + 0.5302j; 140 | 54 55 0.2012 + 0.0611j; 141 | 55 56 0.0047 + 0.0014j; 142 | 56 57 0.7394 + 0.2444j; 143 | 57 58 0.0047 + 0.0016j; 144 | 58 59 0.0044 + 0.0108j; 145 | 59 60 0.0640 + 0.1565j; 146 | 60 61 0.1053 + 0.1230j; 147 | 61 62 0.0304 + 0.0355j; 148 | 62 63 0.0018 + 0.0021j; 149 | 63 64 0.7283 + 0.8509j; 150 | 64 65 0.3100 + 0.3623j; 151 | 11 66 0.0410 + 0.0478j; 152 | 66 67 0.0092 + 0.0116j; 153 | 12 68 0.1089 + 0.1373j; 154 | 68 69 0.0009 + 0.0012j; ] ; 155 | 156 | 157 | %Converting the Impedence to its p.u value 158 | 159 | 160 | % inbus outbus Iio 161 | I_branch = [ 162 | 1 2 0; 163 | 2 3 0; 164 | 3 4 0; 165 | 4 5 0; 166 | 5 6 0; 167 | 6 7 0; 168 | 7 8 0; 169 | 8 9 0; 170 | 9 10 0; 171 | 10 11 0; 172 | 11 12 0; 173 | 12 13 0; 174 | 13 14 0; 175 | 14 15 0; 176 | 15 16 0; 177 | 16 17 0; 178 | 17 18 0; 179 | 18 19 0; 180 | 19 20 0; 181 | 20 21 0; 182 | 21 22 0; 183 | 22 23 0; 184 | 23 24 0; 185 | 24 25 0; 186 | 25 26 0; 187 | 26 27 0; 188 | 3 28 0; 189 | 28 29 0; 190 | 29 30 0; 191 | 30 31 0; 192 | 31 32 0; 193 | 32 33 0; 194 | 33 34 0; 195 | 34 35 0; 196 | 3 36 0; 197 | 36 37 0; 198 | 37 38 0; 199 | 38 39 0; 200 | 39 40 0; 201 | 40 41 0; 202 | 41 42 0; 203 | 42 43 0; 204 | 43 44 0; 205 | 44 45 0; 206 | 45 46 0; 207 | 4 47 0; 208 | 47 48 0; 209 | 48 49 0; 210 | 49 50 0; 211 | 8 51 0; 212 | 51 52 0; 213 | 9 53 0; 214 | 53 54 0; 215 | 54 55 0; 216 | 55 56 0; 217 | 56 57 0; 218 | 57 58 0; 219 | 58 59 0; 220 | 59 60 0; 221 | 60 61 0; 222 | 61 62 0; 223 | 62 63 0; 224 | 63 64 0; 225 | 64 65 0; 226 | 11 66 0; 227 | 66 67 0; 228 | 12 68 0; 229 | 68 69 0; ]; 230 | %11 43 0; 231 | %15 46 0; 232 | %13 21 0; 233 | %27 65 0; 234 | %50 59 0;]; -------------------------------------------------------------------------------- /Paper.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vijayhiga/Power_Flow_Meshed_Network/38401248bce5f79d8fee847fce2f0e2c48e0871e/Paper.pdf -------------------------------------------------------------------------------- /forwardSweep.m: -------------------------------------------------------------------------------- 1 | function [ Vk ] = forwardSweep ( I_branch, Z_branch, Vk, is_end_node, node ) 2 | % The input node is checked to see if it is an end node or not. If it 3 | % is not an end node, the function proceeds to find the number of 4 | % branches going out from the node. For each branch going out of the node 5 | % the funciton is recursively called until the end node of that branch is 6 | % reached 7 | if(is_end_node(node) ~= 1), 8 | in_idx = find(I_branch(:,1)==node); 9 | for i = (1:length(in_idx)), 10 | out_bus = I_branch(in_idx(i), 2); 11 | Vk(out_bus) = Vk(node) - Z_branch(in_idx(i), 3)*I_branch(in_idx(i), 3); 12 | Vk = forwardSweep (I_branch, Z_branch, Vk, is_end_node, out_bus); 13 | end 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | Vk = ones(69,1); 2 | Vkprev = zeros(69,1); 3 | Ik = zeros(69,1); 4 | reg_branches = 68; 5 | eps = 0.01; 6 | nodes = (1:length(Vk)); 7 | end_nodes = find(~ismember(nodes,I_branch(:,1))); 8 | is_end_node = ismember(nodes, end_nodes); 9 | n_of_endnodes = length(end_nodes); 10 | n_of_branches = length(I_branch); 11 | n_iter = 40; 12 | e = zeros(n_iter,1); 13 | i=1; 14 | for i = (1:n_iter), 15 | %Backward Sweep 16 | Ik = conj(Sl./Vk); 17 | I_branch(1:reg_branches,3) = 0; 18 | for end_node = (1:n_of_endnodes), 19 | n = end_nodes(end_node); 20 | while n~=1, 21 | out_idx = find(I_branch(1:reg_branches,2)==n); 22 | in_idx = find(I_branch(1:reg_branches,1)==n); 23 | interco_idx = find(I_branch(reg_branches+1:n_of_branches,2)==n); 24 | I_branch(out_idx,3) = I_branch(out_idx,3) + Ik(n) + sum(I_branch(in_idx,3)) - sum(I_branch(interco_idx,3)); 25 | Ik(n)=0; 26 | n = I_branch(out_idx,1); 27 | end 28 | end 29 | 30 | %Forward Sweep 31 | Vkprev = Vk; 32 | Vk = forwardSweep(I_branch, Z_branch, Vk, is_end_node, 1); 33 | e(i) = max(abs(Vk - Vkprev)); 34 | 35 | %if(e(i) < eps) 36 | % break; 37 | %end 38 | 39 | %Interconnect current 40 | for i =(reg_branches+1:n_of_branches), 41 | in_bus = I_branch(i,1); 42 | out_bus = I_branch(i,2); 43 | I_branch(i,3) = (Vk(in_bus)-Vk(out_bus))/Z_branch(i,3); 44 | end 45 | end 46 | disp(abs(Vk)); 47 | y = (1:69); 48 | x = (1:n_iter); 49 | plot(x,e); 50 | %disp(i); 51 | plot(y, abs(Vk)); 52 | 53 | 54 | 55 | --------------------------------------------------------------------------------