First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
1

Perform scmu sing en masse with output

asked Mar 19 '13

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()

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 (Mar 19 '13)

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 (Mar 19 '13)

1 answer

Sort by » oldest newest most voted
0

answered Mar 19 '13

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.

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Mar 19 '13

Seen: 619 times

Last updated: Mar 19 '13