First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

Is there a Python API to get the GREF value?

asked Jul 30 '1

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

2 answers

Sort by » oldest newest most voted
0

answered Aug 3 '1

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)
link

Comments

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

N.Nikolaev gravatar imageN.Nikolaev (Aug 4 '1)
0

answered Jul 30 '1

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.
link

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

1 follower

Stats

Asked: Jul 30 '1

Seen: 471 times

Last updated: Aug 03 '21