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

Ask Your Question
2

How to get the list of Machine inertia from PSSE?

asked Dec 5 '15

Enigma gravatar image

updated Dec 5 '15

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 ?

Thanks

2 answers

Sort by » oldest newest most voted
1

answered Jan 4 '16

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

# ------- SUBSYSTEM DEFINITION AND MACHINE SELECTION CRITERIA ---------
#         (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
iMbus=iMbus[0]
cMids=cMids[0]

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
    ibus=iMbus[iM]
    genId=cMids[iM]
    ierr,busN=psspy.notona(ibus)
    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))

print ' *** END OF FINDING MACHINE INERTIAS ***'
fout.close()
link
1

answered Dec 7 '15

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?

link

Comments

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 (Dec 16 '15)

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

Enigma gravatar imageEnigma (Dec 18 '15)
1

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 (Dec 18 '15)

Did PSSE have such function?

Enigma gravatar imageEnigma (Dec 18 '15)
1

No, it's normal Python command. Check e.g. https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files for more details.

SqFKYo gravatar imageSqFKYo (Dec 18 '15)

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: Dec 5 '15

Seen: 4,333 times

Last updated: Jan 04 '16