Ask Your Question
1

Perform scmu sing en masse with output

asked 2013-03-19 02:08:02 -0500

Largeman gravatar image

I am trying to perform a simple 3 phase fault on multiple busses without having to copy the results out of the reports, so I'm learning python. My problem is that it will produce a nice empty text file. The report in PSSE is all results, but the text file is useless. I know the 2 in "[2,0]" towards the end is for appending, which is what I would prefer, but just a bunch of files would do. My instinct is that there is an issue with PSSE more than the python script, but as I'm new, I want to check. Any and all help much appreciated. My code below:

import os,sys

PSSE_LOCATION = r"C:\Program Files (x86)\PTI\PSSE32\PSSBIN"
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] +';' + PSSE_LOCATION

import psspy

CASE = r"C:\Users\user\Desktop\PSSE\Model.sav"

_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()

if __name__ == '__main__':
    psspy.psseinit(2000)
    psspy.case(CASE)
    psspy.scmu(1,[_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],_s)
    psspy.scmu(2,[7,100,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],"")
    psspy.scmu(3,[_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],_s)
    #psspy.report_output(2,'C:\Users\user\Desktop\PSSE\Fault_Output\Bus_100.txt',[2,0])
    psspy.report(2,'C:\Users\user\Desktop\PSSE\Fault_Output\Bus_100.txt',[2,0])
    psspy.close_report()
edit retag flag offensive close merge delete

Comments

Hi are you using PSSE 33? I haven't got that "report" function in PSSE 32. Anyway, try putting the report function _before_ the scmu functions. Does that work?

JervisW gravatar imageJervisW ( 2013-03-19 05:54:17 -0500 )edit

I'm still back on version 32.0.5, it's what the client uses, so it's what we use. Your suggestion has worked. Thank you for your help. Now I just need to dig around and learn about python arrays and for loops. Cheers.

Largeman gravatar imageLargeman ( 2013-03-19 17:33:28 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-03-19 17:44:50 -0500

JervisW gravatar image

Here's the answer for anyone else coming along:

psspy.psseinit(2000)
psspy.case(CASE)

# begin reporting before calling scmu
psspy.report(2, r'C:\Users\user\Desktop\PSSE\Fault_Output\Bus_100.txt',[2,0])

psspy.scmu(1,[_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],_s)
psspy.scmu(2,[7,100,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],"")
psspy.scmu(3,[_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f],_s)

psspy.close_report()

The trick is to start the reporting device before the calls to scmu. PSSE doesn't keep a copy of it's scmu output. So if you report afterwards, all the output is already gone - hence the empty report file.

edit flag offensive delete link more

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

Stats

Asked: 2013-03-19 02:08:02 -0500

Seen: 601 times

Last updated: Mar 19 '13