0

I have data in an excel file that I would like to use to create a case in PSSE. The data is organized as it would appear in a case in PSSE (ie. for bus Bus number, name, base kV, and so on. Of course the data can be entered manually but I'm working with over 500 buses. I have tried copied and pasting, but that seems to works only sometimes. For machine data, it barely works.

Is there a way to import this data to PSSE from an excel file? I have recently started running PSSE with Python, and maybe there is a way to do this?

-- MK.

user3926096
  • 1
  • 1
  • 1
  • You're going to need to [edit] your question with a lot more information in order to get a useful answer, as I bet very few people here have ever used PSSE (there are only 3 questions about it on SO, including this one). What is the format of your Excel data? How does PSSE accept input, i.e., what type of data structure do you need to pass information to the program (list, dict, etc.)? Have you done any research on how to read Excel files from Python, or have you tried converting the `.xls(x)` file to a CSV file and using the [`csv`](https://docs.python.org/2/library/csv.html) module instead? – MattDMo Aug 10 '14 at 03:35
  • Generally, we like to see some effort put in - show us what code you've tried already, even if it's not working, and tell us where you're stuck. StackOverflow is not a from-scratch code-writing service, but we're more than willing to help out if there are specific issues you're having problems with. Check out the `csv` module I linked to, and read through whatever PSSE Python docs are available, then try stuff out! It's quite straightforward to import data from CSV files and put it into other data structures like dicts or lists, so see what you can accomplish on your own first. – MattDMo Aug 10 '14 at 03:40
  • Thanks MattDMo, I will include all details for this question after I try some more options. – user3926096 Aug 10 '14 at 17:55

2 Answers2

1

Yes. You can import data from an excel file into PSSE using the python package xlrt, however, I would reccomend instead converting your excel file to csv before you import and use csv as it is much easier. Importing data using the API is not just a copy and paste job, into the nicely tabulated spreadsheet that PSSE has in its case data.

Refer to the API documentation for PSSE, chapter II. Search this function, BUS_DATA_2. You will see that you can create buses with this function.

So your job should be three fold.

  1. Import the csv file data with each line being a list of each data parameter for your bus. Like voltage, name, baseKV, PU etc. Store it to another list.

  2. Iterate through the new list you just created and call:

    ierr = bus_data_2(i, intgar, realar, name)
    

and pass in your data from the csv file. (see PSSE API documentation on how to do this) This will effectively load data from the csv file to your case ( in the form of nodes or buses).

  1. After you are finished, you will need to call a function called psspy.save("Casename.sav") to save your work in a new PSSE case.

Note: there are functions to load in line data, fix shunt data, generator data etc.

Your other option is to call up the PTI folks as they can give you training.

Good luck

bud
  • 485
  • 6
  • 22
0

If you have an Excel data file with exactly the same "format" and same "info" as the regular case file (.sav), try this:

  1. Open any small example .sav file from the example sub-folder PSSE's installation folder

  2. Copy the corresponding spreadsheet to the working case (shown in spreadsheet view) with the same "info" (say, bus, branch,etc.) in PSSE GUI

  3. After finishing copying everything, then save the edited working case in GUI as a new working case.

If this doesn't work, I suggest you to ask this question on forum of "Python for Power Systems": https://psspy.org/psse-help-forum/questions/

amo
  • 4,082
  • 5
  • 28
  • 42
Deanna1125
  • 33
  • 5