0

Get names of buses in correct order.

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()
Transmission Impossible's avatar
71
Transmission Impossible
asked 2016-06-03 02:08:26 -0500, updated 2016-06-03 02:35:48 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

3 Answers

1

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...

SqFKYo's avatar
126
SqFKYo
answered 2016-06-09 01:42:40 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Transmission Impossible's avatar Transmission Impossible (2016-06-09 06:24:18 -0500) edit
add a comment see more comments
0

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

SqFKYo's avatar
126
SqFKYo
answered 2016-09-26 01:11:01 -0500
edit flag offensive 0 remove flag delete 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's avatar perolofl (2016-09-26 09:09:48 -0500) edit
add a comment see more comments
0

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)
perolofl's avatar
3.8k
perolofl
answered 2016-09-23 01:58:32 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer