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

Ask Your Question
0

PSAS to idev converter using python?

asked Sep 25 '0

Type1_bus gravatar image

I'm wondering if perhaps there's an easy way to convert PSAS contingency files to regular idv response. I would like to do this since sometimes I get an error which states that PSSE does not recognize the PSAS command I provide.

1 answer

Sort by » oldest newest most voted
0

answered Sep 26 '0

jconto gravatar image

PSAS files can be converted to *.idv using the python API "psas". Let's translate to idv the following "dxy.psa":

RECOVER FROM savnw.SNP AND SAVNW_cnv.SAV NORETURN
CONVERT MW TO 100 0 MVAR TO 0 100
INITIALIZE OUTPUT dxy.OUT
RUN TO 1 SECONDS PRINT 0 PLOT 1
APPLY FAULT AT BUS 154
RUN FOR 9 CYCLES PRINT 0 PLOT 1
CLEAR FAULT
TRIP LINE FROM BUS 153 TO BUS 154 CIRCUIT 1
RUN TO 5 SECONDS PRINT 0 PLOT 1
END

Now using the following python code "psa2idv.py":

#psa2idv.py - 4 PSSe GUI
'''
convert *.psa to *.idv
Open PSSe and
to convert dxy.psa to dxy.idv: run psa2idv.py
to convert any other x.psa to x.idv: run psa2idv.py with argument x
'''
psas = 'dxy'
if len(sys.argv)>1 and sys.argv[1]:
   psas = sys.argv[1]
infile  = '%s.psa'%psas
outfile = '%s.idv'%psas
ierr, respfile = psspy.psas(infile, outfile)
print ('PSAS converted to ',respfile)

Open PSSe GUI, and run the python code. An *.idv would be created, representing the translation of the *.psa file. Warning: All data files referred within the *.psa file should be accessible to avoid runtime errors.

You can used the macro recorder to get a 'translation' into python by running the *.psa file with 'recording' on.

link

Comments

Thanks jconto!

Type1_bus gravatar imageType1_bus (Sep 29 '0)

Is it possible to convert python contingency files to PSAS?

Type1_bus gravatar imageType1_bus (Jun 6 '3)

No, I have not found a API function to do that, but it can be done using python. You would build code that reads the python contingency and write a text file paraphrasing the PSAS commands. I prefer to keep the contingency in python format.

jconto gravatar imagejconto (Jun 7 '3)

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: Sep 25 '0

Seen: 792 times

Last updated: Sep 26 '20