Ask Your Question

NLacouve's profile - activity

2023-01-31 12:44:44 -0500 received badge  Famous Question (source)
2021-06-29 01:09:20 -0500 received badge  Famous Question (source)
2021-06-16 07:55:30 -0500 received badge  Notable Question (source)
2021-06-13 07:57:06 -0500 received badge  Popular Question (source)
2021-06-11 13:16:42 -0500 commented answer Change some (not all) branch data using branch_chng

Oof, I should have known that already. Thank you so much!

2021-06-10 11:54:00 -0500 received badge  Editor (source)
2021-06-10 11:51:06 -0500 answered a question Change some (not all) branch data using branch_chng

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(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(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(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!

2021-06-10 10:49:08 -0500 asked a question Change some (not all) branch data using branch_chng

I have an application that produces a list of branches and their dynamic ratings based on temperature (eg: from bus, to bus, ckt ID's, and NEW RATING) from which I want to modify only the ratings of branches, leaving all other data like ownership and impedance unchanged.

When I do this in the PSSE GUI recording to a python script I get something like:

psspy.branch_chng(frombusNum,tobusNum,r"""cktID""",[_i,_i,_i,_i,_i,_i],[_f,_f,_f, newRatingAfloat,newRatingBfloat,newRatingCfloat,_f,_f,_f,_f,_f,_f,_f,_f,_f])

When I integrate the command in my python application, though, I can't pass the default values "i" and "f" to the command. API documentation indicates that the user is responsible for providing values for these defaults. If I pass a blank list for INTGAR and blank floats to the non-rating REALAR lists like this:

psspy.branch_chng(int(fromBusNum),int(toBusNum),str(cktID),[],[float(),float(),float(),float(RATINGA),float(RATINGB),float(RATINGC),float(),float(),float(),float(),float(),float(),float(),float(),float()])

PSS\E thinks I want to change these blank float() values back to their defaults, which eliminates the already-defined impedance data. The ownership data (INTGAR, which above is called with a blank list []) remains unchanged. The API expects two lists when calling branch_chng. It will accept a list with nothing in it, but won't accept a list with elements that have NoneType values if it expects float or int. For example, this returns a Type error:

psspy.branch_chng(int(fromBusNum),int(toBusNum),str(cktID),[],[None,None,None,float(RATINGA),float(RATINGB),float(RATINGC),None,None,None,None,None,None,None,None,None])

My question is: Do I have to call the API command BRNDAT to get the REALAR values that I don't want to change, or is there a way to call branch_chng without supplying or overwriting the data I don't want to change?

2020-10-05 01:53:30 -0500 received badge  Notable Question (source)
2020-09-23 10:17:24 -0500 received badge  Popular Question (source)
2020-09-21 16:08:25 -0500 commented question Accessing fetch routines using GDIF

From the API Manual 1.85 GDIF entry: Usage is: call to GDIFAPI with APIOPT = 0; multiple calls to fetch routines; optionally, repeat of above steps for different Saved Case and/or subsystem; final call to GDIFAPI with APIOPT = 1. Step 2 ("multiple calls to fetch routines") is the subject of my Q.

2020-09-21 16:04:43 -0500 commented answer Accessing fetch routines using GDIF

Thanks, I think your recommendation using DIFF might offer a useable workaround to get lists of Branches/BUs status differences. Though I'd much prefer programmatically to access the memory directly in the way that these mysterious "fetch routines" supposedly offer.

2020-09-21 11:19:12 -0500 asked a question Accessing fetch routines using GDIF

Hello,

I'm new--sorry if this has been asked before (initial search yielded nothing).

I'm using the API "GDIF" to compare the model differences between a working case and another .sav case. The API guide says you can access the results "via the internally accessible fetch routines DIFTXT, DIFBUS, DIFBRN, DIF3WN, DIF2DC, DIFMDC and DIFFCT."

How do you call these fetch routines using psspy? I've tried: psspy.DIFBUS() and psspy.fetch('DIFBUS').

Both produce errors saying that there is no module named 'DIFBUS' or 'fetch.' I'm sure this is easy, just can't find it documented anywhere. Please help!