Importing data from Excel and Scaling areas
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?
First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
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?
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.
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
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]
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
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?
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?
Asked: 2016-04-15 22:42:18 -0600
Seen: 1,158 times
Last updated: Jul 17 '17
AttributeError: module 'openpyxl' has no attribute 'load_workbook' [closed]
excelpy Overwriting Saved data
Help update data in PSSE by Python 2.7 get data from excel file.
exporting dynamic simulation results to excel using python
How to export the voltage value on the busbars from DigSilen via python to excel