Ask Your Question
0

Getting all the branches in an area by just the area number?

asked 2019-05-14 14:45:38 -0500

cheema gravatar image

Is there any way to get all the branches in an area inclduing from bus # and to bus# by just using the area number?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-05-14 16:11:58 -0500

ademuth93 gravatar image

updated 2019-05-16 10:41:58 -0500

Yes, there is. Define a subsystem from the area(s) and use the subsystem data retrieval APIs. Something like the untested code below. This could potentially be cleaned up a bunch, but similar code has worked well enough for me in the past.

MySubsystem = 1 ## Arbitrary subsystem number, 0 through 11 are allowed I think?
MyAreas = [1,2,3,4]
ierr = psspy.bsysinit(MySubsystem)
ierr = psspy.bsysadd(MySubsystem, numarea=len(MyAreas), areas=MyAreas)

ierr, ckts = psspy.abrnchar(sid=MySubsystem, string='ID')
ierr, FromNum = psspy.abrnint(sid=MySubsystem, string='FROMNUMBER')
ierr, ToNum = psspy.abrnint(sid=MySubsystem, string='TONUMBER')

## PSSE returns a "list of lists" for each of the subsystem data retrieval functions
## We need to pull out the first element of each to make it easier to work with:
ckts = ckts[0]
FromNum = FromNum[0]
ToNum = ToNum[0]

BranchList = []
for i in range(len(ckts)):
    BranchList.append([ckts[i], FromNum[i], ToNum[i]])
edit flag offensive delete link more

Comments

1

Yeah, sth like that I think. Though I seem to remember that the abrn functions sometimes return the second element ("chts", "FromNum", "ToNum") as a list inside a list. Either them or some other subsystem retrival functions do that.

drsgao gravatar imagedrsgao ( 2019-05-15 03:42:51 -0500 )edit

I think you're right about that. I've edited my answer accordingly.

ademuth93 gravatar imageademuth93 ( 2019-05-16 10:42:17 -0500 )edit

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

Stats

Asked: 2019-05-14 14:45:38 -0500

Seen: 2,778 times

Last updated: May 16