Dear Ray Sir,  wish you are fine and healthy
 with your suggestion I am able to automate the bus and branch removal process 
with some assumption. But now I am facing another problem for which My program 
get halted. Error code showing

val =

        3967

Index in position 1 exceeds array bounds. Index must not exceed 3771.

Error in testing_indian (line 24)
    bn = mpc.bus(val, BUS_I);

When buses are removed there is a mismatch in array size and bus number. I have 
total 3995 number of buses, after the removal of 224 bus its coming to 3771 
bus. When I am trying to remove the bus number 3967 the above error is coming. 
How to handle this problem.

k=[1204 1051 296 300 3296 1011 3309 35 2300 872 3254 1067 39 1202 1506 1875 291 
1064 173 1496 1894 137 41 1682 983 196 3235 1882 239 1230 6 176 3311 1220 2310 
932 1504 2783 1079 232 890 564 1665 3236 104 2322 3347 130 215 2297 240 1285 
2050 114 1907 1060 1692 136 157 955 1087 753 107 144 50 2878 1439 97 2061 3304 
951 147 2076 1881 342 1198 2081 28 967 200 376 3316 1394 1256 33 329 1688 2850 
1214 3579 1494 1866 289 674 2841 47 1460 875 169 3410 1705 3010 63 1926 873 
2844 295 1048 3387 751 2053 111 400 199 1492 1097 3279 161 70 195 224 2869 1870 
132 1096 3 2306 3337 474 836 427 1558 3319 146 1670 2835 19 3348 1886 1168 3275 
124 1701 307 32 2859 2056 1427 2388 168 16 1092 1686 3967 1012 3298 459 3629 
2795 2298 25 1072 1712 1799 2810 1891 3308 191 221 293 84 944 129 2302 769 1666 
1212 1449 662 282 170 869 3416 2866 1065 3282 1869 1892 2849 250 115 3418 1247 
829 2317 1865 1897 1206 1699 134 2736 518 1344 9 2814 2345 1777 493 158 2214 
3240 1678 2525 61 203 262 155 2431 3305 126 320 92 1053 1104 2787 2831 1906 
2344 1301 1585 3280 2883 476 2052 2382 3633 1755 929 900 759 80 48 1013 1091 
469 1441 566 776 1046 2065 3255 2772 265 100 2296 2305 2 225 1797 1184 1419 344 
1901 3370 121 3657 2295 946 2798 1119 1237 2871 46 3292 887 430 1239 3335 2099 
1094 1880 3276 2888 356 1219 2863 34 407 285 3293 878 138 73 2799 382 2223 761 
1142 3343 699 1108 1917 868 2222 233 256 3653 898 2325 3239 1730 3949 2741 3646 
2346 1590 316 856 1798 457 216 3422 349 1922 2441 290 437 2738 1395 874 2721 
480 2243 1223 2308 632 694 3355 2837 4 1107 1657 2054 1790 120 2808 677 1147 
3947 2881 167 2862 1128 758 440 1226 1280 2211 2229 3386 283 2193 141 1438 1878 
2855 2414 2993 1787 148 1397 483 1598 2728 3658 22 1411 2762 3955 2875 3662 
1257 2734 2340 2237 3301 1904 241 3329 456 1735 2378 3268 1898 881 2062 1695 
486 1689 2740 2197 1899];
z = [];
len = length(k)
for x=1:len
    val = k(x)
    bn = mpc.bus(val, BUS_I);
    i = find(mpc.branch(:, F_BUS) == bn);
    j = find(mpc.branch(:, T_BUS) == bn);
    mpc.branch(val, BUS_TYPE) = NONE;
    mpc.branch([i; j], BR_STATUS) = 0;
    g = find(mpc.gen(:, GEN_BUS) == bn);
    mpc.gen(g, GEN_STATUS) = 0;
    [groups, isolated] = find_islands(mpc)
        mpc_list = extract_islands(mpc)
        [GROUPS, ISOLATED] = case_info(mpc)
        mpc.bus([ISOLATED],BUS_TYPE)=4
    results=rundcpf(mpc,opt);
    if (results.success == 0)
        [groups, isolated] = find_islands(mpc)
        mpc_list = extract_islands(mpc)
        [GROUPS, ISOLATED] = case_info(mpc)
        mpc.bus([ISOLATED],BUS_TYPE)=4
        mpc = extract_islands(mpc, GROUPS, 1)
           results=rundcpf(mpc,opt);
    end
    F1=results.branch(:,PF);
    F1=abs(F1);
    ss=sum(F1);
    fprintf('%d \n',ss)

   z(x) = double(ss)

end
    display(z)


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Ray Daniel Zimmerman<mailto:r...@cornell.edu>
Sent: Tuesday, December 7, 2021 1:56 AM
To: MATPOWER-L<mailto:matpowe...@list.cornell.edu>
Subject: Re: Removing a bus with its branch

MATPOWER does not include any code to do that automatically, but it’s trivial 
to write. Suppose k is the vector of indices of buses to eliminate. The 
following code should eliminate the buses and the branches.

bn = mpc.bus(k, BUS_I);
i = find(mpc.branch(:, F_BUS) == bn);
j = find(mpc.branch(:, T_BUS) == bn);
mpc.branch(k, BUS_TYPE) = NONE;
mpc.branch([i; j], BR_STATUS) = 0;

Btw, you may need to eliminate generators too.

g = find(mpc.gen(:, GEN_BUS) == bn);
mpc.gen(g, GEN_STATUS) = 0;

Best regards,

    Ray




On Dec 6, 2021, at 11:56 AM, prem panigrahi 
<prempanigr...@outlook.com<mailto:prempanigr...@outlook.com>> wrote:

Dear Ray sir
    Yes you are right. I am facing problem during automate the process. 
Actually I need to remove approx.. 400 buses, and each time after removal I 
need to calculate total active power of biggest Island network. Each times 
identifying the transmission lines connected to a bus and mention them to 
remove a bus is quite tidious job. If is thier any process in matpower to 
directly remove a bus along with its branches then it can help me atleast.

On 6 Dec 2021 21:07, Ray Daniel Zimmerman 
<r...@cornell.edu<mailto:r...@cornell.edu>> wrote:
You’ve got the right idea. You can simply set the branch status to 0 and then 
use find_islands() and to find the isolated buses and set their BUS_TYPE  to 
NONE (4). You may then be left with multiple islands, also found via 
find_islands() or extract_islands(). To solve a power flow, each island needs 
its own reference bus (which may have been eliminated even for the main 
system). The load / generation mismatch could also be potential very large in 
some islands, and that would show up in the slack generation (negative, or 
unreasonably large positive).

So I think the main challenge in automating everything is in selecting a new 
reference bus for islands without one. I’d probably go with the first PV bus, 
and if there are no PV buses, then that whole island blacks out and you can set 
all its buses to type NONE.

Hope this helps,

   Ray



On Dec 4, 2021, at 12:58 PM, prem panigrahi 
<prempanigr...@outlook.com<mailto:prempanigr...@outlook.com>> wrote:

Dear Ray sir, is their any direct process to remove bus along with their 
branches . I am using mpc.branch method to remove a bus with its branches. But 
I am facing difficulties when I have to remove more than 100 buses.
mpc.branch([6161;7479;7480;7488;7489;7490], BR_STATUS) = 0;
results=rundcpf(mpc,opt)
[groups, isolated] = find_islands(mpc)
mpc_list = extract_islands(mpc)
[GROUPS, ISOLATED] = case_info(mpc)
mpc.bus([ISOLATED],BUS_TYPE)=4
results=rundcpf(mpc,opt)

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows




Reply via email to