Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This should get you started. The following code will give you a string variable "temp" with the solution text. Now you just have to step through it and count the tap changes for each transformer.

import redirect, sys, StringIO

# Redirect the output to a string, solve, then reset output
redirect.psse2py()
sys.stdout = temp = StringIO.StringIO()
psspy.fnsl([1,0,0,1,1,0,99,0])
redirect.py2psse()

# Convert temp to a normal string
temp = "" + temp.getvalue()

# Insert code to analyse the "temp" string and count tap changes
# (This will differ depending on your PSSE version)
print temp

This should get you started. The following code will give you a string variable "temp" with the solution text. Now you just have to step through it and count the tap changes for how many times each transformer.shunt changes.

import redirect, sys, StringIO

# Redirect the output to a string, solve, then reset output
redirect.psse2py()
sys.stdout = temp = StringIO.StringIO()
psspy.fnsl([1,0,0,1,1,0,99,0])
redirect.py2psse()

# Convert temp to a normal string
temp = "" + temp.getvalue()

# Insert code to analyse the "temp" string and count tap shunt changes
# (This will differ depending on your PSSE version)
print temp