First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
Here is a nice function returning the total for a specified subsystem:
def subssum(areas=[], zones=[], owners=[], buses=[], kv=[]):
""" Returns total Pgen, Pmax and %-loading for generators in a subsystem"""
kvopt = 0 if len(kv)==0 else 1
psspy.bsys(11,kvopt,kv,len(areas),areas,len(buses),buses,len(owners),owners,len(zones),zones)
ierr, pgen = psspy.amachreal(11, 1, 'PGEN')
ierr, pmax = psspy.amachreal(11, 1, 'PMAX')
if pgen is None: pgen = [[]]
if pmax is None: pmax = [[]]
pgtot = sum(pgen[0])
pmtot = sum(pmax[0])
pct = pgtot/pmtot*100 if pmtot > 0 else 0
return pgtot, pmtot, pct
For example in savnw network the following returns the total for area 1 and 2 and owner 22:
pgtot, pmaxtot, pct = subssum(areas=[1,2],owners=[22])