Ask Your Question
0

Is there a Python API to get the GREF value?

asked 2021-07-30 09:06:32 -0600

N.Nikolaev gravatar image

Hello, community!

I am building some automation Python script and I need to change the MW output of the machine during time-domain simulation. I know I need to use the psspy.change_gref() API to do that. But the problem is that I do not know what is the initial GREF value so I could scale it properly in order to get the desired MW output. The initial GREF value depends on various governor parameters, such as the droop R value. Hence, I am searching for an API that can get me the initial GREF.

I found that I can read it as a VAR variable, but every governor model has different vars, so this is not practical at all.

Does anyone know an API that can readily provide what is the current GREF value?

Thanks! Nikolay

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2021-08-03 15:02:54 -0600

perolofl gravatar image

The approach using a GREF channel is correct, but it can be done simpler. There is no need for RUN command since the channel is initialised at start of simulation. Use API chnval to get the channel value directly, i.e. the GREF value. There is no need to read it from the output file.

GREF_chan_number = 10
ierr, GREF = psspy,chnval(GREF_chan_number)
edit flag offensive delete link more

Comments

Thanks, perolofi! This is definetely a much cleaner solution :)

N.Nikolaev gravatar imageN.Nikolaev ( 2021-08-04 00:54:09 -0600 )edit
0

answered 2021-07-30 11:06:24 -0600

N.Nikolaev gravatar image

Okay, I found a workaround myself:

GREF_chan_number = 10
runUntill = 0.0
psspy.run(0, runUntill, 0, 1, 1)
ChfData = dyntools.CHNF(fileChan) 
short_title, chanid, chandata = ChfData.get_data()
GREF = chandata[GREF_chan_number ][-1]

What this code does is the following. You must have defined a channel that records the GREF variable in your output file and you must have initialized the dynamic simulation before running my code. In the code above we say that the GREF channel is number 10 (will be different for your situation). Then the simulation is run until 0.0 seconds. This will record a few integration iterations in the out file. Then you load the channel out file and just read the last value from the GREF channel.

This is a good solution because:

  1. It works for every possible governor model
  2. It does not mess your simulation because you only run the simulation until the 0.0 seconds. Have you noticed when working with the PSS/E GUI that when you initialize the dynamic simulation, the current simulation time is slightly negative? This is why running up until 0.0 seconds actually works.
edit flag offensive delete link more

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

1 follower

Stats

Asked: 2021-07-30 09:06:32 -0600

Seen: 458 times

Last updated: Aug 03 '21