First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
One approach is to use the set of model "IND" functions that retrieve the starting indexes for various STATEs,VARs, and so on. The exact function used depends on the model type: mdlind
is used for generator plant models, lmodind
is used for load models, etc. Generally the functions are defined in Section 7 of the API, but you may have to hunt a bit for the specific model type.
For example, assume the real output power of a generator at bus 10000 is stored in VAR(L+15) of the generator model. A VAR channel can be added with the code below. ival
represents the starting VAR index of that specific model. No modifications to the code below are required for different dyr files :
ierr, ival = psspy.mdlind(10000,"""1""", 'GEN','VAR')
psspy.var_channel([-1,ival + 15 ] ,"""POUT""")