Ask Your Question
0

PSAS to idev converter using python?

asked 2020-09-25 11:31:47 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-09-26 14:35:26 -0500

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.

edit flag offensive delete link more

Comments

Thanks jconto!

Type1_bus gravatar imageType1_bus ( 2020-09-29 09:40:42 -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

1 follower

Stats

Asked: 2020-09-25 11:31:47 -0500

Seen: 54 times

Last updated: Sep 26