Ask Your Question
0

Get names of buses in correct order.

asked 2016-06-03 02:08:26 -0600

Transmission Impossible gravatar image

updated 2016-06-03 02:35:48 -0600

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()
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2016-06-09 01:42:40 -0600

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

edit flag offensive delete link more

Comments

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

Transmission Impossible gravatar imageTransmission Impossible ( 2016-06-09 06:24:18 -0600 )edit
0

answered 2016-09-26 01:11:01 -0600

SqFKYo gravatar image

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

edit flag offensive delete link more

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 ( 2016-09-26 09:09:48 -0600 )edit
0

answered 2016-09-23 01:58:32 -0600

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

1 follower

Stats

Asked: 2016-06-03 02:08:26 -0600

Seen: 2,455 times

Last updated: Sep 26 '16