First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
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))
2 | No.2 Revision |
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))
3 | No.3 Revision |
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:
# fetch all tie branches for area 4 | No.4 Revision |
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