Ask Your Question
0

Do you know a better way to find an area's neighboring areas?

asked 2014-08-26 08:53:57 -0500

ypwang gravatar image

updated 2014-08-27 20:54:40 -0500

Hi all, I am thinking of using subsystem tie branch info to detect contiguous neighboring areas for a specified area and then check each tie branch to all neighboring areas for its "toBusId". Then find out which areas those "toBusID" reside.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-08-26 11:30:52 -0500

ypwang gravatar image

updated 2014-08-26 13:03:24 -0500

I just figured out a way to implement my idea above, let's say I want to find out all neighboring areas for area n:

# define subsystem n and let it only contains area n psspy.bsys(sid=n, usekv=0, numarea=1, areas=[n])

# fetch all tie branches for area n (i.e. subsystem n)
ierr, (frombus,) = psspy.abrnint(n, 1, 2, 3, 1, 'FROMNUMBER')
ierr, (tobus,) = psspy.abrnint(n, 1, 2, 3, 1, 'TONUMBER')

# combine fbus and tbus to one list
tiebuses = frombus + tobus
print "tiebuses", tiebuses

# fetch all bus numbers for entire system 
ierr, (busNums,) = psspy.abusint(-1, 1, 'NUMBER')
ierr, (busAreas,) = psspy.abusint(-1, 1, 'AREA')

# store area number for each toBusnum to a list
nbAreas = []    
for i in tiebuses:
    nbAreas.append(busAreas[busNums.index(i)])

# since nbAreas might contain duplicated area numbers, so remove duplications
nbAreas = list(set(nbAreas))
print "areasincludeCurrOne=", nbAreas

# remove area n itself
nbAreas.pop(nbAreas.index(n))
print nbAreas
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

Stats

Asked: 2014-08-26 08:53:57 -0500

Seen: 373 times

Last updated: Aug 27 '14