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

Ask Your Question
0

Pass variables through python API functions?

asked Jun 9 '2

tolemanator gravatar image

I'm trying to do something like: ierr = psspy.solutionparameters4([100, FDNSiter, 40, 100, 10],[1.6, 1.6, 1.0, 0.0001, FDNSaccn, FDNStoln, 1.0, 0.00001, FDNSbln, 0.7, 0.0001, 0.005, 1.0, 0.05, 0.99, 0.99, 0.1, 0.00001, 100.0])

It seems to be rejecting the variables I pass through like "FDNS_iter" even though I force the variable to be an integer type. It consistently throw an error of "Type Error: must be a real number, not a str" so somehow defining the variable as an integer isn't be recognized so I'm wondering if the PSSE API isn't able to pass variables through functions period.

1 answer

Sort by » oldest newest most voted
0

answered Jun 9 '2

jconto gravatar image

"Type Error: must be a real number, not a str" The array of reals is:

[1.6, 1.6, 1.0, 0.0001, FDNSaccn, FDNStoln, 1.0, 0.00001, FDNSbln, 0.7, 0.0001, 0.005, 1.0, 0.05, 0.99, 0.99, 0.1, 0.00001, 100.0]

So make sure all variables are of type float, like FDNSaccn = float(FDNSaccn)

Just to clarify, are you working on the default environment or in jupyter, spyder, conda, etc.?

link

Comments

I was doing that yesterday and for some reason it wasn't working then, but it is now! and yes I'm in pycharm. Thank you!

tolemanator gravatar imagetolemanator (Jun 10 '2)

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: Jun 9 '2

Seen: 229 times

Last updated: Jun 09 '22