# Is there any way to convert a .sav to .xlxs using psspy?

I have a .sav file and I was wondering if there is any way to convert it from .sav to either .csv or .xlxs using psspy. I do know that there is a workaround in the PSS/E.

2. Go to File>Export>SpreadSheet Tab to CSV file, but the problem is that it is not only somewhat cumbersome when having a bunch of .sav but also that such export does only convert a table (bus, machine, plant,... and not the entire .sav)

Is there a way this can be achieved? If not, do you know about a function in psspy that permits set a value of a particular quantity? For example: let's say I would like to change the bus base voltage (BASKV). The only way I know right now is by invoking:

 ierr = bus_data_3(ibus, intgar, realar, name) 

but, by using this function, psspy requires that all values within the arrays intgar and realar must be specified. Is there any setter, something like:

 psspy.bus_data_set(ibus, quantity, value) 

###### ######################################

The curious thing is that psspy already in their retrieval package this function:

 ierr, rarray = abusreal(sid, flag, string) 

Further explanation in psspy.org/psse-help-forum/question/5827/how-to-set-a-custom-value-of-the-sav-file-using-psspy

edit retag close merge delete

Sort by » oldest newest most voted

It is easy to change the value for a particular quantity. For example, to change bus base voltage for bus 151 (in case savnw):

Record a python script and perform the change manually. PSSE will write the corresponding API for the performed data change. In this case:

psspy.bus_chng_3(151,[_i,_i,_i,_i],[ 510.0,_f,_f,_f,_f,_f,_f],_s)


Here, just the base voltage is changed and all other values are, by default, not changed. The variables _i, _f and _s make so those quantities are keeping their values. In the call above only the first real argument (base voltage) is changed.

It is also possible to only specify the value to be changed. In this case it is the first value in real argument list.

psspy.bus_chng_3(151,realar1=510)


This is exactly what you are asking for!

more

On the first question, There is not a function that would extract all the network data to xls format (or csv).

A potential scripted workaround:

Having a *.sav, create a *.raw file (same network data, but in text format) Then, use python code to parse the different block of data into separate files, saving each data block in *.csv format. For multiple *.sav cases, put the above process within a "for-loop"

more

That's certainly cumbersome but have thought about it. Thank you for your contribution!

( 2019-05-03 02:39:24 -0500 )edit

What you can do, is to use the subsystem retrieval functions, they are in the API manual, either Chapter 8 or 9. They would allow you to get the data of different elements, e.g., buses, machines, plant buses, etc.. You could then make a XLSX file with the excelPy module shipped with PSSE, and then print those data into it.

Note that, there are a lot of functions, and some values of the elements are in complex form that may need further separation.

Also note, that, for PSSE 32, some functions for the induction machines are actually not implemented and they would just return None. You would need to work around them by using other functions.

Then, you could build a small GUI with wxPython, which is what I am doing.

By the way, the data retrieval functions can get a lot more info than what PSSE shows. For example, they can get all the power flows (P and Q) on all branches. I find this very useful since I could include them in the branch worksheet.

more

( 2019-05-03 02:38:00 -0500 )edit