Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Answering my question for posterity. Not an elegant solution, but this is the workaround that I currently have developed for my application:

INTGAR = []
REALAR = []
BrImp = psspy.brndt2(int(fromBus#),int(toBus#),str(cktID),'RX')
if BrImp[0] == 0:
    Cmplx_BrImp = complex(BrImp[1])
    Brn_Chrging = psspy.brndat(int(fromBus#),int(toBus#),str(cktID),'CHARG')[1]
    REALAR.insert(0,Cmplx_BrImp.real) #br resistance pu
    REALAR.insert(1,Cmplx_BrImp.imag) #br reactance pu
    REALAR.insert(2,float(Brn_Chrging)) #br charging 
    REALAR.insert(3, float(NewRATINGA)) #New Rating A
    REALAR.insert(4, float(NewRATINGB)) #New Rating B
    REALAR.insert(5, float(NewRATINGC)) #New Rating C
    psspy.branch_chng(int(fromBus#),int(toBus#),str(cktID),INTGAR,REALAR)

Oddly, even though the API won't accept NoneType values in the lists INTGAR and REALAR, it does accept a shorter-than-expected list for REALAR. Even though per API documentation REALAR is supposed to be 15 arguments long, it accepts this 6 element list and leaves the final 9 branch characteristic elements unchanged. The order of the shortened list must conform to the documentation. So I can get away with only calling brndt2() once and brndat() once to get existing impedance and charging data, since those are the only elements in the list REALAR that come before the Rating data.

This works, but doesn't feel "right." Calling brndt2() and brndat() iteratively for each rating change is needlessly expensive. Would still appreciate any other ideas!

Answering my question for posterity. Not an elegant solution, but this is the workaround that I currently have developed for my application:

INTGAR = []
REALAR = []
BrImp = psspy.brndt2(int(fromBus#),int(toBus#),str(cktID),'RX')
psspy.brndt2(int(fromBus#),int(toBus#),str(cktID),'RX') #get complex impedance for the branch
if BrImp[0] == 0:
    Cmplx_BrImp = complex(BrImp[1])
    Brn_Chrging = psspy.brndat(int(fromBus#),int(toBus#),str(cktID),'CHARG')[1]
psspy.brndat(int(fromBus#),int(toBus#),str(cktID),'CHARG')[1] #get the charging data for the branch
    REALAR.insert(0,Cmplx_BrImp.real) #br resistance pu
    REALAR.insert(1,Cmplx_BrImp.imag) #br reactance pu
    REALAR.insert(2,float(Brn_Chrging)) #br charging 
    REALAR.insert(3, float(NewRATINGA)) #New Rating A
    REALAR.insert(4, float(NewRATINGB)) #New Rating B
    REALAR.insert(5, float(NewRATINGC)) #New Rating C
    psspy.branch_chng(int(fromBus#),int(toBus#),str(cktID),INTGAR,REALAR)

Oddly, even though the API won't accept NoneType values in the lists INTGAR and REALAR, it does accept a shorter-than-expected list for REALAR. Even though per API documentation REALAR is supposed to be 15 arguments long, it accepts this 6 element list and leaves the final 9 branch characteristic elements unchanged. The order of the shortened list must conform to the documentation. So I can get away with only calling brndt2() once and brndat() once to get existing impedance and charging data, since those are the only elements in the list REALAR that come before the Rating data.

This works, but doesn't feel "right." Calling brndt2() and brndat() iteratively for each rating change is needlessly expensive. Would still appreciate any other ideas!

Answering my question for posterity. Not an elegant solution, but this is the workaround that I currently have developed for my application:

INTGAR = []
REALAR = []
BrImp = psspy.brndt2(int(fromBus#),int(toBus#),str(cktID),'RX') psspy.brndt2(int(fromBusNum),int(toBusNum),str(cktID),'RX') #get complex impedance for the branch
if BrImp[0] == 0:
    Cmplx_BrImp = complex(BrImp[1])
    Brn_Chrging = psspy.brndat(int(fromBus#),int(toBus#),str(cktID),'CHARG')[1] psspy.brndat(int(fromBusNum),int(toBusNum),str(cktID),'CHARG')[1] #get the charging data for the branch
    REALAR.insert(0,Cmplx_BrImp.real) #br resistance pu
    REALAR.insert(1,Cmplx_BrImp.imag) #br reactance pu
    REALAR.insert(2,float(Brn_Chrging)) #br charging 
    REALAR.insert(3, float(NewRATINGA)) #New Rating A
    REALAR.insert(4, float(NewRATINGB)) #New Rating B
    REALAR.insert(5, float(NewRATINGC)) #New Rating C
    psspy.branch_chng(int(fromBus#),int(toBus#),str(cktID),INTGAR,REALAR)
psspy.branch_chng(int(fromBusNum),int(toBusNum),str(cktID),INTGAR,REALAR)

Oddly, even though the API won't accept NoneType values in the lists INTGAR and REALAR, it does accept a shorter-than-expected list for REALAR. Even though per API documentation REALAR is supposed to be 15 arguments long, it accepts this 6 element list and leaves the final 9 branch characteristic elements unchanged. The order of the shortened list must conform to the documentation. So I can get away with only calling brndt2() once and brndat() once to get existing impedance and charging data, since those are the only elements in the list REALAR that come before the Rating data.

This works, but doesn't feel "right." Calling brndt2() and brndat() iteratively for each rating change is needlessly expensive. Would still appreciate any other ideas!