Ask Your Question

Accessing Model index values (e.g. VAR num's) from Python

asked 2012-11-19 14:50:23 -0600

OliviaLeitermann gravatar image

updated 2012-11-20 07:58:15 -0600

Hello All,

I would like to access the model index numbers (i.e. which VARs, CONs, ICONs, STATEs) for a particular model from Python, but I can't find an API which does that. I know I can use DOCU to get a human-readable report, but it seems silly to parse that report in software to figure out the right VARs for my model. Is there a better way, where PSSE will feed the indices to Python directy as an API output?

Thank you for your help!

Update: Thanks, the list of commands to fetch model indices (mdlind, dc2auxmind, etc.) was almost what I was looking for. Unfortunately, the model I want to query is an auxiliary signal model not associated with any equipment (a controller at "bus 0"), so doesn't seem to be accessible through any of the equipment-specific commands. I did a little more hunting through the API manual, but I fear I may be out of luck on this one, at least in V32. Additional suggestions are welcome, though!

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2014-07-23 02:43:03 -0600

Javier gravatar image

updated 2014-07-23 02:45:21 -0600


I can not help you. I have exactly the same problem. To access to the model index values of common-type models I use the list given in the anwer given by JervisW. But I am not able to find a similar API to 'subroutine-type' models (bus 0).

The only options that I have found are (1) find the position manually or (2) use a load model with P=Q=0 instead of a subroutine-type model.

Best, Javier

edit flag offensive delete link more

answered 2012-11-19 16:44:56 -0600

JervisW gravatar image

Here's some example code for getting the CON index for a plant-related model:

ierr, con_index = psspy.mdlind(101, '1 ', 'GOV', 'CON')
ierr, con_num = psspy.mdlind(101, '1 ', 'GOV', 'NCON')
max_con_index = con_index + con_num

# now get those values from the dynamic data storage arrays
 1,              # length of ATYPE array
 [1],            # Get CONs (this is the ATYPE array)
 [con_index],    # start at this index
 [max_con_index],# end at this index

This will print the result to a report window:



     1:  6.500          2: 0.6000E-01      3: 0.2000          4: 0.5000E-01
     5:  4.000          6:  0.000          7:  1.800          8:  1.750
     9: 0.6000         10: 0.8000         11: 0.3000         12: 0.1500
    13: 0.9000E-01     14: 0.3800         15:  6.500


You'll need to parse the resultant output, which is painful and what you were trying to avoid I know. But the result looks a little more regular than the docu output which is all over the place.

Here are a list of the functions to get those indices:

dc2auxmind - auxiliary signal model associated with 2-terminal dc line.
dc2mind    - 2-terminal dc line model
dcnauxmind - auxiliary signal model
fcdauxmind - auxiliary signal model associated with FACTS device 
fcdmind    - FACTS device model 
lmodind    - load related model
mdlind     - plant related model
rmodind    - branch relay model 
slmodind   - subsystem load related model
swsmind    - switched shunt model 
vscauxmind - auxiliary signal model associated with VSC dc line
vscmind    - VSC dc line
windmind   - wind model

Does this get you closer to what you wanted?

edit flag offensive delete link more

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


Asked: 2012-11-19 14:50:23 -0600

Seen: 3,329 times

Last updated: Jul 23 '14