First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

Get names of buses in correct order.

asked Jun 3 '16

Transmission Impossible gravatar image

updated Jun 3 '16

To get the names of buses, I create a subsystem consisting of the buses I want, using psspy.bsys, then I use abuschar to get the bus names, like this:

psspy.bsys(1,0,[ 0.69, 400.],0,[],1,[buses],0,[],0,[])
ierr, carray = psspy.abuschar(1,2,'NAME')

This gives me the names in the order they are listed in PSS/E. What I want is to get the names of the buses, sorted in the same order as my list buses.

My solution has been to make multiple subsystems, and call abuschar several times. Is there a way to avoid this?

nodes = [1,2,3,10,4]

for x in range(0,len(nodes)):
   psspy.bsys(x,0,[ 0.69, 400.],0,[],1,[nodes[x]],0,[],0,[])

   ierr, carray = psspy.abuschar(x,2,'NAME')   
   names[x] = carray[0][0].strip()

3 answers

Sort by » oldest newest most voted
1

answered Jun 9 '16

SqFKYo gravatar image

If you ask PSS/E both the numbers and the names of the buses, you'll get them back in the same order. Then to sort them you can use Python's sort combined with key-parameter such as in this example: http://stackoverflow.com/questions/13...

link

Comments

Nice solution! Didn't think of that. Requires some work around, but it's clever =)

0

answered Sep 26 '16

SqFKYo gravatar image

Unfortunately psspy.notona gives the EXNAME instead of NAME of the bus.

link

Comments

No problem! For those who prefer the short name instead of the extended name it is just to replace the last line in my script with: names.append(name[:12].strip())

perolofl gravatar imageperolofl (Sep 26 '16)
0

answered Sep 23 '16

perolofl gravatar image

This solution is simple without any unnecessary complications or work arounds...

nodes = [1,2,3,10,4]

names = []
for ibus in nodes:
  ierr,name  = psspy.notona(ibus)
  names.append(name)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Jun 3 '16

Seen: 2,536 times

Last updated: Sep 26 '16