Create a list with all miscellaneous models

asked 2020-11-10 10:09:20 -0500

perolofl gravatar image

updated 2020-11-17 09:40:02 -0500

There is no API in psspy that returns a list of all miscellaneous models in the dynamic setup. I have therefore written my own API, see the code below:

def get_miscellaneous(minsmax=10000):
    """ Returns lists with MINS-number and model name for all miscellaneous models
    minsmax = Highest MINS-number to be searched
    """
    minslist = []
    namelist = []
    for mins in range(1,minsmax+1):
        ierr, modname = psspy.cctmdlnam_msco(mins)
        if ierr == 0:
            minslist.append(mins)
            namelist.append(modname[:16].strip())
    return minslist,namelist

The function returns two lists; the first contains the used MINS-numbers and the second the name of the models.

minslist,namelist = get_miscellaneous()

returns all used miscellaneous models from MINS number 1 up to 10 000. The highest MINS-number to be searched is defined in an argument to the function. If for example MINS-numbers up to 100 000 are used in the snapshot, use the following call of the function.

minslist,namelist = get_miscellaneous(100000)

The execution of the loop takes longer time if very high MINS-numbers are given in the function call.

edit retag flag offensive close merge delete

Comments

This seems useful, thank you for your contribution. What are the pre-requisites for this to work; do I need to load the save file and dyr file prior to running it?

Tassie Dave gravatar imageTassie Dave ( 2023-10-18 23:42:28 -0500 )edit

Yes, the network and the dyrfile/snaphot must be loaded.

perolofl gravatar imageperolofl ( 2023-10-19 14:30:41 -0500 )edit