Ask Your Question
0

Stop power flow calculations and recover solution if model blows up

asked 2015-09-13 07:03:34 -0500

Transmission Impossible gravatar image

updated 2015-09-13 09:44:29 -0500

Is it possible to create an Automation File (in Python) that tries to run a normal FNSL power flow, but stops, and retrieve original case if the mismatch becomes too large?

The pseudo code of what I want is:

run fnsl
if absolute mismatch > 1   # or some other appropriate value
    abort fnsl
    print error message: "The power flow blew up". 
    recover previous power flow results
stop

At the moment, I have to load the .sav case every time my model blows up (which is often). It's cumbersome, and time demanding. I'm doing a lot of manual changes and don't need to store the results, so I don't want to create new .sav-files for every change and load flow I run.

I appreciate any help!

EDIT

One of the things I do a lot of is trying to disconnect different combinations of lines.

  1. Run power flow
  2. Disconnect line 1 - Run power flow, OK?
  3. Disconnect line 2 - Run power flow, OK?
  4. Disconnect line 3 - Run power flow. Not OK!
  5. Connect line 1, disconnect line 6. Run power flow, OK?
  6. Connect line 3, disconnect line 7. Run power flow, Not OK!
  7. Connect line 2 and 6. Run power flow, OK?
  8. Turn of generator. Run power flow, OK?
  9. ... and so on ...

What I want is to make changes in the GUI (in PSS/E), run an automation file that executes fnsl and aborts and restore model if it doesn't converge. I'd prefer not to save the model every time I make a minor adjustment.

Final result (thanks to jconto):

ierr = psspy.save('temp.sav')
if ierr > 0:
    print "Couldn't save temp-file"

ierr = psspy.fnsl()
if ierr == 3:
    print "Nodes without swing bus. API: tree() may help"
elif ierr != 0:
    print "Power flow failed."

ierr = psspy.solved()
if ierr > 0:
    psspy.case('temp.sav')
else:
    print "Power flow reached convergence"
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-09-13 08:45:14 -0500

jconto gravatar image

updated 2015-09-13 08:57:11 -0500

After a manual change, always save the case to "work.sav" before executing fnsl, test the outcome of fnsl using "solved()":

psspy.save('work.sav')
ieer = psspy.solved()
if ieer>0: pssy.case('work.sav')

Once done with your manual changes, saved final case in memory to a different name.

edit flag offensive delete link more

Comments

Thanks for answering jconto! Awesome solution =) I updated my question with the exact code I ended up using, for future reference.

Transmission Impossible gravatar imageTransmission Impossible ( 2015-09-13 09:41:44 -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

Stats

Asked: 2015-09-13 07:03:34 -0500

Seen: 3,233 times

Last updated: Sep 13 '15