Ask Your Question
4

Can we create a single line diagram(sld) from raw data using python?

asked 2012-10-24 20:45:01 -0500

Nads gravatar image

Hello PSSE experts,

I have recently started working on PSSE and I want to know if there is a way to create a single line diagram(*.sld) file from the raw data available? Is there a python subroutine or should I have to do it manually one by one? Since its a large system, I could not do it manually. Please shed some light on this topic. Even hints for writing a script will do.

Thanks,

edit retag flag offensive close merge delete

9 answers

Sort by ยป oldest newest most voted
3

answered 2012-10-24 21:26:37 -0500

JervisW gravatar image

Hello,

I saw a question about using Python to generate a SLD recently:

Move buses in slider diagrams

The trouble is, for a large system. The automated draw routines in PSSE are not very good. They create a terrible mess. Buses and branches are everywhere, overlapping each other. It can take a full day to sort it all out.

Has anyone had experience created their own draw file with the desired bus locations and then importing that into PSSE?

edit flag offensive delete link more

Comments

Hello Jervis, Thanks for the help. But I exactly have the same concern. Automated diagram are incomprehensible and whether the diagram created outside PSSE could be imported or not. The important thing is to project a visual picture of loading and weak points in the large grid.

Nads gravatar imageNads ( 2012-10-25 04:18:51 -0500 )edit

As for using Python + 3rd Party library. We've toyed with the idea of building something with this: http://networkx.lanl.gov/ to visualise networks. If we create an open source project would anyone else be interested in seeing the results?

JervisW gravatar imageJervisW ( 2012-10-25 16:28:35 -0500 )edit

@JervisW are you sure networkx is the right tool? Thanks for pointing it out anyway.

amaity gravatar imageamaity ( 2012-10-25 20:25:40 -0500 )edit

@JervisW Yes, I would.

waltterval gravatar imagewaltterval ( 2012-10-25 23:57:47 -0500 )edit

@amaity not sure that NetworkX is the right tool - It could end up being a poor choice. Tthere are a few different libraries for auto layout of networks - as well as the option of writing our own simple versions from scratch.

JervisW gravatar imageJervisW ( 2012-10-26 00:19:10 -0500 )edit
3

answered 2012-10-25 11:17:30 -0500

jsexauer gravatar image

updated 2012-12-05 07:25:20 -0500

I spent a few days a while back trying to tackle this. A few things I learned:

  • There is this program someone made to create slider diagrams: Local Area Viewer http://www.cleargridsolutions.com/ How it works is he exports the case info to a page file and then does the actual creation of the slider diagram in an independent exe. There is a python script that is used as an interface between PSSE and his standalone exe. Interesting to look at anyways.
  • I then started writing a set of classes to create diagrams based on the old psse DRAW command/format (because slider diagram xml was too much for me to care about). Its like a simpler slider diagram. I would then save the draw commands as a .drw file and import it using the api completely seamlessly in python. I got it about 25% done before deciding it was too much hassle, but I do think the idea would work.

UPDATE

I was browsing through the documentation and found a reference to "sliderPy" which is used to modify slider diagrams. I haven't had a chance to look at it at all, but here is something to get you started:

import psspy
import sliderPy
help(sliderPy)
edit flag offensive delete link more

Comments

Does the Local Area Viewer create nicely drawn diagrams automatically? It looks like a great resource. How were you laying out the elements in the draw file? Was it based on map locations or another method?

JervisW gravatar imageJervisW ( 2012-10-25 16:24:42 -0500 )edit

LAV seems like a nice tool. I've only ever used the demo version, but it gets the job done when I need it. It was very basic. I was in essence trying to make diagrams that looked like the diagrams GOUT used to make in versions of PSSE before 30.

jsexauer gravatar imagejsexauer ( 2012-10-26 14:24:27 -0500 )edit

LAV does remove a few headaches but it is not reasonably priced.

amaity gravatar imageamaity ( 2012-10-27 07:33:07 -0500 )edit
2

answered 2012-11-14 08:15:29 -0500

rimux gravatar image

updated 2012-11-14 18:28:01 -0500

JervisW gravatar image

Hi,

I have written such small program which can build sld file from python, here it is:

def DrawBusesSLD(buslist):
    n_buses=len(buslist)
    buses=[]
    for i in range(n_buses):
        buses.append(buslist[i][0])

    for i in range(n_buses):
        psspy.bsys(0,0,[0.0, 750.],0,[],1,[buses[i]],0,[],0,[])
        psspy.growbus(buslist[i][0],buslist[i][1], buslist[i][2])

    psspy.bsys(0,0,[0.0, 750.],0,[],n_buses,buses,0,[],0,[])
    for i in range(n_buses):
        psspy.growbus(buslist[i][0],buslist[i][1], buslist[i][2])


buslist=[[1000, 0, -3.4],
       [1001, 1.7, -5.1],
       [1002, 3.4, -5.1],
       [1003, 5.1, -3.4]]

DrawBusesSLD(buslist)

Just change buslist variable to the bus numbers and corresponding x,y values.

edit flag offensive delete link more

Comments

Something went funny on the indentation for your code. I think that I fixed it - let me know if I got it wrong. By the way, great use of `bsys` and `growbus` together to grow out the sld automatically

JervisW gravatar imageJervisW ( 2012-11-14 18:29:24 -0500 )edit

I am not sure what problem did you get running my program, it runs on psse 32 just fine. By the way, I am using this program in connection with excel - in one excel sheet I am putting bus numbers in different cells that corresponds aproximately places where they should appear on sld diagram. Later run little excel vba code that generates buslist for the python program. Formulas for x and y coordinates are simple: x=(cell column number)x1.5 , y=-(cell raw number)x1.5 . Constants 1.5 can be different - depends what distance between buses in the diagram you need.

rimux gravatar imagerimux ( 2012-11-15 01:59:39 -0500 )edit
1

Very neat little program. I was unaware of the "growbus" API command.

jsexauer gravatar imagejsexauer ( 2012-11-15 08:23:52 -0500 )edit

Thanks for sharing.

amaity gravatar imageamaity ( 2012-11-15 09:33:41 -0500 )edit

@rimux, Sorry I didn't mean to say there was an error in your code! It runs fine.

JervisW gravatar imageJervisW ( 2012-11-15 15:41:47 -0500 )edit
1

answered 2013-04-29 20:06:26 -0500

amaity gravatar image

Here is one way to do it without using slider:

image description

edit flag offensive delete link more

Comments

Nice work @amaity, how did you get this one going?

JervisW gravatar imageJervisW ( 2013-05-08 04:51:23 -0500 )edit

'@JervisW I explained the idea [here](https://psspy.org/psse-help-forum/question/111/move-buses-in-slider-diagrams/).

amaity gravatar imageamaity ( 2013-05-09 11:32:13 -0500 )edit

Oh yes, I remember now. It's quite handy to have it auto drawn like that. Doing it by hand takes so much of my time.

JervisW gravatar imageJervisW ( 2013-05-10 05:56:52 -0500 )edit

@amaity, could you share the code again? It looks like the code is not showing up. Thanks.

yptp gravatar imageyptp ( 2019-07-10 15:12:32 -0500 )edit
0

answered 2013-05-29 17:57:14 -0500

YQM gravatar image

For some reason I can't comment. So, this is a question for @rimux When I'm running your code, the plotting of the buses works nicely. However, the x and y coordinates does not seem to work. Is this x and y coordinate the Cartesian coordinate or am I way off?

edit flag offensive delete link more

Comments

yes the x and y are the cartesian coordinate assuming 0,0 is at the center of the slider diagram

Anil Kumar gravatar imageAnil Kumar ( 2022-02-06 02:41:47 -0500 )edit
0

answered 2013-04-28 00:00:42 -0500

The Bull gravatar image

I don't know how the code written by rimux works ,GROWBUS api can only be used after you have opened saved case and here in this code no saved case file is opened ,someone please guide me because i have tried many times but the above code is not working

edit flag offensive delete link more
0

answered 2022-02-08 11:40:03 -0500

Anil Kumar gravatar image

Sir, With the data of buses(nodes) and lines(edges) you can plot the network plot using networkx library of python.

example:

import networkx as net
buses = ["101","102","103","104","105"]
lines = [("101","102"),("102","103"), ("102","104"),("103","105") ]
G = net.Graph()
G.add_nodes_from(buses)
G.add_edges_from(lines)
net.draw(G,with_labels=True)

you will get the neat network plot without psse in python

edit flag offensive delete link more
0

answered 2013-03-19 10:20:29 -0500

Amir gravatar image

Hi.I am the beginner of PSS'E.I want to create single line diagram using Python routine.Can you suggest me that from where should I read to get the Idea about Commands.

edit flag offensive delete link more

Comments

for studying all the python command api's you can refer at the api document at PTI/PSSE34(OR ANY)/DOC

Anil Kumar gravatar imageAnil Kumar ( 2022-02-06 05:28:05 -0500 )edit
-1

answered 2013-10-31 19:58:57 -0500

Tabby gravatar image

Hi , I have recently started learning PSS/E. Can anyone please tell me how I can do the automatic contingency test in PSS/E?

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

3 followers

Stats

Asked: 2012-10-24 20:45:01 -0500

Seen: 16,559 times

Last updated: Feb 08 '22