Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have not come across such an API. The following function will return the lists of 2 winding transformers regulating the bus you specify by the icont argument.

def TwoWTfmr_RegIcont(sid=-1, owner=1, ties=1, flag=1, entry=1, icont=0):
    ierr, [bus1, bus2, icontnumber] = psspy.atrnint(sid=sid, owner=owner, ties=ties, flag=flag,
                                                    entry=entry, 
                                                    string=['FROMNUMBER', 'TONUMBER', 
                                                            'ICONTNUMBER'])

    ierr, [tfmr_id] = psspy.atrnchar(sid=sid, owner=owner, ties=ties, flag=flag,
                                     entry=entry, string='ID')

    tfmrs = [(b1, b2, tid) for b1, b2, tid, icnt in zip(bus1, bus2, tfmr_id, icontnumber) 
            if icnt == icont]
    return zip(*tfmrs)

# Sample usage
psspy.case(r"C:\Program Files (x86)\PTI\PSSE33\EXAMPLE\bench2.sav")
[b1,b2,ckt] = TwoWTfmr_RegIcont(flag=2, icont=6011)
print b1, b2, ckt
click to hide/show revision 2
Fixed line wrapped line.

I have not come across such an API. The following function will return the lists of 2 winding transformers regulating the bus you specify by the icont argument.

def TwoWTfmr_RegIcont(sid=-1, owner=1, ties=1, flag=1, entry=1, icont=0):
    ierr, [bus1, bus2, icontnumber] = psspy.atrnint(sid=sid, owner=owner, ties=ties, flag=flag,
                                                    
                                                    flag=flag, entry=entry, 
                                                    string=['FROMNUMBER', 'TONUMBER', 
                                                            'ICONTNUMBER'])

    ierr, [tfmr_id] = psspy.atrnchar(sid=sid, owner=owner, ties=ties, flag=flag,
                                     entry=entry, string='ID')

    tfmrs = [(b1, b2, tid) for b1, b2, tid, icnt in zip(bus1, bus2, tfmr_id, icontnumber) 
            if icnt == icont]
    return zip(*tfmrs)

# Sample usage
psspy.case(r"C:\Program Files (x86)\PTI\PSSE33\EXAMPLE\bench2.sav")
[b1,b2,ckt] = TwoWTfmr_RegIcont(flag=2, icont=6011)
print b1, b2, ckt