Ask Your Question
0

Locate generators with 10 busses

asked 2019-10-16 19:55:30 -0500

lodea415 gravatar image

Any ideas on how to locate the generator buses with a certain number of buses (say 10) of the POI? I am trying to identify nearby generators in order to adjust dispatch and create a stresses case for testing new generator interconnections.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-10-17 09:13:45 -0500

acd1 gravatar image

I've done something that could help with this. I wanted to export portions of a subtransmission system from one model to use in another model.

I used a recursive DFS method to find buses of a similar or lower voltage level to the POI, stopping at any normally open branches or step-up transformers. I'm quite sure you could adapt this code to fit your needs.

def getBusList(POIs, bus_list):
    for POI in POIs:
        bus_list.append(POI) #add bus to list
        ierr, POI_voltage = psspy.busdat(POI,'BASE') #get source base kV

        n = 0 #for tracking branch the search is on

        #initialize and find first branch from source bus
        ierr = psspy.inibrn(POI, 2)
        ierr, jbus, kbus, ickt = psspy.nxtbrn3(POI)

        while ierr == 0:

            #necessary type conversions
            jbus = int(jbus)
            kbus = int(kbus)
            ickt = str(ickt)

            #search jbus for further branches
            ierr, status = psspy.brnint(POI,jbus,ickt,'STATUS')
            #stop at NOs and don't get duplicate buses
            if (status != 0) & (jbus not in bus_list):
                ierr, branch_voltage = psspy.busdat(jbus,'BASE')
                if POI_voltage >= branch_voltage: #don't go to higher voltage branches
                    getBusList([jbus], bus_list)

            # if there's a 3-winding transformer, search kbus for further branches
            if (kbus != 0) & (kbus not in bus_list):
                ierr, status = psspy.brnint(POI,kbus,ickt,'STATUS')
                #stop at NOs and don't get duplicate buses
                if (status != 0) & (kbus not in bus_list):
                    ierr, branch_voltage = psspy.busdat(kbus,'BASE')
                    if source_voltage >= branch_voltage: #don't go to higher voltage branches
                        getBusList([kbus], bus_list)
edit flag offensive delete link more

Comments

1

Be careful of recursion in Python since there is a limit to prevent overly large stack. It is usually recommended to use iteration instead. Consider using 'while'.

drsgao gravatar imagedrsgao ( 2019-10-17 10:49:13 -0500 )edit

Agreed, it is important to recognize the stack limitations in Python. In my case, it was not really a concern for my application, and the recursive code was easier to write up. But if there is the potential for hundreds of recursive function calls, it may not always be appropriate.

acd1 gravatar imageacd1 ( 2019-10-17 13:45:48 -0500 )edit

Very interesting. Thanks for the reminding.

yunzhi cheng gravatar imageyunzhi cheng ( 2019-11-21 05:19:13 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2019-10-16 19:55:30 -0500

Seen: 530 times

Last updated: Oct 17 '19