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

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

ERROR:  1 IN-SERVICE BRANCHES CONNECTED TO TYPE  4 BUS  65960 [CNOR011E    11.000]


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 close merge delete

1

looks good

( 2012-04-03 04:11:43 -0500 )edit

Sort by ยป oldest newest most voted

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),
buses=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)


# Report
for i in range(len(branches[0])):
print "There's a problem with branch from %s to %s" % (branches[0][i],
branches[1][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
<snip>

more

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

( 2012-03-22 19:35:35 -0500 )edit

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)

more