Ask Your Question
0

How to i find all buses which are connected to a specific bus

asked 2019-07-01 09:52:01 -0500

NilleDaWize gravatar image

updated 2019-07-01 09:56:49 -0500

Hi,

I am new to PSSE and have been looking thorough the API documentation in search of a method that will take a bus number as argument and return all the buses which are connected to it. The closest I have got is using NXTBUS, but from what I can tell it will only give me one of the adjecent buses and then move on down the line. I'm wondering if maybe I have to get all the branches first and then check what buses are connected to given branches?

If anyone knows of a way to fetch all buses connected to a specific bus that would be amazing.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-07-01 17:58:47 -0500

perolofl gravatar image

You have to call nxtbrn in a loop until there are no more branches connected to ibus. See example below:

tobuses,ckts = [],[]
ierr = psspy.inibrn(ibus,2)
while ierr==0:
    ierr, jbus, ickt = psspy.nxtbrn(ibus)
    if ierr==0: 
        tobuses.append(jbus)
        ckts.append(ickt)

List tobuses will contain the to bus number of all branches and 2W connected to ibus. List ckts contains the id's.

edit flag offensive delete link more

Comments

Worked like a charm! Thank you so much!

NilleDaWize gravatar imageNilleDaWize ( 2019-07-02 01:40:03 -0500 )edit

This piece of code only includes the to-bus neighbourhood and not includes from-bus nerghbourhood. Are there any way to solve that?

zejia01 gravatar imagezejia01 ( 2023-08-08 14:54:12 -0500 )edit

What do you mean with "from-bus neighborhood"?

perolofl gravatar imageperolofl ( 2023-08-09 06:46:22 -0500 )edit

I mean this code cannot find all buses which are connected to a specific bus. According to the defination of NXTBRN, if the specific bus A and its neighbor bus B is connected by a branch where bus A is the to bus and bus B is the from bus. NXTBRN cannot find bus B by using command NXTBRN(A).

zejia01 gravatar imagezejia01 ( 2023-08-09 09:38:20 -0500 )edit

Have you tested the code? It returns all branches connected to ibus. INIBRN is called with argument single=2, which will return all branches.

perolofl gravatar imageperolofl ( 2023-08-16 02:46:32 -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

Stats

Asked: 2019-07-01 09:52:01 -0500

Seen: 1,500 times

Last updated: Jul 01 '19