Ask Your Question
0

Importing data from Excel and Scaling areas

asked 2016-04-15 22:42:18 -0500

Rahul gravatar image

updated 2016-04-27 23:25:53 -0500

jconto gravatar image

I have a sheet containing Load and Generation data in Excel. I want to take the data by accessing the excel sheet and scale specific Zones and change machine generation values. Any leads?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2016-04-27 12:23:06 -0500

jconto gravatar image

updated 2017-07-17 18:53:54 -0500

The code attached is a simple example on using the module 'excelpy', provided by PTI in the PSSe installation. Basic writing and reading to an excel file. The scaling of load (by zone or other criteria) and changing machine Pgen values are functions included in the API manual, and relative easy to execute.

Once you have an excel file with defined format for your load and gen data, use the py code to read it within a loop until data input is empty. At each loop reading, load a base case, execute the scale and change of gen, maybe solve it and then save it to a different filename.

Download the excelpydemo.py code [copy the link into your browser if it does not connect when clicking on it]:JContogoogle drive. Once you select “excelpy_demo.py”, an icon on the top-center screen will perform the download.

edit flag offensive delete link more

Comments

Hello Jconto. Thanks for your initiative in answering my query. However, I was not able to open the attachment. Could you please repost the attachment. Thanks, Rahul

Rahul gravatar imageRahul ( 2016-04-28 00:48:04 -0500 )edit

The posting works. Right-click on the link and choose "Save Link As..", on the saving screen a name with ext .png appears. Save it and then rename it as excelpy_demo.py

jconto gravatar imagejconto ( 2016-04-28 09:33:20 -0500 )edit

Hello JConta, I was reading your answer to a post from the PSSE help forum about importing data from Excel and scaling areas. I tried accessing the code you posted but it wasn't found. Any way you can send it to me when you get the chance? Thank you and have a nice day. - Mike

Mike gravatar imageMike ( 2017-07-17 18:01:58 -0500 )edit

Mike, Link has been updated.

jconto gravatar imagejconto ( 2017-07-17 18:55:51 -0500 )edit
0

answered 2016-04-29 01:24:10 -0500

Rahul gravatar image

updated 2016-04-29 02:14:48 -0500

Hello Jconto, Thank you so much for your help. It was great to find the whole list of arguments of excelpy in your python file. I was using the file and encountered this following error. Although it is not exactly linked, I would appreciate your guidance. I am using a piece of code and the value of AllLoad is returning as [Null]. I am not able to trace the error here. Also, I was trying to export the information to an excel using set_range function. Am I going in the right direction?

areas = [5201, 5301, 5401, 5501, 5601, 5701, 5801, 5902]

The PSSE Case has the areas as above

psspy.bsys(sid=0, numarea=len(areas), areas=areas) ierr, AllLoad = psspy.aareareal(sid=0,string='PLOAD') AllLoad xl.set_range(2, 4, AllLoad, fontStyle = 'Arial',fontColor = 'Red')

Also, the following code is giving an output in excel that is not really comprehendable to me: buses = [524003, 521011, 524001, 521001, 524005, 514001, 524006, 524007, 524009] psspy.bsys(sid=0, numbus=len(buses), buses=buses) ierr, volts = psspy.abusreal (sid=0,string='KV') volts

ierr, AllLoad = psspy.aareareal(sid=0,string='PLOAD')

AllLoad

xl.setrange(2, 4, volts, fontStyle = 'Arial',fontColor = 'Red') xl.setrange(3, 4, buses, fontStyle = 'Arial',fontColor = 'Red')

volts = 407.2868347 134.6368866 134.2896271 412.4360046 407.9005737 404.2839661 411.1826477 407.6182861 410.2168579 buses = 524003 521011 524001 521001 524005 514001 524006 524007 524009

Here, the buses Matrix is in the same order in which it has been entered. But, the voltage matrix seems to be undergoing some type of sorting based on Voltage Level. So the 400 kV buses do not correspond to it's voltage at output. Could you please explain the reason?

edit flag offensive delete link more

Comments

Your code is not readable. Send me an email to jcpotencia@mail.com with sufficient explanation on how the code works and about the problem. Can it be run in the savnw.sav case?

jconto gravatar imagejconto ( 2016-04-29 20:54:07 -0500 )edit

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-04-15 22:42:18 -0500

Seen: 1,148 times

Last updated: Jul 17 '17