1

Can't open .sav file

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!

LDale's avatar
11
LDale
asked 2013-12-06 05:10:47 -0500
JervisW's avatar
1.3k
JervisW
updated 2013-12-31 22:18:12 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

5 Answers

1

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
terrytian's avatar
49
terrytian
answered 2013-12-07 00:12:35 -0500
edit flag offensive 0 remove flag delete link

Comments

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

jsexauer's avatar jsexauer (2014-01-02 09:41:35 -0500) edit

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

terrytian's avatar terrytian (2014-01-02 22:05:08 -0500) edit
add a comment see more comments
0

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

ZohaibHassan's avatar
1
ZohaibHassan
answered 2014-11-20 05:25:37 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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
jconto's avatar
2.9k
jconto
answered 2013-12-06 10:37:02 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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.

EBahr's avatar
420
EBahr
answered 2013-12-09 09:34:14 -0500
edit flag offensive 0 remove flag delete link

Comments

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

JervisW's avatar JervisW (2013-12-31 22:20:40 -0500) edit

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

faketiffanyhsu's avatar faketiffanyhsu (2016-09-22 00:12:58 -0500) 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's avatar EBahr (2017-02-22 17:18:09 -0500) edit
add a comment see more comments
0

@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

yfwing's avatar
436
yfwing
answered 2013-12-06 11:03:45 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer