Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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

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

# you can confirm that all frombusID are actually within area 1
print "fbus=", frombus
print "tbus=", tobus

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


nbAreas = []    
for i in tobus:
    nbAreas.append(busAreas[busNums.index(i)])

# since nbAreas might contain duplicated area numbers, so remove duplications

print "nbAreas=", list(set(nbAreas))

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

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

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

# you can confirm that all frombusID are actually within area 1
print "fbus=", frombus
print "tbus=", tobus

# 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 tobus:
    nbAreas.append(busAreas[busNums.index(i)])

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

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

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

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

# you can confirm that all frombusID are actually within area 1
combine fbus and tbus to one list
tiebuses = frombus + tobus
print "fbus=", frombus
print "tbus=", tobus
"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 tobus:
tiebuses:
    nbAreas.append(busAreas[busNums.index(i)])

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

# remove area n itself
nbAreas.pop(nbAreas.index(n))
print nbAreas

I just figured out a way to implement my idea above, let's say I want to find out all neighboring areas for area 1: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