Create a list with all miscellaneous models
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.
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?
Yes, the network and the dyrfile/snaphot must be loaded.