When you use extract_islands() you are creating a new 3-bus case file from the 3-bus island of the 5-bus case. So you are right about the new indexing. It is not valid to attempt to access the 4th or 5th bus in a 3-bus system. If you want to use bus identifiers that do not change as you extract islands, etc., then you will need to use the external bus numbers stored in mpc.bus(:, BUS_I), not the simple index into the matrix. Similarly for branches and generators, they must be identified by the external bus numbers that they are connected to, not by simple indexes into the branch and gen matrices, which are obviously different for the original 5-bus case and the 3-bus case you’ve extracted from it.
Ray > On Mar 1, 2015, at 11:42 AM, Manish Thapa <[email protected]> wrote: > > Dear Ray and Others, > > There is a bus-indexing problem in matpower for islands. For example, in > case5.m when I remove branches 1 and 5, the system parts into two islands. I > take one islands for example (the biggest one with 3 buses with indices 1,4 > and 5). I want to calculate the complex current injected from bus 4 into > branch 3, I do the following: > > define_constants; > mpc = loadcase('case5.m'); > > mpc.branch(1,BR_STATUS)=0; > mpc.branch(5,BR_STATUS)=0; > > ccr=extract_islands(mpc,1) > > results=runpf(ccr) > > Sf = results.branch(3, PF) + 1j * results.branch(3, QF); > Vf = results.bus(4, VM) * exp(1j * results.bus(4, VA)); > If = abs(conj( Sf / Vf )) %% complex current injected into branch k at bus f > > The System Summary is: > > Bus Voltage Generation Load > # Mag(pu) Ang(deg) P (MW) Q (MVAr) P (MW) Q (MVAr) > ----- ------- -------- -------- -------- -------- -------- > 1 1.000 0.000 -63.66 10.96 - - > 4 1.000 -3.046 0.00 183.35 400.00 131.47 > 5 1.000 0.879 466.51 -38.81 - - > -------- -------- -------- -------- > Total: 402.85 155.49 400.00 131.47 > > ================================================================================ > | Branch Data > | > ================================================================================ > Brnch From To From Bus Injection To Bus Injection Loss (I^2 * Z) > > # Bus Bus P (MW) Q (MVAr) P (MW) Q (MVAr) P (MW) Q > (MVAr) > ----- ----- ----- -------- -------- -------- -------- -------- > -------- > 1 1 4 173.51 -13.03 -172.59 21.58 0.920 9.20 > 2 1 5 -237.18 23.99 237.54 -23.48 0.364 3.64 > 3 4 5 -227.41 30.30 228.97 -15.34 1.564 15.64 > > > However, I get the following error message for current calculation: > > Attempted to access results.bus(4,8); index out of bounds because > size(results.bus)=[3,13]. > > Error in rough (line 12) > Vf = results.bus(4, VM) * exp(1j * results.bus(4, VA)); > > As you can see in the summary current is clearly injected from Bus 4 to > branch 3, but still I get error. So what I was thinking was when Islanding > happens, the indexes of Buses are shuffled. So bus indices 1,4 and 5 are in > fact 1, 2 and 3. How do I see this? I see this because if I put Vf = > results.bus(3, VM) * exp(1j * results.bus(3, VA)), it works just fine. So > basically, the indices cannot be more than the number of buses in Islands, > but that is quite weird for me. I thought indices was fixed. Does it solve my > problem if I take my buses indices in the new island as 1,2 and 3 for 1, 4 > and 5 (check out the bus table)? Would it give me the right result? How do I > map old indices to new indices? Any help is appreciated. > > Regards, > > Manish > > >
