Ask Your Question
1

Avoid "call change_var" writting.

asked Jul 4 '14

agastalver gravatar image

updated Jul 7 '14

Every time I use call change_var function. PSS/E writes a message in the output (in my case, a file). I would like to keep the other messages, due it provides information while executing into PSS/E gui.

A solution is to get the position from the machine using mdlind and changing the var array itself. But I would like to know whether there is a better solution using the API.

1 answer

Sort by » oldest newest most voted
1

answered Jul 7 '14

agastalver gravatar image

updated Jul 7 '14

After hours of debugging and testing. I figured out there is no better solution than the described in the question. Also, I've noticed the time performance of using mdlind for getting the machine position in the arrays and change the var array instead of calling change_var is significantly better when developing machine models in fortran.

Here, I write some examples, where:

  • bus_mac is the bus number where the machine is.
  • id_mac is the id of the machine inside the bus.
  • l_mac is the position of the machine in the var array.
  • n_val is the new value to set to the position, for example, l_mac+2 of the var array.

Way 1 - Better performance: only fortran

call mdlind(bus_mac, id_mac, 'GEN', 'VAR', l_mac, ierr)
var(l_mac+2) = n_val

Way 2 - Secure and API use: fortran

call mdlind(bus_mac, id_mac, 'GEN', 'VAR', l_mac, ierr)
call change_var(l_mac+2, n_val, ierr)

Way 2 - Secure and API use: python

ierr, l_val= psspy.mdlind(bus_mac, id_mac, 'GEN', 'VAR')
ierr = psspy.change_var(l_mac+2, n_val)
link

Comments

I use Way 2 - Secure and API use

yunzhi cheng gravatar imageyunzhi cheng (Mar 15 '0)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Jul 4 '14

Seen: 589 times

Last updated: Jul 07 '14