0

If there are islands, can I get a list of the islanded buses using psspy?

I know about psspy.tree(), but it only returns the number of buses in the swingless island. I want a list of the islanded buses. Is there a way to automate this?

bikiran1991's avatar
47
bikiran1991
asked 2022-09-22 15:37:45 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

The easiest is to use API treedat, which returns a lot of information in a dictionary. The following will return a list with a sublist with bus numbers in every found island.

treeobj = psspy.treedat(999)
islandbuses = treeobj['island_busnum']

For eaxemple, with three islands the list may look like this:

[[101], [102], [201, 202, 203, 204, 205, 206, 211]]

This can be merged into one single list with:

islandbuslist = [j for i in islandbuses for j in i]

Now the list is:

[101, 102, 201, 202, 203, 204, 205, 206, 211]

Everything in a single line:

islandbuslist = [j for i in psspy.treedat(999)['island_busnum'] for j in i]
perolofl's avatar
3.8k
perolofl
answered 2022-09-23 02:40:53 -0600, updated 2022-09-23 02:49:32 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer