Ask Your Question
2

Programmatic access to Newton solution results

asked 2012-12-18 08:32:55 -0500

AdamF gravatar image

updated 2012-12-18 08:34:02 -0500

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?

edit retag flag offensive 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 gravatar imagecajief ( 2012-12-18 14:50:57 -0500 )edit

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

JervisW gravatar imageJervisW ( 2012-12-18 19:15:37 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-12-18 19:32:48 -0500

JervisW gravatar image

updated 2012-12-18 19:34:38 -0500

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!

edit flag offensive delete link more

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 gravatar imageAdamF ( 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 gravatar imageAdamF ( 2012-12-19 15:55:07 -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: 2012-12-18 08:32:55 -0500

Seen: 864 times

Last updated: Dec 18 '12