Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.