What I have done for a similar situation is modify my FORTRAN code to output something that is easy to parse from the output of the DOCU command.
Here is an example grabbed from one of my user models:
SUBROUTINE MYPROGRAM( II, JJ, KK, LL )
INCLUDE 'COMON4.INS'
IF (MODE .EQ. 5) THEN
CALL DOCUHD(*9999)
WRITE(IPRT, 1114) 'CON', jj
WRITE(IPRT, 1114) 'ICON', ii
WRITE(IPRT, 1114) 'VAR', ll
WRITE(IPRT, 1114) 'STATE', kk
1114 FORMAT(T5,'MY PROGRAMS starting ',A5, ' is ',I7)
ENDIF
Then I would just use regex to look for "MY PROGRAMS starting VAR is" in the DOCU output, and grab the VAR from there. It's not pretty, but it works.
Hi Adam I saw some ways to get info on built in models: https://psspy.org/psse-help-forum/question/656/accessing-model-index-values-eg-var-nums-from-python/, but not for user-written ones. What is your method for accessing through the user interface right now?
Currently, we place the user models at the beginning of the dyre file in a certain order so that we can just count the var locations and know where they are stored. This practice dates back a long ways and I'm looking for a more flexible way to find these var locations so that we don't have to ...
... worry about the dyre order anymore. I just thought of one way to do it: we could have a python script look through the vars and find unique sets of consecutive var values that would correspond to certain models. These models don't changes very often so this might actually be a workable fix.
Are you able to post some pseudo-code showing how you might go about it?