Ask Your Question

How to get the list of Machine inertia from PSSE?

asked 2015-12-05 04:58:53 -0500

Enigma gravatar image

updated 2015-12-05 05:00:15 -0500

How to get the list of Machine inertia from PSSE?

I have tried

print psspy.aindmacreal(0,4,'H') and print psspy.aindmacreal(string='H')

in IEEE 39 system. the response of them is

(2, [None])

(0, [[]])

I want to get a list of every Machine inertia in the system like [42,4,4,4,4,4,4,4,4,4]

how should I code in my python ?


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-01-04 06:51:08 -0500

danzg gravatar image

Hi, instead reading the .dyr file you can retrieve the required values from internal dynamic data arrays. General idea is presented below (not the most elegant code but it serves its purpose). Hope this would help.

import psspy

#         (a basic example shown here)
Sid=-1   # All machines
Flag=1   # Only in-service machines at in-service plants
ierr, Nmach=psspy.amachcount(Sid, Flag)           # get no of machines in the subsystem
ierr, iMbus = psspy.amachint(Sid, Flag, 'NUMBER') # get machine bus numbers
ierr, cMids = psspy.amachchar(Sid, Flag, 'ID')    # get machine IDs

fout=open('D:\Examples\Inertia.txt','w') # open a text file at desired location
savFn, snpFn = psspy.sfiles()
fout.write('MODEL: Load flow:     %s\n       Dynamic model: %s\n\n' % (savFn,snpFn))
fout.write(' BUS    NAME                GEN  MODEL    H (sec)\n--------------------------------------------------------\n')
for iM in range(0,Nmach):  # iterate through the list of machines
    iH=0  # resetting the intertia value index   
    ierr, icon0 = psspy.mdlind(ibus, genId, 'GEN', 'CON') # get initial CON address (index)
    ierr, genMdl = psspy.mdlnam(ibus, genId, 'GEN') # get generator model name
    genMdl=genMdl.strip()                           # remove blanks
#   Find absolute index iH in CONS array using relative CON index in the generator model and
#   previously found starting CON index of the generator model
#  (here shown only for the three most common models)
    if genMdl=='GENCLS': iH=icon0                           
    if (genMdl=='GENSAL')|(genMdl=='GENSAE'): iH=icon0+3    
    if (genMdl=='GENROU')|(genMdl=='GENROE'): iH=icon0+4
#   Get value from CONS array corresponding to the generator inertia
    ierr,H=psspy.dsrval('CON', iH)
#   Write output to the file    
    fout.write ('%6d  %12s   %2s  %6s  %6.3f\n' % (ibus,busN,genId,genMdl,H))

edit flag offensive delete link more

answered 2015-12-07 00:57:21 -0500

SqFKYo gravatar image

Based on what you get as answers, I'd assume that:

  1. You haven't set a bus subsystem, that's why you get error '2' from your first print.
  2. The machines are modelled as regular machines instead of induction machines, as when you try to list all of them, you get none.

Solution: I'd assume that the inertia constants are inside the .dyr-file instead of the .sav case. Since amachreal doesn't allow intertia as the search string, I'm not sure if you can access that data directly from PSS/E, but you could iterate through the .dyr text file to find the inertias?

edit flag offensive delete link more


I second this. Inertia for machines is stored in the DYR file. I'm not aware of any method for retrieving this except for parsing the file.

Eli Pack gravatar imageEli Pack ( 2015-12-15 22:03:21 -0500 )edit

I have load the dyr files by psspy.dyre_new(dyrefile=pp+".dyr") but I could not read inertia data either

Enigma gravatar imageEnigma ( 2015-12-18 02:04:19 -0500 )edit

I mean that you should read the .dyr file with something like `with open('dyrefile.dyr')` and then iterate over it using standard Python commands.

SqFKYo gravatar imageSqFKYo ( 2015-12-18 02:09:20 -0500 )edit

Did PSSE have such function?

Enigma gravatar imageEnigma ( 2015-12-18 02:25:12 -0500 )edit

No, it's normal Python command. Check e.g. for more details.

SqFKYo gravatar imageSqFKYo ( 2015-12-18 02:32:23 -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


Asked: 2015-12-05 04:58:53 -0500

Seen: 2,425 times

Last updated: Jan 04 '16