Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Stop power flow calculations and recover solution if model blows up

Is it possible to create an Automation File 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!

Stop power flow calculations and recover solution if model blows up

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!

Stop power flow calculations and recover solution if model blows up

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.

Stop power flow calculations and recover solution if model blows up

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:

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"

Stop power flow calculations and recover solution if model blows up

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:result (thanks for 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"

Stop power flow calculations and recover solution if model blows up

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 for 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"