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

Ask Your Question
1

PSSE35 psspy.pssehalt_2()

asked Jan 2 '5

trapezoid gravatar image

updated Jan 12 '5

I have a Python automation tool that has options to print out several different types of reports.

It works well with PSSE34, but in PSSE35, it crashes when the psspy.pssehalt2() function is called and psseinit() is called after. I tried commenting psspy.pssehalt2() out which in some cases is ok, but it appears that calling pssehalt_2() is still necessary because without it, psseinit() crashes routinely and I have trouble initializing simulations.

It seems to me that psspy.pssehalt_2() is bugged.

Does anyone know a workaround for this? PSSE version 35.6, Python 3.7 64-bit. I have the same issue in Python 3.9 64-bit.

Thanks.

EDIT to add code:

This code does not work in PSSE35. It crashes in the second loop.

import sys
sys.path.insert(0,"C:/Program Files/PTI/PSSE35/35.6/PSSPY37")
sys.path.insert(0,"C:/Program Files/PTI/PSSE35/35.6/PSSBIN")
case_file = "IEEE 39 bus.RAW"
dyr_file = "IEEE 39 bus.dyr"
for i in range(2):
    import psse35
    import psspy

    psspy.psseinit(150_000)
    ierr = psspy.read(0, case_file)
    ierr = psspy.dyre_new([1, 1, 1, 1], dyr_file, "", "", "")

    psspy.pssehalt_2()

3 answers

Sort by » oldest newest most voted
1

answered Jan 3 '5

jconto gravatar image

updated Jan 13 '5

From the API manual: "1.221. PSSEHALT_2 Use this API to end the operation of PSSE, closes all associated files and returns to the calling application"

After pssehalt is called, there is no PSSe in memory. So for the next run, you need to star over (import PSSe35 -> import psspy -> import psseinit)

Can you can post some code to see the pssehalt behavior?

The following code completed the 2 loops, having halt2 run once outside the loop:

import sys
import psse35
import psspy
psspy.psseinit()

sys.path.insert(1,r"C:/Program Files/PTI/PSSE35/35.6/PSSPY39")
#sys.path.insert(0,"C:/Program Files/PTI/PSSE35/35.6/PSSBIN")
case_file = "IEEE9_v35.RAW"
dyr_file = "IEEE9.dyr"

for i in range(2):
    ierr = psspy.read(0, case_file)
    ierr = psspy.dyre_new([1, 1, 1, 1], dyr_file, "", "", "")    
    print('loop ',i)
psspy.pssehalt_2()
link

Comments

Added code!

trapezoid gravatar imagetrapezoid (Jan 12 '5)
0

answered Jan 12 '5

trapezoid gravatar image

Sorry for the delay. I had to narrow the code down.

This code does not work in PSSE35. It crashes in the second loop.

import sys
sys.path.insert(0,"C:/Program Files/PTI/PSSE35/35.6/PSSPY37")
sys.path.insert(0,"C:/Program Files/PTI/PSSE35/35.6/PSSBIN")
case_file = "IEEE 39 bus.RAW"
dyr_file = "IEEE 39 bus.dyr"
for i in range(2):
    import psse35
    import psspy

    psspy.psseinit(150_000)
    ierr = psspy.read(0, case_file)
    ierr = psspy.dyre_new([1, 1, 1, 1], dyr_file, "", "", "")

    psspy.pssehalt_2()
link

Comments

You need to dedent the line psspy.pssehalt2_() to get out from the for-loop to avoid closing the loaded case. Indentation in python code should be reviewed. Also take the import lines and psseinit line out from the for-loop, it's not a good practice to import libraries each iteration. Hope this help

ssellsch gravatar imagessellsch (Jan 14 '5)
0

answered Jan 13 '5

perolofl gravatar image

I can confirm that pssehalt_2 works as intended in rev 33. In rev 35 the script is aborted in the second loop after psseinit. PSSE is started again but the rest of the commands in the loop are not executed! Is that what you mean with "crash"? It seems to be a bug in rev 35.

The workaround I propose is not to stop PSSE at the end of each loop. Start PSSE before the loop and use the same PSSE instance for all loops. See @jconto's answer for more details.

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

1 follower

Stats

Asked: Jan 2 '5

Seen: 233 times

Last updated: Jan 13