Ask Your Question
0

Is there a way to assign states to output channels without knowing the state index/number?

asked 2017-08-04 06:55:37 -0500

CamillusRex gravatar image

Greetings,

The STATE_CHANNEL command lets you assign states (e.g. motor slip) to output channels for dynamic simulation. However, it requires as its input the "index" of the state you want to see -- basically, as you add models to the system, their states are appended to a single big list, and PSSe wants to know where in that list the requested state is.

Obviously, the index of a given state may change as you add or remove other models. So I was wondering, is there a way to identify a state by meaningful parameters, e.g. "give me the Nth state of model X at bus Y"? I hate having to slog through DOCU output to note the state numbers every time I change something about my modelling setup.

Many thanks in advance!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-08-04 13:51:17 -0500

cajief gravatar image

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""")
edit flag offensive delete link more

Comments

:D Thank you so much! That's exactly what I was looking for and I feel kind of stupid for not discovering it myself now.

CamillusRex gravatar imageCamillusRex ( 2017-08-05 06:02:48 -0500 )edit

old answer, i know, but figured I'd ask anyway. How do you use the fortran version of MDLIND() within User-Model code?

wassup_doc gravatar imagewassup_doc ( 2019-06-24 11:02:10 -0500 )edit

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

2 followers

Stats

Asked: 2017-08-04 06:55:37 -0500

Seen: 1,703 times

Last updated: Aug 04 '17