Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

My solution ended up using the initie command with the relevant area, and then using nxttie() to loop through each tie. First I would check if the bus was in the required area (123 in the example), then I would then check the bus using busdat to see if it was a 230 kV line. If it was, I made sure that I had the correct metered end, and then I would add the real part of brnflo to my running total, and this would give me the total in the end. Example code:

myArea = 987
toArea = 123
kV = 230.0
interchange230 = 0

ierr = psspy.initie(myArea)
ierr, ibus, jbus, ickt = psspy.nxttie()

while ierr == 0:
    ierr, ival = psspy.busint(jbus, 'AREA')
    if (ierr == 0) and (ival == toArea):
        ierr, rval = busdat(jbus, 'BASE')
        if (ierr == 0) and (rval == kV):
            ierr, ival = psspy.brnint(ibus, jbus, ickt, 'METER')
            if (ival == ibus):
                ierr, cmpval = psspy.brnflo(ibus, jbus, ickt)
                if (ierr == 0): 
                    interchange230 += cmpval.real
            else:
                ierr, cmpval = psspy.brnflo(jbus, ibus, ickt)
                if ierr == 0:
            i       interchange230 += -(cmpval.real)