Ask Your Question
0

loop only through EXISTING buses

asked 2020-04-11 18:20:04 -0600

Ascegan gravatar image

I want to evaluate each bus in the case for mismatch. Instead of looping through 0 - 999999, is there a way to identify only bus numbers that are actually in use in the case? Otherwise I'm operating (getting error flag) on bus numbers that don't exist.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-04-12 09:43:41 -0600

jconto gravatar image

Search the forum for 'buses' for similar comments or check "How can I find all 500kV buses in an area?" for a code example on selecting buses. Below is code that uses the caspy module to get a list of buses existing in a base case:

import psse33
import caspy

case = caspy.Savecase(r"""savnw.sav""")
for item in case.pssbus.num:
    print item
edit flag offensive delete link more

Comments

Thanks, I found the "500kV buses" solution, it creates a subsystem first then outputs the bus quantities into a list, I added the feature below or organize the bus quantities into tuples: sortlist = list(zip(*target_buses)) One flaw : even setting abusint flag =2 won't pick up bus types 4,5,6,7.

Ascegan gravatar imageAscegan ( 2020-04-17 19:39:04 -0600 )edit
0

answered 2020-04-15 04:51:17 -0600

perolofl gravatar image

As jconto wrote, there are several examples on how to loop all buses. Here is an example using psspy:

ierr, buses = psspy.abusint(-1, 2, ['NUMBER'])
for ibus in buses[0]:
    print ibus
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2020-04-11 18:20:04 -0600

Seen: 956 times

Last updated: Apr 15 '20