First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
Yes, there is. Define a subsystem from the area and use the subsystem data retrieval APIs. Something like the untested code below:
ierr, ckts = psspy.abrnchar(sid=MySubsystem, string='ID')
ierr, FromNum = psspy.abrnint(sid=MySubsystem, string='FROMNUMBER')
ierr, ToNum = psspy.abrnint(sid=MySubsystem, string='TONUMBER')
BranchList = []
for i in range(len(ckts)):
enter code here
2 | No.2 Revision |
Yes, there is. Define a subsystem from the area and use the subsystem data retrieval APIs. Something like the untested code below:below. This could potentially be cleaned up a bunch, but similar code 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')
BranchList = []
for i in range(len(ckts)):
enter code here
BranchList.append(ckts[i], FromNum[i], ToNum[i])
3 | No.3 Revision |
Yes, there is. Define a subsystem from the area 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')
BranchList = []
for i in range(len(ckts)):
BranchList.append(ckts[i], FromNum[i], ToNum[i])
4 | No.4 Revision |
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], BranchList.append([ckts[i], FromNum[i], ToNum[i])
ToNum[i]])