Ask Your Question
1

Can't open .sav file

asked 2013-12-06 05:10:47 -0600

LDale gravatar image

updated 2013-12-31 22:18:12 -0600

JervisW gravatar image

I'm just starting with psspy. I want to open a .sav file, modify the P and Q of the load, run a load flow, and read the results. Here's the code:

import os
import sys
import pdb

PSSE_PATH = "C:/Program Files/PTI/PSSE33/PSSBIN"
File_Path = "C:/Users/LD0FA74N/Documents/PSSEScripts"

sys.path.append(PSSE_PATH)
os.environ['PATH'] += PSSE_PATH + ';' 

sys.path.append(File_Path)
os.environ['PATH'] += File_Path + ';' 


import psspy
import pssarrays
import redirect


workingfile = "C:/Users/LD0FA74N/Documents/PSSEScripts/test2diagram.sav"

psspy.psseinit(10000)
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()

redirect.psse2py()

flatstart = 1

busnum = 1401

Pload = 90 # from 10 to 100

Qload = 20 # from -40 to 60

psspy.case(workingfile)

psspy.load_chng_4(busnum,r"""1""",[_i,_i,_i,_i,_i,_i],[ Pload,_f,_f,_f,_f,_f])

psspy.load_chng_4(busnum,r"""1""",[_i,_i,_i,_i,_i,_i],[_f, Qload,_f,_f,_f,_f])

psspy.fnsl([1,0,0,1,1,flatstart,99,0])

psspy.save(workingfile)

voltages = psspy.abusreal(sid=-1, string="PU")
buses = psspy.abusint(sid=-1, string="NUMBER")

print voltages
print buses

I get the following error message:

Invalid file type. C:/Users/LD0FA74N/Documents/PSSEScripts/test2diagram.sav (OpnAppFil/OPNPTI).

I know that PSSE can read .sav files, so I assume there's a problem finding the file, but I've appended the PSSE and the .sav directories to both the system path and the path environmental variables, so I don't know where this could be coming from.

What does redirect.psse2py() do? I've tried with and without this line but the error message is the same. What is the difference between the system path and the environmental path variables? Any help would be much appreciated!

edit retag flag offensive close merge delete

5 answers

Sort by ยป oldest newest most voted
1

answered 2013-12-07 00:12:35 -0600

terrytian gravatar image

this two lines are wrong:

os.environ['PATH'] +=PSSE_PATH + ';'
os.environ['PATH'] += File_Path + ';'

replace that two lines with:

os.environ['PATH'] += ';' + PSSE_PATH
os.environ['PATH'] += ';' + File_Path
edit flag offensive delete link more

Comments

FYI, technically you should use `os.pathsep` (ie, `os.environ['PATH'] += os.pathsep + PSSE_PATH` )

jsexauer gravatar imagejsexauer ( 2014-01-02 09:41:35 -0600 )edit

good point, yours is even better. It account for a non-windows platform.

terrytian gravatar imageterrytian ( 2014-01-02 22:05:08 -0600 )edit
0

answered 2014-11-20 05:25:37 -0600

ZohaibHassan gravatar image

change "/" to "\" in PSSEPATH and FILEPATH

edit flag offensive delete link more
0

answered 2013-12-06 10:37:02 -0600

jconto gravatar image

The following code run OK within PSSe v.33, update paths and var values for your run:

#import os
#import sys
#import pdb          #<- what is this?
#PSSE_PATH = raw"""C:/Program Files/PTI/PSSE33/PSSBIN"""
#sys.path.append(PSSE_PATH)
#os.environ['PATH'] += PSSE_PATH + ';'
#sys.path.append(File_Path)
#os.environ['PATH'] += File_Path + ';'
#import psspy
#import pssarrays
#import redirect
#psspy.psseinit(10000)
#_i=psspy.getdefaultint()
#_f=psspy.getdefaultreal()
#_s=psspy.getdefaultchar()
#redirect.psse2py()
flatstart = 1
File_Path = "C:/Program Files/PTI/PSSE33/EXAMPLE"
workingfile = File_Path +'/'+"savnw.sav"
print workingfile
psspy.case(workingfile)
busnum = 153
Pload = 190 # from 10 to 100
Qload = 90 # from -40 to 60
psspy.load_chng_4(busnum,r"""1""",[_i,_i,_i,_i,_i,_i],[ Pload,_f,_f,_f,_f,_f])
psspy.load_chng_4(busnum,r"""1""",[_i,_i,_i,_i,_i,_i],[_f, Qload,_f,_f,_f,_f])
psspy.fnsl([1,0,0,1,1,flatstart,99,0])
#psspy.save(workingfile)
voltages = psspy.abusreal(sid=-1, string="PU")
buses = psspy.abusint(sid=-1, string="NUMBER")
print voltages
print buses
edit flag offensive delete link more
0

answered 2013-12-06 11:03:45 -0600

yfwing gravatar image

@LDale, I believe that you are running your python code directly from Python (not from PSS/E GUI), probably from IDLE. I have the same problem when running Python code from IDLE. I am not sure the reason for the error. But you can try to run your Python code not from IDLE, but through python.exe.

i.e., In DOS,

C:\python27\ python xxx.py

edit flag offensive delete link more
0

answered 2013-12-09 09:34:14 -0600

EBahr gravatar image

Stupid question, but did you make sure you can open it in the GUI? I know GE also uses a .sav format and trying to open one of those might give a similar error.

edit flag offensive delete link more

Comments

This is a good point. It can be confusing when multiple providers use the same extension but they aren't compatible.

JervisW gravatar imageJervisW ( 2013-12-31 22:20:40 -0600 )edit

so um...how does one open the GE .sav files?

faketiffanyhsu gravatar imagefaketiffanyhsu ( 2016-09-22 00:12:58 -0600 )edit

You will have to another program that supports the GE .out format. As far as I know, GE PSLF is the only program that can.

EBahr gravatar imageEBahr ( 2017-02-22 17:18:09 -0600 )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

Stats

Asked: 2013-12-06 05:10:47 -0600

Seen: 3,776 times

Last updated: Nov 20 '14