First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

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

asked Sep 22 '2

bikiran1991 gravatar image

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?

1 answer

Sort by » oldest newest most voted
0

answered Sep 23 '2

perolofl gravatar image

updated Sep 23 '2

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]
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Sep 22 '2

Seen: 846 times

Last updated: Sep 23 '22