First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
Many psspy
functions take an enormous number of arguments. In most cases I am using the defaults except for one or two arguments that I actually wish to specify. How can I make my code easier to read by calling the functions with only the arguments I want.
In particular, I am looking for the methodology to take the arguments I want to specify from the Python PSSE API document (normally listed under options, intgar, etc.) for a particular function and only passing them to the function in my code.
2 | No.2 Revision |
Many psspy
functions take an enormous number of arguments. In most cases I am using the defaults except for one or two arguments that I actually wish to specify. How can I make my code easier to read by calling the functions with only the arguments I want.
In particular, I am looking for the methodology to take the arguments I want to specify from the Python PSSE API document (normally listed under options, intgar, OPTIONS, INTGAR, etc.) for a particular function and only passing them to the function in my code.
Here is an example piece of API documentation:
1.61 FNSL Use this API to apply the Newton-Raphson power flow calculation (activity FNSL).
...
Python Syntax:
ierr = fnsl(options)
...
where:
Integer OPTIONS(8) Is an array of eight elements specifying solution options (input).
The values are as follows:OPTIONS(1) tap adjustment flag (use tap adjustment option setting by default).
OPTIONS(1) = 0 disable.
OPTIONS(1) = 1 enable stepping adjustment.
OPTIONS(1) = 2 enable direct adjustment.
OPTIONS(2) area interchange adjustment flag (use area interchange adjustment option setting by default).
OPTIONS(2) = 0 disable.
OPTIONS(2) = 1 enable using tie line flows only in calculating area interchange.
etc...
How would I call this function with only issuing keyword arguments for, say, only OPTIONS(2) and not specifying OPTIONS(1)?