Ask Your Question

dyntools.CHNF() causes python to crash. Help!

asked 2020-01-06 01:10:44 -0500

bikiran1991 gravatar image

I am running a python script to do dynamic contingency analysis. The command dyntools.CHNF() (to get the output channel values) causes python to crash when there are some NaN values. There is no error message, python just crashes.

Has anyone else encountered this behavior and found any ways to either skip over this issue or fix it? Ideally, i want to skip to the next simulation when this happens.

I couldnt find the command 'dyntools.CHNF()' in the PSSE API module as well. I was looking for ways to skip getting the output data if there were NaN values in the output channels.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2020-01-24 13:53:27 -0500

kewasiuk gravatar image

updated 2020-01-24 13:57:01 -0500

Use the following line:


Immediately after psspy.psseinit(150000).

This is assuming you have psspy imported and PSSE initialized. I ran into the exact same issues. FYI, you can import and use dyntools without psspy, which would also help. If you aren't doing this, then I'll need some more info to help.

Hope this helps; sorry for the late reply.

edit flag offensive delete link more


I am using PSSE v33. It seems this command (psspy.set_NaN_python()) is not part of this psspy package. Also, i am not sure why importing dyntools without psspy would help. In any case, i am importing both when running my script. I need psspy to run the simulation and dyntools to get the output.

bikiran1991 gravatar imagebikiran1991 ( 2020-01-29 21:43:32 -0500 )edit

Have you tried it yet? The command is not in the API manual, but it works for me (v 33.10). Importing dyntools without psspy had helped me when I ran into the same issue in the past; you only alluded to the fact that the issue arose with dyntools. For me, the issue actually came from psspy and NaN

kewasiuk gravatar imagekewasiuk ( 2020-02-05 12:49:08 -0500 )edit

Yeah i tried psspy.set_NaN_python() and its not part of the module. Maybe because I have an older version (v33.3). I need to run psspy for the simulations and then i use dyntools only for getting the outputs. And if i dont use the dyntools.CHNF command, there is no crash.

bikiran1991 gravatar imagebikiran1991 ( 2020-02-06 20:54:12 -0500 )edit

answered 2020-01-07 00:16:29 -0500

perolofl gravatar image

Test to use try statement in order to avoid Python crash.

For documentation:

import dyntools
edit flag offensive delete link more


tried that already. since python crashes, this doesn't work. checked the dyntools help. There is nothing helpful in the options for dyntools.CHNF. To fix this crash, i need to know if the output channels contain any NaN characters, before running the command: dyntools.CHNF().

bikiran1991 gravatar imagebikiran1991 ( 2020-01-07 03:21:13 -0500 )edit

I assume PSS/E will crash if you open the corrupt out-file inside PSS/E.

perolofl gravatar imageperolofl ( 2020-01-08 01:32:58 -0500 )edit

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

1 follower


Asked: 2020-01-06 01:10:44 -0500

Seen: 153 times

Last updated: Jan 24