0

Is there a Python API to get the GREF value?

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

N.Nikolaev's avatar
1
N.Nikolaev
asked 2021-07-30 09:06:32 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

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.
N.Nikolaev's avatar
1
N.Nikolaev
answered 2021-07-30 11:06:24 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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)
perolofl's avatar
3.8k
perolofl
answered 2021-08-03 15:02:54 -0500
edit flag offensive 0 remove flag delete link

Comments

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

N.Nikolaev's avatar N.Nikolaev (2021-08-04 00:54:09 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer