Ask Your Question
0

Pass variables through python API functions?

asked 2022-06-09 12:13:48 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2022-06-09 15:38:04 -0500

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.?

edit flag offensive delete link more

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 ( 2022-06-10 05:59:40 -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: 2022-06-09 12:13:48 -0500

Seen: 169 times

Last updated: Jun 09 '22