0

PSSe Results to Excel: Results to different Column

Hi All

I have written a script that automates 25 of psse cases for load flow analysis, which then exports my results into an excel sheet. This is done via a standard loop i.e. i =1 to 25. However when I run the script: the circuit MW flow vector from my previous case (i=1) is overwritten by the second case (i=2) as it in inputting it into the same EXCEL column within my script. Is there a way to export each case (i=1 to 25) MW flow into the next available column? I could use the “a”, “b” function:

x1.set_range(2,”a”,zip(*MWflowCase1);

x1.set_range(2,”b”,zip(*MWflowCase 2);

...... ......

However this is tedious! Ideally I want to link it to my loop of i=1 to 25; so that it can be i=1 for case 1 for column A, i=2 for Case 2 for column B, i=3 for case 3 for column C etc. Thus it would look like:

                   Column A        Column B         Column C           Column D
      Circuit    Case 1 (i=1)      Case 2 (i=2)     Case 3 (i=3)    Case 4 (i=4)
          1           100                200            300               400
          2          250                 300            100               700
          3           50                 100             75               25

Can anyone help or give guidance?

Thanks in Advance

PSSE_ABCD's avatar
11
PSSE_ABCD
asked 2018-03-08 09:52:33 -0500, updated 2018-03-08 09:53:16 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

It seems like you are using excelpy. You can use column number instead of column letter so loop variable i can be used directly. I.e.

x1.set_range(2,i+1,zip(*MWflowCase)

The line circuit number is written in the first column in your example. First column is number 1 so first case should be written in the second column. Hence, use i+1 in the code above.

perolofl's avatar
3.8k
perolofl
answered 2018-03-09 00:16:24 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

a CSV file solution:

In python, create a list of lists (a 2D array!) where each row contains data output from each case, and it is appended to the 2D array. Once the 25 cases are processed, save the transpose of the 2D array as a CSV file. Open Excel and load the CSV file. done.

jconto's avatar
2.9k
jconto
answered 2018-03-08 20:45:27 -0500
edit flag offensive 0 remove flag delete link

Comments

Hi Thanks for the words of wisdom, any idea on how the code is suppose to look like? I have never used 2D arrays, so I have no idea where to start. Thanks again.

PSSE_ABCD's avatar PSSE_ABCD (2018-03-08 21:54:01 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer