First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
2

Programmatic access to Newton solution results

asked Dec 18 '12

AdamF gravatar image

updated Dec 18 '12

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?

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 (Dec 18 '12)

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

JervisW gravatar imageJervisW (Dec 19 '12)

1 answer

Sort by » oldest newest most voted
1

answered Dec 19 '12

JervisW gravatar image

updated Dec 19 '12

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!

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 gravatar imageAdamF (Dec 19 '12)

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 (Dec 19 '12)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Dec 18 '12

Seen: 885 times

Last updated: Dec 18 '12