2

Programmatic access to Newton solution results

Is there a way, from within python, to access solution results after performing a newton solution? The things I would like for my programs to access are:

  1. Number of iterations to solve (if solved)
  2. Largest MW/MVAR mismatch
  3. Individual iteration largest change - P,Q,V,A as reported in progress window.

I could theoretically get the number of iterations by repeatedly solving the case while varying the iteration limit and checking psspy.solved() for non-convergence but this is somewhat ridiculous.

The only way that I can think of to get this information is to direct the progress device to a file and then parse the data from the file. Has anyone written code for doing this? Could you share it?

AdamF's avatar
111
AdamF
asked 2012-12-18 08:32:55 -0500, updated 2012-12-18 08:34:02 -0500
edit flag offensive 0 remove flag close merge delete

Comments

1

Check out the following API calls: 1) psspy.iterat() 2) psspy.maxmsm(), psspy.sysmsm 3) Not sure how to accomplish this besides the procedure you suggested.

cajief's avatar cajief (2012-12-18 14:50:57 -0500) edit

@cajief great advice. Those APIs will get you most of what you are after.

JervisW's avatar JervisW (2012-12-18 19:15:37 -0500) edit
add a comment see more comments

1 Answer

1

I'm documenting @cajief's comment here for anyone else coming along.

1.) Number of iterations to solve

psspy.iterat - The number of iterations used in the last solution attempt

num_iterations = psspy.iterat()

2.) Largest MVAR/MW mismatch

psspy.maxmsm - Complex bus mismatch at the bus with largest MVA mismatch
psspy.sysmsm - Return the total system MVA mismatch

ierr, bus, mismatch = psspy.maxmsm()
print mismatch.real, mismatch.imag   # MW, MVAR

mva = psspy.sysmsm()

3.) Individual iteration largest change - P,Q,V,A as reported in progress window

No known API

@AdamF you have the right approach here. Redirect and parse the output if you need that information. I haven't seen an API to do this. If you write some code that does it, I'd love to see it in action!

JervisW's avatar
1.3k
JervisW
answered 2012-12-18 19:32:48 -0500, updated 2012-12-18 19:34:38 -0500
edit flag offensive 0 remove flag delete link

Comments

Now I do remember seeing those APIs at one point, thanks for the reminder:) I'm guessing that the solution results for each iteration would probably not be too hard to parse as they are consistently organized in the progress output.

AdamF's avatar AdamF (2012-12-19 15:52:52 -0500) edit

I'd love to be able to use this info in a solution program so perhaps I will encapsulate the redirect, solve, and parse in a python module, or even a class. I'll be happy to post my work if I get to it some day. Thanks for the advice. -Adam

AdamF's avatar AdamF (2012-12-19 15:55:07 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer