Ask Your Question

How do I find all in-service branches connected to out of service buses?

asked 2012-03-21 20:09:36 -0500

Daniel_Hillier gravatar image

While trying to solve a case PSSE presented me (rather quietly) with:


So it is pretty obvious what I have done wrong here: I have an in-service branch connected to an out of service bus.

My question is how do I find the branch (and preferably any other offending buses and branches) using Python?

edit retag flag offensive close merge delete



looks good

JervisW gravatar imageJervisW ( 2012-04-03 04:11:43 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2012-03-22 19:21:41 -0500

chip gravatar image

Here's what I did:

  1. Find All buses
  2. Find In-Service buses
  3. Calculate Out-of-service buses using steps 1,2
  4. Create subsystem of out-of-service buses
  5. Find all in-service branches attached to subsystem

To test it, I created a system with 4 InService buses, 4 out-of-service buses, and a branch between every bus pair.

1. Find all buses

I'm abusing the basekv filter below just to select all buses.

# Find all buses
sid = 1
ierr = psspy.bsys(sid=sid, usekv=1, basekv=[0,1000]) 
ierr, all_buses = psspy.abusint(sid=sid, 
                                string=["NUMBER"], flag=2)
all_buses = all_buses[0]

2. Find in-service buses

# Find in-service buses
ierr, in_service_buses = psspy.abusint(sid=sid, string=["NUMBER"], flag=1)
in_service_buses = in_service_buses[0]

3. Calculate out-of-service buses

Steps 1-3 are just to find the out-of-service buses. It seems like a lot of work, but I couldn't find a better way.

# Find not in-service buses
out_service_buses = list(set(all_buses) - set(in_service_buses))

4. Subsystem with only out-of-service buses

# Make a subsystem from out-of-service buses
sid = 2
ierr = psspy.bsys(sid=sid, numbus=len(out_service_buses), 

5. InService Branches on subsystem

# Find in-service, non-transformer branches
ierr, branches = psspy.abrnint(sid=sid, string=["FROMNUMBER", "TONUMBER"], 
                               flag=1, ties=3)

6. Check your work

# Report
for i in range(len(branches[0])):
    print "There's a problem with branch from %s to %s" % (branches[0][i],

And you should get something like:

There's a problem with branch from 1 to 10
There's a problem with branch from 1 to 11
There's a problem with branch from 1 to 12
There's a problem with branch from 2 to 10
edit flag offensive delete link more


Thanks @chip. I really like the way you solved this!

Daniel_Hillier gravatar imageDaniel_Hillier ( 2012-03-22 19:35:35 -0500 )edit

answered 2016-09-28 15:50:46 -0500

perolofl gravatar image

PSSE has actually an activity to find this kind of topology errors. You find activity TREE under Power Flow menu and Check Data. The corresponding API is psspy.tree(1,0)

edit flag offensive delete link more

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


Asked: 2012-03-21 20:09:36 -0500

Seen: 3,661 times

Last updated: Sep 28 '16